my personal vimrc config for vim
main purpose:
- cross platform, and keep similar user experience for these platforms
- low dependency, no anoying lag or errors for old versions and envs
- powerful for general usage
tested:
- vim version 7.3 or above
- neovim version 0.1 or above
- Windows's gVim
- cygwin's vim
- Mac OS's vim and macvim (console or GUI)
- Ubuntu's vim
- Android's VimTouch (with full runtime)
may work: (search and see g:zf_fakevim)
- Qt Creator's FakeVim (able to use, no plugin support, some keymap doesn't work)
- IntelliJ IDEA's IdeaVim (able to use, no plugin support, some keymap doesn't work)
- XCode's XVim (not recommended, some action have unexpected behavior)
for me, I use this config mainly for C/C++ markdown PHP development,
as well as for default text editor and log viewer
if you have curl, git, vim installed, here's a very simple command to install everything:
curl zsaber.com/vim | sh
# or, run the install script directly
sh zf_vim_install.sh
# optionally, change install settings (listed below) before running the shell script
export ZF_xxx=1
curl zsaber.com/vim | sh
once installed, you may press z? to view a quick tutorial for this config
for lazy ones, here's a packaged portable version of gVim for Windows: Download
it's not ensured keep update with this repo, but you may use <leader>vimru to update
-
ZF_256: use 256 color colorschemedefault: try to auto check
may looks incorrect if used in non-256 color terminal
-
ZF_YCM: useYouCompleteMeinstead ofclang_completedefault: 0
see
YouCompleteMe vs clang_completebelow for detailed info -
ZF_force: remove all contents and perform clean installdefault: 0
these items would be removed before install
~/.vimrc ~/_vimrc ~/.vim ~/.config/nvim/init.vim -
ZF_neovim: also install to neovim, which would addsource ~/zf_vimrc.vimto~/.config/nvim/init.vimdefault: 1 if nvim exist
-
download or clone the
zf_vimrc.vimfile to anywhere -
have these in your
.vimrc(under linux) or_vimrc(under Windows):source path/zf_vimrc.vim -
use vim-plug to manage plugins
install vim-plug:
git clone https://github.com/junegunn/vim-plug $HOME/.vim/bundle/vim-plugafter installed, update plugin manually:
:PlugUpdate
for a list of plugins and configs, please refer to the zf_vimrc.vim itself, which is self described
to uninstall, remove these lines in your .vimrc and .config/nvim/init.vim
source path/zf_vimrc.vim
and remove these dirs/files
$HOME/.vim
$HOME/.vim_cache
$HOME/zf_vimrc.vim
-
not necessary, but strongly recommended for Windows users
-
GNU grep (greater than 2.5.3)
for vim-easygrep if you want to use Perl style regexp
note the FreeBSD version won't work due to the lack of
-Poption ofgrep -
for Markdown preview and conversion
-
for clang_complete, you should:
-
have python support
-
have
g:clang_library_pathbeen set properlythe default config may suit most case, modify it if necessary
recommended to install LLVM at default location, if so, this config would be able to config it automatically
-
-
it's recommended to modify platform-dependent settings in
.vimrc, such as:au GUIEnter * simalt ~x set guifont=Consolas:h12 set termencoding=cp936 let g:zf_colorscheme_256=1 source path/zf_vimrc.vim
-
all builtin plugins can be disabled by adding this before
source zf_vimrc.vimlet g:ZF_Plugin_agit=0 -
to add your own plugin, add this before
source zf_vimrc.vimfunction! MyPlugSetting() Plug 'username/your_plugin1_name' let your_plugin1_config=xxx Plug 'username/your_plugin2_name' let your_plugin2_config=yyy endfunction autocmd User ZFVimrcPlug call MyPlugSetting()
when used under different version of cygwin, you should concern these settings if weird problem occurred:
set shell=cmd.exe
set shellcmdflag=/c
or
set shell=bash
set shellcmdflag=-c
set it directly to .vimrc, choose the right one for you
by default, we use clang_complete for C-family semantic completion, because it has less dependency and easier to install (the default config should work for most case)
if you want the more powerful YouCompleteMe:
- go YouCompleteMe Installation to check whether your system matches the requirement
- add
let g:plugin_YouCompleteMe=1to your.vimrcbeforesource zf_vimrc.vim - manually update plugin by
:PlugUpdate
supply .clang_complete to your project's root, and specify header search path, example:
-I/usr/lib/include
-I./my_src1/include
-I./my_src2/include
after this, the completion should work, for both plugin
- require much time to install the plugin for first time
- quite hard to config under Windows, not recommended
- semantic complete keymap should be
<tab>, and should trigger automatically when you start typing - use
<tab>to move between params after function completion
- lightweight, easy and quick to install
- support most platform (including Windows)
- semantic complete should be triggered manually by pressing
<tab> - use
<tab>to move between params after function completion
-
VimTouch Full Runtimeis also required -
the vim config is placed under
/data/data/net.momodalo.app.vimtouch/files/.vimrc -
you should manually copy all settings from other platform to VimTouch's folder, the result folder tree should looks like:
/data/data/net.momodalo.app.vimtouch/files/ .vim/ bundle/ ... .vimrc zf_vimrc.vim
Note: vimrc may or may not work under Android 5 or above, reason unknown, this is VimTouch's problem, not this repo's problem
let g:zf_fakevim=1
- not fully tested
- some vim simulation plugins doesn't support
sourcecommand, so you may need to paste directly to proper vimrc files (e.g..ideavim,.xvimrc) - some vim simulation plugins doesn't support
if-statementand plugins, so you may need to manually delete all lines under theif g:zf_no_plugin!=1section