Skip to content

Commit 6d3214d

Browse files
author
陈家启
committed
support user define map
1 parent 5131438 commit 6d3214d

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

plugin/textobj/argument.vim

+31-6
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,39 @@ if !exists('g:argument_right_bracket')
1616
let g:argument_right_bracket = '[])]'
1717
endif
1818

19+
if !exists('g:argument_mapping_select_around')
20+
let g:argument_mapping_select_around = 'aa'
21+
endif
22+
23+
if !exists('g:argument_mapping_select_inside')
24+
let g:argument_mapping_select_inside = 'ia'
25+
endif
26+
27+
if !exists('g:argument_mapping_move_previous')
28+
let g:argument_mapping_move_previous = '[a'
29+
endif
30+
31+
if !exists('g:argument_mapping_move_start')
32+
let g:argument_mapping_move_start = '[A'
33+
endif
34+
35+
if !exists('g:argument_mapping_move_next')
36+
let g:argument_mapping_move_next = ']a'
37+
endif
38+
39+
if !exists('g:argument_mapping_move_end')
40+
let g:argument_mapping_move_end = ']A'
41+
endif
42+
43+
1944
call textobj#user#plugin('argument', {
2045
\ '-': {
21-
\ 'select-a': 'aa', 'select-a-function': 'textobj#argument#select_a',
22-
\ 'select-i': 'ia', 'select-i-function': 'textobj#argument#select_i',
23-
\ 'move-n': ']a', 'move-n-function': 'textobj#argument#move_n',
24-
\ 'move-N': ']A', 'move-N-function': 'textobj#argument#move_N',
25-
\ 'move-p': '[a', 'move-p-function': 'textobj#argument#move_p',
26-
\ 'move-P': '[A', 'move-P-function': 'textobj#argument#move_P',
46+
\ 'select-a': g:argument_mapping_select_around, 'select-a-function': 'textobj#argument#select_a',
47+
\ 'select-i': g:argument_mapping_select_inside, 'select-i-function': 'textobj#argument#select_i',
48+
\ 'move-n': g:argument_mapping_move_previous, 'move-n-function': 'textobj#argument#move_n',
49+
\ 'move-N': g:argument_mapping_move_start, 'move-N-function': 'textobj#argument#move_N',
50+
\ 'move-p': g:argument_mapping_move_next, 'move-p-function': 'textobj#argument#move_p',
51+
\ 'move-P': g:argument_mapping_move_end, 'move-P-function': 'textobj#argument#move_P',
2752
\ 'sfile': expand('<sfile>:p'),
2853
\ },
2954
\ })

0 commit comments

Comments
 (0)