Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

open browser when OpenBrowser installed. fix #297

  • Loading branch information...
commit f88de22598d112a703855425e2f75675f4c4bf41 1 parent de3a7fc
@kakkyz81 authored
Showing with 37 additions and 0 deletions.
  1. +16 −0 autoload/evervim.vim
  2. +21 −0 plugin/py/evervimmer.py
View
16 autoload/evervim.vim
@@ -266,6 +266,22 @@ function! evervim#markdownBufSetup() " {{{
endfunction
"}}}
+function! evervim#noteOpenBrowser() " {{{
+ if &ft == 'notes' || &ft == 'notesbytag' || &ft == 'notesbyquery'
+ python Evervimmer.getInstance().cursorNoteOpenBrowser()
+ else
+ python Evervimmer.getInstance().currentNoteOpenBrowser()
+ endif
+endfunction
+"}}}
+
+" add command {{{
+" Check OpenBrowser is installed that must be after plugin loaded, so check this.
+if exists(':OpenBrowser') == 2
+ command! EvervimNoteOpenBrowser call evervim#noteOpenBrowser()
+endif
+"}}}
+
python << EOF
import sys,os,vim
sys.path.append(os.path.join(vim.eval('expand("<sfile>:p:h")'),'../plugin/py/'))
View
21 plugin/py/evervimmer.py
@@ -253,8 +253,29 @@ def getNote(self): # {{{
#}}}
+ def currentNoteOpenBrowser(self): # {{{
+ if None == Evervimmer.currentnote or None == Evervimmer.currentnote.guid:
+ return
+
+ self.__openBrowser(Evervimmer.currentnote.guid)
+ #}}}
+
+ def cursorNoteOpenBrowser(self): # {{{
+ currentline = int(vim.eval("line('.')"))
+ if currentline < 2:
+ return
+
+ selectedNote = Evervimmer.notes[currentline - 2]
+ self.__openBrowser(selectedNote.guid)
+ #}}}
+
# ----- private methods
+ def __openBrowser(self, guid): # {{{
+ uri = "https://www.evernote.com/view/" + guid
+ vim.command(":OpenBrowser " + uri)
+ #}}}
+
def __setBufferList(self, buffertitlelist, title): # {{{
vim.current.buffer[:] = None # clear buffer
vim.current.buffer[0] = title # remove empty line(line 1)
Please sign in to comment.
Something went wrong with that request. Please try again.