|
1 | 1 | ""
|
2 | 2 | " Open/create a note.
|
3 |
| -function! noteworthy#Note(line1, line2, ...) abort |
4 |
| - call s:File('edit', a:000, a:line1, a:line2) |
| 3 | +function! noteworthy#Note(range, line1, line2, ...) abort |
| 4 | + call s:File('edit', a:000, a:range, a:line1, a:line2) |
5 | 5 | endfunction
|
6 | 6 |
|
7 | 7 | ""
|
8 | 8 | " Open/create a note in a new tab.
|
9 |
| -function! noteworthy#Tnote(line1, line2, ...) abort |
10 |
| - call s:File('tabedit', a:000, a:line1, a:line2) |
| 9 | +function! noteworthy#Tnote(range, line1, line2, ...) abort |
| 10 | + call s:File('tabedit', a:000, a:range, a:line1, a:line2) |
11 | 11 | endfunction
|
12 | 12 |
|
13 | 13 | ""
|
14 | 14 | " Open/create a note in a new split.
|
15 | 15 | function! noteworthy#Snote(line1, line2, ...) abort
|
16 | 16 | call s:File(get(
|
17 | 17 | \ g:, 'noteworthy_split_size', ''
|
18 |
| - \ ) . 'split', a:000, a:line1, a:line2) |
| 18 | + \ ) . 'split', a:000, a:range, a:line1, a:line2) |
19 | 19 | endfunction
|
20 | 20 |
|
21 | 21 | ""
|
22 | 22 | " Open/create a note in a new vertical split.
|
23 | 23 | function! noteworthy#Vnote(line1, line2, ...) abort
|
24 | 24 | call s:File(get(
|
25 | 25 | \ g:, 'noteworthy_vsplit_size', ''
|
26 |
| - \ ) . 'vsplit', a:000, a:line1, a:line2) |
| 26 | + \ ) . 'vsplit', a:000, a:range, a:line1, a:line2) |
27 | 27 | endfunction
|
28 | 28 |
|
29 | 29 | ""
|
@@ -181,12 +181,12 @@ endfunction
|
181 | 181 |
|
182 | 182 | ""
|
183 | 183 | " Create or open a note in the current library.
|
184 |
| -function! s:File(command, segments, line1, line2) abort |
| 184 | +function! s:File(command, segments, range, line1, line2) abort |
185 | 185 | let l:delim = s:GetNoteDelimiter()
|
186 | 186 | let l:fext = s:GetNoteFileExt()
|
187 | 187 | let l:file = s:GetFileName(a:segments, l:delim)
|
188 | 188 | let l:basedir = fnamemodify(l:file, ':h')
|
189 |
| - if a:line1 != 0 | let l:lines = getline(a:line1, a:line2) | endif |
| 189 | + if a:range | let l:lines = getline(a:line1, a:line2) | endif |
190 | 190 | if !isdirectory(l:basedir) | call mkdir(l:basedir, 'p') | endif
|
191 | 191 | execute a:command l:file
|
192 | 192 | if get(g:, 'noteworthy_use_header', 1) && getfsize(l:file) <= 0
|
|
0 commit comments