Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allign the words to the specified column in vim using commands

Tags:

vim

shift

How I can move or shift the words in the entire file to the specified column? For example like below: Before :

123 ABC
112 XYZS
15925 asdf
1111 25asd
1 qwer

After :

123    ABC
112    XYZS
15925  asdf
1111   25asd
1      qwer

How it can be done using command mode? Here the thing is we need to shift the 2nd word to the specified column Here the specified column is 8

like image 724
imbichie Avatar asked Nov 25 '25 15:11

imbichie


1 Answers

except for vim-plugins mentioned by others, if you were working on a linux box with column command available, you could just :

%!column -t

% could be vim ranges, e.g. visual selections etc..

like image 167
Kent Avatar answered Nov 27 '25 05:11

Kent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!