Skip to content
Browse files

Forget about notes that are never saved

  • Loading branch information...
1 parent 46e2978 commit 2a1a704c81520d45f64b999ce758a104438f3072 @xolox committed
Showing with 9 additions and 1 deletion.
  1. +7 −0 autoload.vim
  2. +2 −1 notes.vim
View
7 autoload.vim
@@ -383,6 +383,13 @@ function! xolox#notes#cache_del(filename) " {{{3
endif
endfunction
+function! xolox#notes#unload_from_cache() " {{{3
+ let bufname = expand('<afile>:p')
+ if !filereadable(bufname)
+ call xolox#notes#cache_del(bufname)
+ endif
+endfunction
+
" Functions called by the file type plug-in and syntax script. {{{2
function! xolox#notes#insert_quote(style) " {{{3
View
3 notes.vim
@@ -3,7 +3,7 @@
" Last Change: December 24, 2010
" URL: http://peterodding.com/code/vim/notes/
" License: MIT
-" Version: 0.7.12
+" Version: 0.7.13
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3375 1 :AutoInstall: session.zip
@@ -60,6 +60,7 @@ augroup PluginNotes
au BufReadCmd note:* nested call xolox#notes#shortcut()
au SwapExists * call xolox#notes#swaphack()
au WinEnter * if &ft == 'notes' | call xolox#notes#highlight_names() | endif
+ au BufUnload * if &ft == 'notes' | call xolox#notes#unload_from_cache() | endif
call s:DefAutoCmd('BufWritePost', g:notes_directory, 'call xolox#notes#cleanup()')
augroup END

0 comments on commit 2a1a704

Please sign in to comment.
Something went wrong with that request. Please try again.