glts / vim-textobj-comment

Vim text objects for comments
http://www.vim.org/scripts/script.php?script_id=4570
131 stars 8 forks source link

Default mappings conflict with textobj-word-column.vim #1

Closed glts closed 8 years ago

glts commented 11 years ago

The default mappings ac, ic, and aC conflict with the mappings of the textobj-word-column.vim plugin.

I suggest remapping the textobj-word-column.vim mappings to av/iv and aV/iV: You can think of it as either an abbreviation for "Visual block", or as the letter right next to "w" for "word" and "W" for "WORD". At the end of the day, Visual blocks of words/WORDS is what that plugin does.

To remap, copy and paste this into your vimrc file:

let g:skip_default_textobj_word_column_mappings = 1
xnoremap <silent> av :<C-U>call TextObjWordBasedColumn("aw")<CR>
onoremap <silent> av :call TextObjWordBasedColumn("aw")<CR>
xnoremap <silent> iv :<C-U>call TextObjWordBasedColumn("iw")<CR>
onoremap <silent> iv :call TextObjWordBasedColumn("iw")<CR>
xnoremap <silent> aV :<C-U>call TextObjWordBasedColumn("aW")<CR>
onoremap <silent> aV :call TextObjWordBasedColumn("aW")<CR>
xnoremap <silent> iV :<C-U>call TextObjWordBasedColumn("iW")<CR>
onoremap <silent> iV :call TextObjWordBasedColumn("iW")<CR>

If you decide to reaccomodate the mappings for the textobj-comment plugin instead, here is how to do it:

let g:textobj_comment_no_default_key_mappings = 1
xmap ax <Plug>(textobj-comment-a)
omap ax <Plug>(textobj-comment-a)
xmap ix <Plug>(textobj-comment-i)
omap ix <Plug>(textobj-comment-i)
xmap aX <Plug>(textobj-comment-big-a)
omap aX <Plug>(textobj-comment-big-a)
glts commented 8 years ago

Not really worth keeping this open.