@@ -11,45 +11,24 @@ if exists('g:loaded_extract') || &compatible || v:version < 700
1111endif
1212let g: loaded_extract = 1
1313
14- if ! exists (' g:extract_buffer_name' )
15- let g: extract_buffer_name = ' _{filename}'
16- endif
17-
1814if ! exists (' g:extract_hidden' )
1915 let g: extract_hidden = 0
2016endif
2117
22- if ! exists (' g:extract_default_position' )
23- let g: extract_default_position = ' top'
24- endif
25-
26- let s: allowed_position_args = [' -top' , ' -bottom' , ' -left' , ' -right' , ' -tab' ]
27-
28- func ! s: autocompletion (input , command_line, cursor_position) abort
29- return filter (s: allowed_args , ' v:val =~ a:input' )
30- endfunc
31-
32- func ! s: extract (start_line, end_line, count , clear , ... ) abort
18+ func ! s: extract (start_line, end_line, count , clear , mods, name) abort
3319 let l: selection = {
3420 \ ' start_line' : a: start_line ,
3521 \ ' end_line' : a: end_line ,
3622 \ ' count' : a: count
3723 \ }
38- let l: buffer_options = { ' clear' : a: clear }
3924
40- let l: name_args = filter (copy (a: 000 ), ' index(s:allowed_position_args, v:val) < 0' )
41- if len (l: name_args )
42- let l: buffer_options .name = join (l: name_args )
43- endif
44-
45- let l: buffer_options .position = g: extract_default_position
46- let l: position_args = filter (copy (a: 000 ), ' index(s:allowed_position_args, v:val) >= 0' )
47- if len (l: position_args )
48- let l: buffer_options .position = substitute (l: position_args [-1 ], ' -' , ' ' , ' g' )
49- endif
25+ let l: buffer_options = {
26+ \ ' name' : a: name ,
27+ \ ' clear' : a: clear ,
28+ \ ' mods' : a: mods
29+ \ }
5030
5131 call extract#extract (l: selection , l: buffer_options )
5232endfunc
5333
54- comm! -nargs =* -range =0 - bang -complete =customlist ,s: autocompletion Extr
55- \ call s: extract (<line1> , <line2> , <count> , ! empty (' <bang>' ), <f-args> )
34+ comm! -nargs =? -range =0 - bang Extr call s: extract (<line1> , <line2> , <count> , ! empty (' <bang>' ), <q-mods> , <q-args> )
0 commit comments