Vim has a lot of built-in commands that are very helpful. The following table lists commands I tend to use often. However, this is not even the tip of the command iceberg Vim offers.
Command | Explanation |
:%s/foo/bar/g | Replace all instances of “foo” with “bar”. |
:g/foobar/d | Delete all lines containing “foobar”. |
d$ | Delete the current line after the marker. |
= | Auto indent visually marked lines. |
5> | Indent visually marked lines 5 spaces to the right. |
:sort u | Sort visually marked lines and remove duplicate lines. |
:w !sudo tee % | Save changes as root. |
Leave a Reply