Created
September 14, 2015 18:23
-
-
Save RohanBhanderi/0292bb50ce541573f4aa to your computer and use it in GitHub Desktop.
vi commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commands | |
------------------------------- | |
:q exit if there are no changes | |
:q! exit without save | |
:wq,:x save and exit | |
:w save | |
u Undo last change | |
U undo all changes to the line | |
Selection | |
------------------------------- | |
v visule mode to select using arrow keys | |
y copy selected pard | |
p paste copied selection | |
Cursor Navigation | |
------------------------------- | |
0 Move to start of line | |
$ Move to end of line | |
:0 move to first line of file | |
:$ move to last line of file | |
w move to next word | |
b move to previous word | |
:n go to nth line | |
Search | |
------------------------------- | |
:/string_to_search | |
n go to next match | |
Replace | |
------------------------------- | |
:s/pattern/newstring/flags replace in current line indecated by cursor | |
g replace all | |
c confirm before replacing | |
& repeat last :s command | |
:%s/pattern/newstring/flags replace in whole file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment