My vimrc.
First, clone the vim package manager.
$ git clone https://github.com/VundleVim/Vundle.vim ~/.vim/bundle/Vundle.vim
Install packages.
$ vim +PluginInstall +qall
Install ctags (or may be called universal-ctags in some distributions).
$ sudo pacman -Syu ctags
Build ycm core. See here for more info.
$ cd ~/.vim/bundle/YouCompleteMe/
$ python3 install.py --{go,clangd,clang,rust}-completer
Skip these steps and delete the Plugin 'powerline/powerline'
line if you have already had your powerline installed, and don't forget to set the powerline rtp by set rtp+=/PATH/TO/YOUR/POWERLINE/LIBRARY/bindings/vim
.
- Install fonts from https://github.com/powerline/fonts.
$ git clone https://github.com/powerline/fonts /tmp/fonts
$ cd /tmp/fonts
$ ./install.sh
- Copy the config files to the default config path.
$ cp -r PATH_TO_THIS_REPO/powerline -t ~/.config
Skip these steps and delete the Plugin 'fatih/vim-go'
line if you don't need to play with Golang.
- Install Golang tool chain.
$ sudo pacman -Syu go
- Install Golang helpers.
$ vim +GoInstallBinaries +qall
Skip this step and delete the Plugin 'rust-lang/rust.vim'
line if you don't need to play with Rust:
$ sudo pacman -Syu rust
Refer https://github.com/SirVer/ultisnips for how to write your own snippets, or use the examples here.
Recommend install the silver searcher and fd to accelerate :Find
and :Grep
commands.
:Grep PATTERN
to searchPATTERN
in all files under current working directory, auto jump to the first result, and open the location list. The results are stored in the location list, see:h :lfile
.- By default, the command only match a whole word, that is,
PATTERN
should be surrounded by non-word characters or start/end of line. :Grep PATTERN i
for case non-sensitive:Grep PATTERN w
for searching part of a word:Grep PATTERN h
for searching only in files with suffix ".h"- Multiple parameters are available, e.g.,
:Grep PATTERN iwh
(order doesn't matter)
- By default, the command only match a whole word, that is,
:Find PATTERN
to search files whose path matchesPATTERN
.:Find PATTERN d
for searching directory. Since it searches "path", '/' is valid inPATTERN
.- It searches case non-secsitively, and some regular expression are valid. For example,
:Find test_dir/.*\.py
matches the files under test_dir (recursively) and ends with ".py".
- It searches case non-secsitively, and some regular expression are valid. For example,
Y
is mapped toy$
to match the behavior ofD
.F3
in Normal mode to search the word under cursor recursively from current working directory.F3
in Visual mode to search the select string.F4
in Visual mode to mark the first exchange target, and one more time in Visual mode to perform exchange. See here for what is exchange.F4
in Normal mode to unmark.F5
in Normal mode to toggle NERDTreeF6
in Normal mode to toggle tagbar
- In insert mode, the arrow keys
UP
/DOWN
are mapped to selecting the prev/next condidates. This helped me a lot to get used to keeping working in Normal mode instead of staying in Insert mode. - Function key
F7
is mapped to "show documentation".
- Press
tab
key to trigger and forward,shift-tab
to backward. See here for what is Ultisnips.