Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
Created October 15, 2011 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpabloaj/1289727 to your computer and use it in GitHub Desktop.
Save juanpabloaj/1289727 to your computer and use it in GitHub Desktop.
last evernote from vim
" http://j.mp/dotvimrc
nn <leader>e :call LastEvernote()<CR>
fun! LastEvernote() "{{{
" a better solution is with evernote api
let evernoteDir=expand("$HOME")."/Library/Application*Support/Evernote/data"
let dataDir=system("ls -trlh ".evernoteDir."| tail -n 1| awk '{print $NF}'")
let contentDir=evernoteDir."/".dataDir."/content"
let contentDir=substitute(contentDir,"\n","",'g')
let note=system("ls -trlh ".contentDir." | tail -n 1| awk '{print $NF}'")
let note=substitute(note,"\n","",'g')
sil! exec 'sp '.contentDir.'/'.note.'/content.html'
sil! exec '1s/>/>\r/g'
sil! exec '%s/<br.*\/>/<br\/>\r/g'
sil! exec '%s/<\//\r<\//g'
sil! exec 'g/^\s*$/d'
normal gg
sil! exec '1,4fo'
sil! exec '$-1,$fo'
endf
"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment