Cheetsheet - Hoangdinh85/ITC-136 GitHub Wiki
Vi= older/grumpier version of Vim
-
network gear
-
embedded systems
-
minimal cloud images
-
I indicates insert
-
delete with dd
-
shif-u to undo
-
i for insert, esc for command mode
-
:w
-
:q!
-
:wq (write and quit)
-
u undo
-
how do we get to command mode? once we're there *: *:wq (write and quit) *particular line number *:34
-
Line:
-
go to end of line $
-
go to start pf line 0
-
file:
-
Go to top of the line
-
:split
-
to move between window ctl-w-w or ctl-w ctl-w
-
:hide
-
gets ride of window(you'll be prompt to save changes before you
-
search
-
/what you're searching for
-
(press n to go to the next match)
-
modes:
-
i for insert mode (so i can type things)
-
escape to get back to command mode
-
writing and exiting
-
:wq! write and quit no matter what. (! force the command)
-
:w writes the file without quiting
-
:wq writes and quits but if there is an error it will stop
-
:q! quits without writing the file
-
search and replace (the most obtuse of vim commands) Example :%s/1/one/g
-
: puts us into command mode
-
%s tells us to search and replace through the entire file
-
/1 is the thing we are searching for and replacing
-
/one is thing we are replacing /1 with
-
/g means to it globally
-
- this command will turn 111 into oneoneone or 102 into one02
-
:set paste allow you to paste and retain formatting