user@machine~$: touch ~/.vimrc # If doesn't exist ~/.vimrc, then create it.
set nu ic ai et ts=4 sw=4 hlsearch
Set Line Number:
:set nu(active) and:set nu!(deactive)
SetTab Space (ts)andShift Wifth (sw)to 4::set ts=4 sw=4
Set Autometic Indentation::set ai
Set Highlight Search Results::set hlsearch(active) and:set hlsearch!(deactive)
Note: ic --> ignore case; et --> expandtab; ts --> tabstop; sw--> shiftwidth; nu --> number
- Insert Mode/Insert Text:
a, oro - Command Mode:
escape + : + <command>
Note-1:
:impliesshift +.
Note-2: Write:by usingescape + shift + :.
Note-3: Write any command by usingescapefirst.
Note-4: The+sign denotespress one after another button. (e.g.,eacape + pmeans press theESCbutton and thenp.)
- Save and Quit Together:
:x, or:wq(Only Save::w, Only Quit::q) - Force Quit (without saving the file):
:q!
- Delete a Line:
eacape + dd - Delete Till End of a Line:
eacape + d + $ - Delete Till Start of a Line:
eacape + d + 0 - Delete Multiple Line (in a range):
:4,8d# Delete 4 to 8 lines
- Copy a Single Line:
eacape + yy - Copy Multiple Line (in a range):
4,8y - Paste a Line:
eacape + p - Cut and Paste Together:
eacape + ddtheneacape + p - Undo Text:
eacape + u - Redo Text:
eacape + control + r
-
Go to the Specific Line Number:
:n(e.g.,::5,:11) -
Go to the Beginning of a File:
:0, or:1, oreacape + [[ -
Go to the Ending of a File:
:$, oreacape + ]] -
Forward a Word:
eacape + w -
Backword a Word:
eacape + b
- Ignore Case (Before Search):
:set ic - Search:
:/<pattern>(e.g.,:/password,:/yes,:/no) - Search Text and Replace:
:%s/<oldText>/<newText>/g(e.g.,:%s/today/tomorrow/g) - Remove Highligh Text:
:noh
- Python Script:
:!python anyName.py
[1]. Downloading Process
[2]. Default Parameters Setting
[3]. Downloading vim Editor
[1]. Richard's
[2]. Core/Basic Commands
[3]. All Commands
[4]. Chris Toomey Talk on YouTube ***