Oh Shit, Vim or Vi
vi is the de facto standard Unix editor, you find it in every NIX derived OS.
Thats why you should learn a handfull of commands, you can the show off your Vi skills
The first thing you need to learn is how to exit
- just quit:
- just quit and not save:
- quit and save any changes:
Next up is editing
ithen escape to exit insert mode
athen escape to exit insert mode then escape to exit insert mode
- append at the end of the line:
- Begin a new line below the cursor:
othen escape to exit insert mode
- Begin a new line above the cursor:
O(shift-O) then escape to exit insert mode
Now you can exit and edit a file, what if you want to delete stuff?
- Delete characters:
- Delete lines:
- Delete the characters under the cursor until the end of the line:
Great, you can exit and edit and even delete. SO what else would bew cool to do?
How about copy a line and past it else where?
- yank a line:
- move to destination line
- paste after cursor
Pto paste before the cursor
SO you made a change and you need to undo it, or you made a change and want to repeat it. We have you covered!
- undo is just
- you can redo a change with
- repeat the last change with
Thats most of the cool stuff I know, the last 2 things are searching
- searching can be started with
/then type out what your looking for.
- repeat your search with
- you can also search up the file with
And the very last thing is substituting, this is find and replace
:s%/find/replace/gthis is look for
findand replace it with
:%s!file path!new path!gyou can use any delimiter, that helps with changing a path