Skip to content

Commit 3246ed6

Browse files
committed
Merge pull request #69: Don't sync title for shadow notes
This also resolves issue #55.
2 parents 68c1d55 + de6546f commit 3246ed6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

autoload/xolox/notes.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: June 21, 2014
3+
" Last Change: June 29, 2014
44
" URL: http://peterodding.com/code/vim/notes/
55

66
" Note: This file is encoded in UTF-8 including a byte order mark so
77
" that Vim loads the script using the right encoding transparently.
88

9-
let g:xolox#notes#version = '0.23.10'
9+
let g:xolox#notes#version = '0.23.11'
1010
let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
1111
let s:scriptdir = expand('<sfile>:p:h')
1212

@@ -140,7 +140,7 @@ function! xolox#notes#edit(bang, title) abort " {{{1
140140
if fname != ''
141141
call xolox#misc#msg#debug("notes.vim %s: Editing existing note: %s", g:xolox#notes#version, fname)
142142
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()
144144
call s:transcode_utf8_latin1()
145145
endif
146146
call xolox#notes#set_filetype()
@@ -176,7 +176,7 @@ function! xolox#notes#check_sync_title() " {{{1
176176
let title = xolox#notes#current_title()
177177
let name_on_disk = xolox#misc#path#absolute(expand('%:p'))
178178
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()
180180
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)
181181
let action = g:notes_title_sync
182182
if action == 'prompt' && empty(name_from_title)
@@ -246,6 +246,11 @@ function! s:get_visual_selection()
246246
return join(lines, ' ')
247247
endfunction
248248

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+
249254
function! xolox#notes#edit_shadow() " {{{1
250255
" People using latin1 don't like the UTF-8 curly quotes and bullets used in
251256
" the predefined notes because there are no equivalent characters in latin1,

0 commit comments

Comments
 (0)