My vim config for developers
This is a config for Vim, integrated with Go,Python,Elixir,Javascript,HTML&CSS and Markdown languages by default.
Tested on OS X and Linux (specifically, Ubuntu and ArchLinux) with Vim version >= 7.3.
Feature
- YouCompleteMe & syntastic for code-completion and syntax checking: fast and easy to use.
- vim-plug for plugin management: Super-fast parallel installation/update.
- fzf as a fuzzy finder, I haved tried ctrlp and leaderF, neither of them
is fast enough or bug free to use. And even more,
fzfcould be integrated with your terminal (bash and zsh)! - vim-airline. No need to install new fonts (compared to powerline).
- vim-easymotion and vim-easy-align. You will love them ;)
- [tpope/vim-fugitive][git-plug] for git integration. You can invoke common git commands by
:Gblame,:Glog,:Gdiff, etc. <Leader>key is mapped to,because it is used so frequently.
Install
-
This configuration has some external dependencies. Concretely, Compiling YCM needs
cmaketo be installed;:grepneeds either ripgrep or the_silver_searcher for a fast grep, tagbar depends onctagsfor code parsing.
Other binary dependencies such asvim-goandfzfwould be downloaded and installed automatically for you.
To install them on OSX:brew install cmake, ctags, ripgrep
On Arch Linux :
pacman -S cmake ctags ripgrep
Or on Ubuntu Linux >= 13.10(Saucy):
apt-get install cmake exuberant-ctags silversearcher-ag
-
Clone this repository:
git clone https://github.com/cherrot/vimrc.git ~/.vim ln -sf ~/.vim/.vimrc ~/
-
Run vim in your terminal. It will check and download all the plugins it needs. Wait for a moment and ignore the color scheme error for now (It should be fixed on your next start).
-
Compile YCM, with
clangandGocompleter (if you need):cd ~/.vim/bundle/YouCompleteMe/ && ./install.py --clang-completer --gocode-completer
This process will take a while depending on your network bandwidth and CPU. Take some patience :)
- Restart your vim and welcome to the new world!
Notes
- (ArchLinux) If you get an error about
libtinfo, you may need to installncurses5-compat-libsvia the AUR. - If you want a python PEP8 lint, you need
flake8installed viapipsystemwide or under your virtualenv only.
Typical workflow
Read the Mappings section of my .vimrc.
For further usage, check the documents of the specific plugins.
FAQ
Why the color scheme looks so terrible on my terminal?
Make sure your ternimal is 256-color. Run echo $TERM in your terminal,
it should either be xterm-256color or screen-256color. If not, you need set it to your
terminal profile or export the environment variable.
Why switch to YouCompleteMe?
I have been using neocomplete for a long time. I like it becauce it is simple to setup,
and it dose not have external dependencies. But neocomplete is too slow in Go's auto-completion.
Then I find YCM is easy enough to setup and use now, so it's time to say goodbye to neocomplete.
cscope.vim?
Aha, it is deprecated. Maybe I'll remove it from this repo in some day.