# 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](https://kb.ucla.edu/link/957). 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-zNotes:  
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

 f"lct"new\_valuem and ` are useful for marking locations to remember and moving large chunks of code.