33" Do not mofidify the code nor insert new lines before '" ___vital___'
44if v: version > 703 || v: version == 703 && has (' patch1170' )
55 function ! vital#_easymotion#Vim#Buffer#import () abort
6- return map ({' _vital_depends' : ' ' , ' read_content' : ' ' , ' get_selected_text' : ' ' , ' is_cmdwin' : ' ' , ' edit_content' : ' ' , ' open' : ' ' , ' get_last_selected' : ' ' , ' _vital_loaded' : ' ' }, ' function("s:" . v:key)' )
6+ return map ({' parse_cmdarg ' : ' ' , ' _vital_depends' : ' ' , ' read_content' : ' ' , ' get_selected_text' : ' ' , ' is_cmdwin' : ' ' , ' edit_content' : ' ' , ' open' : ' ' , ' get_last_selected' : ' ' , ' _vital_loaded' : ' ' }, ' function("s:" . v:key)' )
77 endfunction
88else
99 function ! s: _SID () abort
1010 return matchstr (expand (' <sfile>' ), ' <SNR>\zs\d\+\ze__SID$' )
1111 endfunction
12- execute join ([' function! vital#_easymotion#Vim#Buffer#import() abort' , printf (" return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, \" function('<SNR>%s_' . v:key)\" )" , s: _SID ()), ' endfunction' ], " \n " )
12+ execute join ([' function! vital#_easymotion#Vim#Buffer#import() abort' , printf (" return map({'parse_cmdarg': '', ' _vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, \" function('<SNR>%s_' . v:key)\" )" , s: _SID ()), ' endfunction' ], " \n " )
1313 delfunction s: _SID
1414endif
1515" ___vital___
@@ -114,6 +114,7 @@ function! s:read_content(content, ...) abort
114114 \ ' nobinary' : 0 ,
115115 \ ' bad' : ' ' ,
116116 \ ' edit' : 0 ,
117+ \ ' line' : ' ' ,
117118 \} , get (a: 000 , 0 , {}))
118119 let tempfile = empty (options .tempfile) ? tempname () : options .tempfile
119120 let optnames = [
@@ -127,7 +128,8 @@ function! s:read_content(content, ...) abort
127128 let optname = join (filter (optnames, ' !empty(v:val)' ))
128129 try
129130 call writefile (a: content , tempfile)
130- execute printf (' keepalt keepjumps read %s%s' ,
131+ execute printf (' keepalt keepjumps %sread %s%s' ,
132+ \ options .line ,
131133 \ empty (optname) ? ' ' : optname . ' ' ,
132134 \ fnameescape (tempfile),
133135 \)
@@ -155,6 +157,30 @@ function! s:edit_content(content, ...) abort
155157 setlocal nomodified
156158endfunction
157159
160+ function ! s: parse_cmdarg (... ) abort
161+ let cmdarg = get (a: 000 , 0 , v: cmdarg )
162+ let options = {}
163+ if cmdarg = ~# ' ++enc='
164+ let options .encoding = matchstr (cmdarg, ' ++enc=\zs[^ ]\+\ze' )
165+ endif
166+ if cmdarg = ~# ' ++ff='
167+ let options .fileformat = matchstr (cmdarg, ' ++ff=\zs[^ ]\+\ze' )
168+ endif
169+ if cmdarg = ~# ' ++bad='
170+ let options .bad = matchstr (cmdarg, ' ++bad=\zs[^ ]\+\ze' )
171+ endif
172+ if cmdarg = ~# ' ++bin'
173+ let options .binary = 1
174+ endif
175+ if cmdarg = ~# ' ++nobin'
176+ let options .nobinary = 1
177+ endif
178+ if cmdarg = ~# ' ++edit'
179+ let options .edit = 1
180+ endif
181+ return options
182+ endfunction
183+
158184let &cpo = s: save_cpo
159185unlet s: save_cpo
160186
0 commit comments