shift - Allign the words to the specified column in vim using commands -


how can move or shift words in entire file specified column? example below: before :

123 abc 112 xyzs 15925 asdf 1111 25asd 1 qwer 

after :

123    abc 112    xyzs 15925  asdf 1111   25asd 1      qwer 

how can done using command mode? here thing need shift 2nd word specified column here specified column 8

approach built-in commands

first :substitute whitespace tab character, , :retab tab stop column 8, expanding spaces (for given example):

:.,.+4substitute/\s\+/\t/ | set tabstop=7 expandtab | '[,']retab 

(i'm omitting resetting of modified options, should matter you.)

approach plugin

my alignfromcursor plugin has commands align text right of cursor column. combine :global command invokes lines in range, , w motion go second word in each, , you'll get:

.,.+4global/^/exe 'normal! w' | leftalignfromcursor 8 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -