Skip to content

Commit 144b548

Browse files
committed
integration: Edit inplace if current vim buffer no modified
1 parent 53fe6ad commit 144b548

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

sphinxnotes/snippet/integration/binding.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
"
44
" :Author: Shengyu Zhang
55
" :Date: 2021-04-12
6-
" :Version: 20210814
6+
" :Version: 20211114
77
"
88
function! g:SphinxNotesSnippetEdit(id)
99
let file = system(join([s:snippet, 'get', '--file', a:id, '2>/dev/null'], ' '))
1010
let line = system(join([s:snippet, 'get', '--line-start', a:id, '2>/dev/null'], ' '))
11-
execute 'tabedit ' . file
11+
if &modified
12+
execute 'tabedit ' . file
13+
else
14+
execute 'edit ' . file
15+
endif
1216
execute line
1317
endfunction
1418

sphinxnotes/snippet/integration/plugin.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"
44
" :Author: Shengyu Zhang
55
" :Date: 2021-04-01
6-
" :Version: 20210814
6+
" :Version: 20211114
77
"
88
" NOTE: junegunn/fzf.vim is required
99

0 commit comments

Comments
 (0)