Skip to content

Commit

Permalink
Bug fix: Update note name highlighting when reloading syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Dec 25, 2010
1 parent 2295e84 commit 3e4ec8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions autoload.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: December 24, 2010
" Last Change: December 25, 2010
" URL: http://peterodding.com/code/vim/notes/

" Note: This file is encoded in UTF-8 including a byte order mark so
Expand Down Expand Up @@ -414,9 +414,9 @@ function! xolox#notes#indent_list(command, line1, line2) " {{{3
normal $
endfunction

function! xolox#notes#highlight_names() " {{{3
function! xolox#notes#highlight_names(force) " {{{3
" Highlight the names of all notes as "notesName" (linked to "Underlined").
if !(exists('b:notes_names_last_highlighted') && b:notes_names_last_highlighted > s:cache_mtime)
if a:force || !(exists('b:notes_names_last_highlighted') && b:notes_names_last_highlighted > s:cache_mtime)
let starttime = xolox#timer#start()
let titles = filter(xolox#notes#get_titles(), '!empty(v:val)')
call map(titles, 's:words_to_pattern(v:val)')
Expand Down
6 changes: 3 additions & 3 deletions notes.vim
@@ -1,9 +1,9 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
" Last Change: December 24, 2010
" Last Change: December 25, 2010
" URL: http://peterodding.com/code/vim/notes/
" License: MIT
" Version: 0.7.15
" Version: 0.7.16

" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3375 1 :AutoInstall: session.zip
Expand Down Expand Up @@ -59,7 +59,7 @@ augroup PluginNotes
" to notes (which is IMHO better than always showing the E325 prompt).
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 WinEnter * if &ft == 'notes' | call xolox#notes#highlight_names(0) | endif
au BufReadPost * if &ft == 'notes' | unlet! b:notes_names_last_highlighted | endif
au BufUnload * if &ft == 'notes' | call xolox#notes#unload_from_cache() | endif
call s:DefAutoCmd('BufWritePost', g:notes_directory, 'call xolox#notes#cleanup()')
Expand Down
4 changes: 2 additions & 2 deletions syntax.vim
@@ -1,6 +1,6 @@
" Vim syntax script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: December 24, 2010
" Last Change: December 25, 2010
" URL: http://peterodding.com/code/vim/notes/

" Note: This file is encoded in UTF-8 including a byte order mark so
Expand All @@ -23,7 +23,7 @@ syntax cluster notesInline contains=notesName
highlight def link notesHiddenMarker Ignore

" Highlight note names as hyperlinks. {{{2
call xolox#notes#highlight_names()
call xolox#notes#highlight_names(1)
syntax cluster notesInline add=notesName
highlight def link notesName Underlined

Expand Down

0 comments on commit 3e4ec8f

Please sign in to comment.