Helpful Vim Notes

You can run commands across visual selection just like you’re running them in Normal mode. Let’s say we have the following lines written in Perl and we forgot to append ; to each of them:

my $a
my $b
my $c

We can visually select all 3 lines using Shift-v, and then run command:

:normal A;

This will execute a command A; (append ; to the end of a line) for each line. If you’d like to run the same command over the entire file content, you could run:

:%normal A;

Delete buffer w/o closing window: bp|bd # (buffer previous, and then delete # alternate file)

Make splits full height/width

Word wrapping

set tw=80
set wrap

Operating on search matches using gn

Deleting a buffer by number

If a buffer has a number 5, we can delete it using :5bw (or :5bw! to force).

Tabbed Editing

Showing the tab bar

set showtabline=1 " or 2 if you want it to be visible all the time