Editors
Cheatsheet to vim
replace all empty lines
:g/^$/d regards to here
:<range>s/<pattern>/<replace>
<range>Range can be a linenumber12a range of linenumber12,14a range of marks'a,'bor the whole document%<pattern>The pattern to search for<replace>what to replace the pattern with Example comment lines 15 to 25:15,25s/^/#
insert file at current position
:r <path/to/file> insert lines 9 19 from file myfile :r! sed -n 9,19p /path/to/myfile
Ranges
Usefule Link Ranges
$ goes to end of Line.
switch case
upper case press gU<motion> to change the letter under the cursor to lower case press gu<motion> to change the letter under the cursor to
ranges
usefule link ranges
$ goes to end of line.
0 goes to the beginning of line (^ seems to do the same)
Insert on multiple Lines
Enter visual mode -v, move to mark the needed lines (h,j,k,l) Hit -I for insert mode, type text and hit
Increment numbers
Enter visual mode -v mark the numbers to be icremented (there need to be integers, it does not fill whitespace. Use multiline insert first if needed.) then type g and -a type :h v_g to see help entry
regex
Plugins
Vundle
I use vundle for managing plugins, here
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vimnerdtree allows you to have a folder pane to navigate files/folders. ? to see help menu r to refresh view, for example after deleting some file I to see hidden files and folders
ycm offers autocomplete
A plugin to change the brackets or other characters around text. Useful for html for example
A plugin for html autocompletion Open or create a New File:
vim index.html Type ("_" is the cursor position):
html:5_ Then type , (Ctrl then y then ,) and you should see:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>Styling
Theme
Put new themes into ~/.vim/colors and then pick them with :colo <theme> elflord theme looks nice Latitude 5520 Laptop in Windows Terminal
Last updated