VIM¶
Include:
- vundle.vim/pathogen.vim
- basic.vim
- header.vim
- script.vim
Install¶
Install vim:
sudo apt-get install vim
sudo yum install vim
Use vundle to manage plugins(recommend):
echo "source ~/dotfiles/etc/vim/vundle.vim" > ~/.vimrc
rm -rf ~/.vim
mkdir -p ~/.vim/plugins
git clone https://github.com/VundleVim/Vundle.vim ~/.vim/plugins/
vim +PluginInstall +qall # run this on shell command line
:PluginInstall # or run this in vim command line
source ~/.vimrc
Use pathogen to manage plugins:
echo "source ~/dotfiles/etc/vim/pathogen.vim" > ~/.vimrc
rm -rf ~/.vim/bundle
mkdir -p ~/.vim/bundle
git clone <plugin-url> ~/.vim/bundle/<plugin-name>
source ~/.vimrc
How to use¶
Vim font and color theme, need to set the terminator work with the same theme.
Vim inner hotkey:
za - opne/create current fold
zi - open/create all fold
Hotkey in vim:
<leader> - \ default is \ in vim.
Ctrl+z - Save file
Shift+z - Open stardict
F1 - VIM help, default
F2 - Open/Close Winmanager
F3 - Open/Close NERDTree
F4 - Open/Close Tagbar
F5 - Open/Close Minibufexplorer
F6 - Open/Close gundo
F10 - Use calendar
F11 - Full screen the terminal, default
F12 - Open Browser for markdown file
CtrlP:
<leader>p - find file in current and sub folder.
<leader>f - find file in MRU.
<leader>c - clear MRU cache.
YCM:
<leader>ya - force compile And diagnostics
<leader>yb - goto definition
<leader>yc - goto declaration
<leader>yd - goto definition else declaration
<leader>ye - detailed djagnostics
Ultisnips+vim-snippets:
<leader><tab> - expand trigger
<leader><c-tab> - jump forward trigger
<leader><s-tab> - jump backward trigger
For C/C++:
F7 - For C/C++ run make clean.
F8 - For C/C++ close quickfix windows.
F9 - For C/C++ run make.
For Java:
F7 - To add all missing imports.
F8 - To remove all missing imports.
F9 - For java run javac and java.
For Python:
F7 - run autopep8 by pymode.
F8 - run 'pyflakes', 'pep8', 'mccabe', 'pep257' by pymode.
F9 - run script by pymode.
<leader>b - create breakpoint by pymode.
<leader>k - show pydoc by jedi
<leader>d - goto definition by jedi
<leader>g - goto assignment by jedi
<leader>r - rename by jedi
<leader>n - show usage of a name by jedi
For html/css:
<C-y>, - insert html:5 to trigger emmet for html/css
<C-e> - tag or tag#name to trigger sparkup for html