Common VIM commands
An overview of common vim commands, including:
- windows
- buffers
- undo/redo
- navigation
- bookmarks
- selection/whitespace
- clipboard shortcuts
- search/replace
- programming
- external filters
Also see this German command list Show archive.org snapshot .
Useful
- toggle syntax highlighting:
:syntax on|off
Related cards:
How to: Store multiple Vim commands in macros and recall them
Vim allows recording a batch of commands as a macro. This is handy if you need to do the same things over and over.
Here is how:
- Press
q
to enter macro mode. - Press a letter (not a number!) key to assign a slot to your macro.
- You are n...
How to cycle through grep results with vim
grep
is the go-to CLI tool to accomplish tasks like filtering large files for arbitrary keywords. When additional context is needed for search results, you might find yourself adding flags like -B5 -A10
to your query. Now, every search result ...
Some useful vim settings
Below is a list of some VIM settings I find useful. You can add them to your .vimrc
.
source $VIMRUNTIME/mswin.vim " adds Ctrl-X, Ctrl-C, Ctrl-V; block visual mode is now Ctrl-Q
behave mswin
set autowriteall ...
Enable soft tabs in Vim
If you want to enforce soft tabs (spaces instead of tabstops) in Vim put this into your ~/.vimrc
(Linux) or C:\Users\<Username>\_vimrc
(Windows):
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
You can also cal...
How to start Terminator with split screens and custom commands running
Starting Terminator with split screens is quite simple: Just store a layout and start Terminator with the --layout <your layout>
option.
However, if you want to run custom commands in your terminals, you need to do some work to keep these termi...
Opening Rubymine projects from the command line
To activate the shell command, go to Tools > Create Command-line Launcher
and confirm.
Now you have mine
as bash command. Run this to open a project in RubyMine:
mine path/to/my_project
Booting Rubymine
The mine
script will a...
Vim: How to write a file you opened without sudo
Have you ever opened a file with vim, edited it and when you wanted to save your changes it told you "Can't open file for writing", because you opened it without sudo
? There's an easy hack to let you write it anyway:
:w !sudo tee %
The...
Working on the Linux command line: Use the `tree` command instead of repeated `cd` and `ls`
The tree
command will show you the contents of a directory and all its sub directories as a tree:
>tree
.
├── a
│ ├── file_1.txt
│ └── file_2.txt
└── b
├── c
│ └── even_more.txt
└── more.txt
3 directories, 4 files
If...
Working on the Linux command line: How to bash `cd` with autocorrect
There is an option you can set so that when using the cd
command, small typos are automatically corrected. Add the following to your ~/.bashrc
:
# cd: autocorrect small typos and use best guess
shopt -s cdspell
Example:
cd P...