Vim Visual mode: Select current block under cursor

vimvimscript

Considering we have the current data:

ID     NAME          AGE 
1      Joan          29
2      Peterson      16
3      Hunt          47
4      Wenche        12
5      Kennedy       29
6      Lottie        31

And the cursor is the on the N in NAME, how would I go about selecting the text so that, if | is the delimiters of the visual block, the selection should be like this

ID    |NAME    |     AGE 
1     |Joan    |     29
2     |Peterson|     16
3     |Hunt    |     47
4     |Wenche  |     12
5     |Kennedy |     29
6     |Lottie  |     31

The trailing whitespace after each element to match the width of Peterson is not necessary, but I need a quick way to highlight the current block, if it exists.

Best Answer

With the cursor on the N of NAME, I would simply do the following without much care for golfing:

<C-v>}hhhhhhhh

But the textobj-column plugin does exactly what you want. Magically.

Related Question