-
brew update && brew install vim -
brew install getantibody/tap/antibody -
antibody bundle caarlos0/open-pr kind:path -
git config --global alias.pr open-pr -
Install plugin manager Vim Plug
-
Save vimrc.example to
$HOME/.vimrc -
Open vim:
vim -
Install plugins:
:PlugInstall -
Open your .vimrc:
:e ~/.vimrc
- cpu usage
brew install tmux-mem-cpu-load
-
Use to get into normal mode
-
File navigation
-
Recommended plugin: https://github.com/takac/vim-hardtime
-
Use
ito enter insert mode -
File editing
-
Use
vto enter visual mode -
Object selection
-
Use
:to enter command mode -
Ex commands
-
VERBS:
- d: delete (char, D: line)
- c: change (char, C: line)
- y: yank ( = copy )
- v: visually select (char, V: line)
-
MODIFIERS
- i: inside
- a: around
- NUM: number
- t: search and stop before
- f: search and land on it
- /: find a string (regex)
-
NOUNS
- w: word
- s or ): sentence
- p or }: paragraph
- t: tag (think HTML/XML)
- b: block (think programming)
-
A full sentence consists of VERB MODIFIER NOUN
- Save file:
:w - Save file and quit:
:wqorZZ - Quit without saving:
:q! - Move vim to background:
C-z - Move vim to foreground:
fg - Execute shell commands:
!mkdir -p hello/world
/bar- You can use regular expressions:
/[bz]ar - Replace text in file with:
:%s/bar/foo/g - Or replace in next three lines:
3V:s/bar/foo/g