Vim¶
Interesting Articles/Tutorials¶
String manipulations¶
s Remove selected string and switch to insert mode
To uppercase/lowercase¶
Select what you like to transform and then:
- Uppercase: U
- Lowercase: u
Indentation¶
Indent multiple lines¶
Select the lines with visual mode and press:
- > for increasing the indentation
- < for decreasing the indentation
Decrease indentation¶
Ctrl + D
Delete all lines of file¶
gg + dG
The gg moves the cursor to the beginning of the file.
The d is for the cut action and G is for moving the cursor to the end of the file. This way, dG cuts all the text from the current cursor position to the end of the file. This is why you need to be at the beginning of the file if you want to delete all the lines in Vim.
Replace¶
Replace all occurrences¶
:%s/<search_term>/<replace_term>/g
Copy, Paste, Cut¶
Between multiple vim instances¶
Copy: " + + + yy
Paste: " + + + p
Move lines¶
Up¶
ddkP
Explanation:
- dd will delete the line and add it to the default register
- k will move up a line
- P will paste above the current line
Down¶
ddp
Explanation:
- dd will delete the line and add it to the default register
- p will paste below the current line
Plugins¶
nvim-tree¶
- Ctrl + v will open the file in a vertical split
- Ctrl + x will open the file in a horizontal split
- Ctrl + t will open the file in a new tab
- Tab will open the file as a preview (keeps the cursor in the tree)