An Interest In:
Web News this Week
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
- March 25, 2024
September 30, 2019 07:44 am GMT
Original Link: https://dev.to/rubiin/vim-quickies-cheatsheet-30gm
Vim quickies/ cheatsheet
Vim Cheatsheet
Contents |
---|
Generally helpful stuff |
Navigating around text |
Working with multiple files |
Searching |
Manipulating text |
Visual Advanced selection |
Working with NERDTree |
Commands |
Generally helpful stuff
Open a file for editing :e path/to/file.txtReturn to Normal mode ESC or <CTRL>+C
Navigating around text
You have to be in Normal mode. Use ESC to get out of Visual, Replace, or Insert mode.
(left) h(down) j(up) k(right) lnext word eJump to the first line ggJump to the last line G
Entering Text
Insert text before cursor iInsert text after cursor a
Working with multiple files
Open a file in a horizontal split :sp path/to/file.txtOpen a file in a vertical split :vsp path/to/file.txtMove to a split window page <CTRL>+w and a direction key (h, j, k, or l)Move to next window pane <CTRL>w wMake selected pane bigger CTRL>w + (yes, you need the shift key for the plus)Make selected pane smaller <CTRL>w -
Searching
Search for a word /<word>Go to next match nFind and replace on line :s/<find>/<replace>Find and replace globally :%s/<find>/<replace>//gcGo to first quote, replace text in quotes: ci"
Manipulating text
cut the current line ddcopy the current line yypaste below current line ppaste above current line PRemove the character under cursor xRemove the character before cursor XDelete the word under cursor deDelete to the end of the line d$Remove five lines starting here 5ddCopy five lines starting here 5yy indent this line >>indent five lines starting here 5>>Replace mode (overtype) r
Visual Advanced selection
Visual mode vVisual Line mode VVisual Block mode <CTRL>v
Working with NERDTree
Open the NERDTree :NERDTreeToggle the NERDTree on and off :NERDTreeToggleOpen selected file <ENTER>Open selected file in horiz. split iOpen selected file in vert. split vFile menu mHelp ?
Commands:
Run a command :!<command>Open a shell :sh
Original Link: https://dev.to/rubiin/vim-quickies-cheatsheet-30gm
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To