my personal vimrc config for vim
aiming to be used under multi platforms, low dependency, yet powerful for general usage
tested:
- vim version 7.3 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
-
<leader>
is single quote'
each leader keymap has these prefix to prevent conflict with other config
<leader>v
: main prefix, perform actions that are not descructive<leader>c
: descructive actions, such as modify text or file directly<leader>z
: secondary prefix, additions to<leader>v
-
many keymap with letters
A~Z a~z
, less keymap withctrl
, non withalt
ormeta
-
q
<space>
jk
mapped as<esc>
-
Q
to record macro andM
to replay macro, to simplify macro usage, only one macro is supported
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
after installed, you may use <leader>vimru
to update with this repo
(note: local changes to zf_vimrc.vim
would be discarded)
-
download or clone the
zf_vimrc.vim
file to anywhere -
have these in your
.vimrc
(under linux) or_vimrc
(under Windows):source path/zf_vimrc.vim
-
use Vundle to manage plugins
git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
-
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
for a list of plugins and configs, please refer to the zf_vimrc.vim itself, which is self described
-
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
-P
option ofgrep
-
for Markdown preview and conversion
-
for clang_complete, you should:
-
have python support
-
have
g:clang_library_path
been set properlythe default config may suit most case, modify it if necessary
-
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
-
VimTouch Full Runtime
is 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
-
othree/xml.vim
won't work on VimTouch, disable it manually by:let g:plugin_xml_vim=0
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
source
command, so you may need to paste directly to proper vimrc files (e.g..ideavim
,.xvimrc
) - some vim simulation plugins doesn't support
if-statement
and plugins, so you may need to manually delete all lines under theif g:zf_no_plugin!=1
section