|
1 | 1 | " Vim auto-load script
|
2 | 2 | " Author: Peter Odding <peter@peterodding.com>
|
3 |
| -" Last Change: June 21, 2014 |
| 3 | +" Last Change: June 29, 2014 |
4 | 4 | " URL: http://peterodding.com/code/vim/notes/
|
5 | 5 |
|
6 | 6 | " Note: This file is encoded in UTF-8 including a byte order mark so
|
7 | 7 | " that Vim loads the script using the right encoding transparently.
|
8 | 8 |
|
9 |
| -let g:xolox#notes#version = '0.23.10' |
| 9 | +let g:xolox#notes#version = '0.23.11' |
10 | 10 | let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
|
11 | 11 | let s:scriptdir = expand('<sfile>:p:h')
|
12 | 12 |
|
@@ -140,7 +140,7 @@ function! xolox#notes#edit(bang, title) abort " {{{1
|
140 | 140 | if fname != ''
|
141 | 141 | call xolox#misc#msg#debug("notes.vim %s: Editing existing note: %s", g:xolox#notes#version, fname)
|
142 | 142 | execute 'edit' . a:bang fnameescape(fname)
|
143 |
| - if !xolox#notes#unicode_enabled() && xolox#misc#path#equals(fnamemodify(fname, ':h'), g:notes_shadowdir) |
| 143 | + if !xolox#notes#unicode_enabled() && xolox#notes#is_shadow() |
144 | 144 | call s:transcode_utf8_latin1()
|
145 | 145 | endif
|
146 | 146 | call xolox#notes#set_filetype()
|
@@ -176,7 +176,7 @@ function! xolox#notes#check_sync_title() " {{{1
|
176 | 176 | let title = xolox#notes#current_title()
|
177 | 177 | let name_on_disk = xolox#misc#path#absolute(expand('%:p'))
|
178 | 178 | let name_from_title = xolox#notes#title_to_fname(title)
|
179 |
| - if !xolox#misc#path#equals(name_on_disk, name_from_title) |
| 179 | + if !xolox#misc#path#equals(name_on_disk, name_from_title) && !xolox#notes#is_shadow() |
180 | 180 | call xolox#misc#msg#debug("notes.vim %s: Filename (%s) doesn't match note title (%s)", g:xolox#notes#version, name_on_disk, name_from_title)
|
181 | 181 | let action = g:notes_title_sync
|
182 | 182 | if action == 'prompt' && empty(name_from_title)
|
@@ -246,6 +246,11 @@ function! s:get_visual_selection()
|
246 | 246 | return join(lines, ' ')
|
247 | 247 | endfunction
|
248 | 248 |
|
| 249 | +function! xolox#notes#is_shadow() " {{{1 |
| 250 | + " Check if the current note is a shadow note. |
| 251 | + return xolox#misc#path#equals(expand('%:p:h'), g:notes_shadowdir) |
| 252 | +endfunction |
| 253 | + |
249 | 254 | function! xolox#notes#edit_shadow() " {{{1
|
250 | 255 | " People using latin1 don't like the UTF-8 curly quotes and bullets used in
|
251 | 256 | " the predefined notes because there are no equivalent characters in latin1,
|
|
0 commit comments