Skip to content

Commit

Permalink
support user define map
Browse files Browse the repository at this point in the history
  • Loading branch information
陈家启 committed Oct 29, 2023
1 parent 5131438 commit b05fb70
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions plugin/textobj/argument.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,39 @@ if !exists('g:argument_right_bracket')
let g:argument_right_bracket = '[])]'
endif

if !exists('g:argument_mapping_select_around')
let g:argument_mapping_select_around = 'aa'
endif

if !exists('g:argument_mapping_select_inside')
let g:argument_mapping_select_inside = 'ia'
endif

if !exists('g:argument_mapping_move_previous')
let g:argument_mapping_move_previous = '[a'
endif

if !exists('g:argument_mapping_move_start')
let g:argument_mapping_move_start = '[A'
endif

if !exists('g:argument_mapping_move_next')
let g:argument_mapping_move_next = ']a'
endif

if !exists('g:argument_mapping_move_end')
let g:argument_mapping_move_end = ']A'
endif


call textobj#user#plugin('argument', {
\ '-': {
\ 'select-a': 'aa', 'select-a-function': 'textobj#argument#select_a',
\ 'select-i': 'ia', 'select-i-function': 'textobj#argument#select_i',
\ 'move-n': ']a', 'move-n-function': 'textobj#argument#move_n',
\ 'move-N': ']A', 'move-N-function': 'textobj#argument#move_N',
\ 'move-p': '[a', 'move-p-function': 'textobj#argument#move_p',
\ 'move-P': '[A', 'move-P-function': 'textobj#argument#move_P',
\ 'select-a': g:argument_mapping_select_around, 'select-a-function': 'textobj#argument#select_a',
\ 'select-i': g:argument_mapping_select_inside, 'select-i-function': 'textobj#argument#select_i',
\ 'move-n': g:argument_mapping_move_next, 'move-n-function': 'textobj#argument#move_n',
\ 'move-N': g:argument_mapping_move_end, 'move-N-function': 'textobj#argument#move_N',
\ 'move-p': g:argument_mapping_move_previous, 'move-p-function': 'textobj#argument#move_p',
\ 'move-P': g:argument_mapping_move_start, 'move-P-function': 'textobj#argument#move_P',
\ 'sfile': expand('<sfile>:p'),
\ },
\ })

0 comments on commit b05fb70

Please sign in to comment.