The Vim Expand Region Plugin

Do you have a cramp in your hand from typing viw or vi( etc. ? Do you sometimes select something whilst editing only to think, hmmm, if only I could now easily easily select just a bit more?

Well you need Vim awesomeness No. 17676865, the vim-expand-region plugin!

When I originally added this plugin in I didn’t bother to configure it and so it didn’t hit full awesome - but now I have put in the following plus the addition of two more text object plugins:

let g:expand_region_text_objects = {
      \ 'iw'  :0,
      \ 'iW'  :0,
      \ 'i"'  :0,
      \ 'i''' :0,
      \ 'i]'  :1,
      \ 'ib'  :1,
      \ 'iB'  :1,
      \ 'il'  :1,
      \ 'ip'  :1,
      \ 'ie'  :0,
      \ }

vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)

So now, by just hitting vv I can select a word, then another v for the line, then anotherfor the paragraph etc. Win!

  • //Tags:
  • //Posted: Aug 25, 2018