My dot files for vim and git
I prefer tools which can be used with terminal, so install vim from source is the perfect way for me, and it's also the reason why I don't use MacVim.
-
Get a copy of source code from https://vim.googlecode.com/hg/, before that please make sure you have "hg" installed
$> hg clone https://vim.googlecode.com/hg/ -
Installation with huge set of features
$> ./configure --prefix={dir\_to\_install} --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-python3interp --enable-perlinterp --enable-cscope $> make $> make install
There is a shell script which you can use to finish the installation of vim plugins
in this repository and you can find it here vim/install.sh
Notice: in this repository I use , as leader key, so don't be suprised when you see
a lot of , in the hot key of the following usage example
-
Text Search
Tools: Ag https://github.com/rking/ag.vim
Usage:
, + asearch text under the current workspace
, + ssearch the current word where the cursor is for python files -
File Search
Tools:
ctrp https://github.com/kien/ctrlp.vim
personaly I like ctrp more than command-t, ctrp is better than command-t in performance and search result Usage:
Ctrl + pfuzz search for files by name
Ctrl + cquit ctrlp -
File Navigation
Tools:
NerdTree https://github.com/scrooloose/nerdtree
Minbuff https://github.com/fholgado/minibufexpl.vim
Usage:
, + topen NerdTree sidebar
, + fopen NerdTree sidebar and find the current file's location
b + numberswitch from different file from mimbuff -
Code Exploring
Tools:
ropevim https://github.com/python-rope/ropevim
tlib https://github.com/tomtom/tlib_vim
tagbar https://github.com/majutsushi/tagbar
Usage:
, + gfollowing python code's definition
Ctrl + oback to the last cursor position during code exploring
Ctrl + tmove forward to the last cursor position during code exploring
f3Open/Close right sidebar for code structure -
Code Completion
Tools: ropevim
Usage:
Code completion have to be under insert mode and by using rope you could apply completion
in python code
Ctrl + x Ctrl + oactive auto completion for python code
Ctrl + nactive auto completion for any code (not very intelligence) -
Status Line
Tools:
ariline https://github.com/bling/vim-airline
fancy status line tools which can show file type, cursor coordinates, encode type and etc -
Code Snippets
Tools:
vim-snippets https://github.com/honza/vim-snippets
Usage:
when you type some keyword following with tab you can automatically bring out the code snippets
for example if you type ifmain and then following with a tab in a python file it will bring out the following codeif __name__ == '__main__': main()type pdb with a following tab
import pdb; pdb.set_trace()there are a lot other hot keys which are quite useful accross different lanuages and most
importantly you could be very productive -
YAML
Tools:
vim-yaml https://github.com/stephpy/vim-yaml
vim's built-in YAML support is almost useless, it's super slow so this plugin can make a difference
Install formatters could let you unlock auto formatting your code with hot key + r
npm install -g prettier
# sort python imports
pip install isort
# python code formatter
pip install black
f7Copy current file path to system registerf2Open/Close preview windowCtrl + hmove cusor to the left windowCtrl + lmove cusor to the right windowCtrl + imove cusor to the window upsideCtrl + kmove cusor to the window downside:vspsplit window verticallyCtrl + zbring vim process to backgroundfgbring back background process this is a terminal command will be useful withCtrl + z!command_line %execute command line
for example use:!git blame %to blame the current file with git- shared register with system register
this means the text you copy from vim can been pasted to other program and the oppsite is also true :qaquit vim
-
Configure press and hold
defaults write com.jetbrains.intellij ApplePressAndHoldEnabled -bool false
defaults write com.jetbrains.intellij.ce ApplePressAndHoldEnabled -bool false