@@ -19,7 +19,11 @@ if !exists('g:extract_hidden')
1919 let g: extract_hidden = 0
2020endif
2121
22- let s: allowed_args = [' -top' , ' -bottom' , ' -left' , ' -right' , ' -tab' ]
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' ]
2327
2428func ! s: autocompletion (input , command_line, cursor_position) abort
2529 return filter (s: allowed_args , ' v:val =~ a:input' )
@@ -33,17 +37,15 @@ func! s:extract(start_line, end_line, count, clear, ...) abort
3337 \ }
3438 let l: buffer_options = { ' clear' : a: clear }
3539
36- let l: name_args_filter = ' index(s:allowed_args, v:val) < 0'
37- let l: name_args = filter (copy (a: 000 ), l: name_args_filter )
40+ let l: name_args = filter (copy (a: 000 ), ' index(s:allowed_position_args, v:val) < 0' )
3841 if len (l: name_args )
3942 let l: buffer_options .name = join (l: name_args )
4043 endif
4144
42- let l: position_args_filter = ' index(s:allowed_args, v:val) >= 0 '
43- let l: position_args = filter (copy (a: 000 ), l: position_args_filter )
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 ' )
4447 if len (l: position_args )
45- let l: position_arg = get (l: position_args , -1 )
46- let l: buffer_options .position = substitute (l: position_arg , ' -' , ' ' , ' g' )
48+ let l: buffer_options .position = substitute (l: position_args [-1 ], ' -' , ' ' , ' g' )
4749 endif
4850
4951 call extract#extract (l: selection , l: buffer_options )
0 commit comments