I have been using vim for about 3 weeks now and have been having problem with tabs.
What I usually do is do gg to go to the top, do a ctrl+v for visual block, do a G to select everything to below(one column), do a $ to select to the right, then press < or > to tab.
However having to do all this, I lose the selection and I have to do all those commands to do another tab.
How do I not lose selection? Or is there a better way?
NOTE: I sometimes don’t need to select everything sometimes just a portion of the file.
To reselect a visual selection use the
gvcommand followed by your command. Although this is not the best way.Instead select the whole buffer with
ggVGthen indent with>. This will indent the selection. To repeat the command again just press.. The.command will repeat the last normal command, in this case the>command. If you have indent a few times to many just use the undo command,u, as many times as necessary. This vimcast is a great screencast describing this technique and this one describe more indention techniques.Others prefer the following mappings: