Skip to content
Browse files

Bug fix: Always keep cached note names up to date

  • Loading branch information...
1 parent 79eea08 commit 9a044fbd479f87c1e86454dd9388b618d5dd70ff @xolox committed Dec 24, 2010
Showing with 10 additions and 5 deletions.
  1. +9 −4 autoload.vim
  2. +1 −1 notes.vim
View
13 autoload.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: December 22, 2010
+" Last Change: December 24, 2010
" URL: http://peterodding.com/code/vim/notes/
" Note: This file is encoded in UTF-8 including a byte order mark so
@@ -24,12 +24,17 @@ function! xolox#notes#rename() " {{{1
" When the current note's title is changed, automatically rename the buffer.
if &filetype == 'notes' && &modified && line('.') > 1
let oldpath = expand('%:p')
- let newpath = xolox#notes#title_to_fname(getline(1))
+ let title = getline(1)
+ let newpath = xolox#notes#title_to_fname(title)
if newpath != '' && !xolox#path#equals(oldpath, newpath)
- if oldpath != '' && !exists('b:notes_oldfname')
- let b:notes_oldfname = oldpath
+ if oldpath != ''
+ call xolox#notes#cache_del(oldpath)
+ if !exists('b:notes_oldfname')
+ let b:notes_oldfname = oldpath
+ endif
endif
execute 'silent file' fnameescape(newpath)
+ call xolox#notes#cache_add(newpath, title)
" Redraw tab line with new filename.
let &stal = &stal
endif
View
2 notes.vim
@@ -3,7 +3,7 @@
" Last Change: December 24, 2010
" URL: http://peterodding.com/code/vim/notes/
" License: MIT
-" Version: 0.7.9
+" Version: 0.7.10
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3375 1 :AutoInstall: session.zip

0 comments on commit 9a044fb

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