Useful Commands for Vi

The page is meant to document some of the more useful, but obscure commands in vi. For commands exclusive to vim see Reasons To Use Vim Over Vi. Please feel free to add commands you would like to see on this page.

% move to matching (, {, or [ n G goto line n f char move to position of the next char t char move to position before next char J join the next line to the current one m reg mark position in reg which can be a-z ` reg move to position in reg which can be a-z

f and t are useful for changing quotes. say you are at the first position on the line below

echo “old_text” . $var . “preserve”;

to change this you simply to say “new_value” in place of “old_text” you can press


m and ` are useful for marking locations to remember and moving large chunks of code.