This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A lightweight Vim configuration framework with full Chinese comments. This is designed as both a practical configuration and a learning resource for Vim users. The configuration emphasizes simplicity, modularity, and C/C++ development support.
mkdir -p ~/.vim
cd ~/.vim
git clone https://github.com/expoli/vim-init.git .
echo "source ~/.vim/vim-init/init.vim" > ~/.vimrcAfter installation, run :PlugInstall in Vim to install plugins.
The configuration is modular, loaded in this order:
init.vim- Entry point, sets runtimepath and loads modulesinit/init-basic.vim- Basic settings (compatible with vim-tiny mode)init/init-config.vim- Extended settings (requires +eval)init/init-tabsize.vim- Tab/indentation settings and conversionsinit/init-plugins.vim- Plugin management via vim-pluginit/init-style.vim- UI/colorscheme settingsinit/init-keymaps.vim- Key mappings
- Leader key: Space (
) - LocalLeader:
, - Encoding: UTF-8 with fallback chain (ucs-bom, utf-8, gbk, cp936, gb18030, big5, euc-jp, euc-kr, latin1)
- Color scheme: molokai (dark background, 256 colors)
Defined in g:bundle_group, default groups:
basic- Core plugins (startify, colorschemes, signify, fugitive, etc.)tags- Automatic ctags/gtags generation (gutentags, gutentags_plus)enhanced- Enhanced editing (expand-region, fzf, delimitMate)filetypes- File type support (cpp-enhanced-highlight, python-syntax, rust.vim)textobj- Text objects (indent, syntax, function, parameter, uri)airline- Status linenerdtree- File explorerechodoc- Function parameter displayleaderf- Fuzzy finder (requires Python)
Plugins are lazy-loaded on InsertLeave for faster startup. See s:LoadLazyPlugins() in init-plugins.vim.
The plugin/ directory contains standalone plugins that work offline:
asyncrun.vim- Async command executionasynctasks.vim- Task managementcommentary.vim- Comment togglingunimpaired.vim- Bracket mappingsindent-object.vim- Indent text objectsargtextobj.vim- Argument text objects
<Space>1-0/<M-1-0>- Switch to tab 1-10<Space>bn/bp- Next/previous buffer<Space>tc/tq/tn/tp/to- Tab create/close/next/prev/only<C-p>- LeaderF file fuzzy match<C-n>- LeaderF MRU files<M-p>- LeaderF function list<M-n>- LeaderF buffer list<F3>- Toggle NERDTree
<Space>gs- Cycle through split windows<Space>h/j/k/l- Move to window left/down/up/right<Space>s- Horizontal split<Space>v- Vertical split
<Space>te- Toggle expandtab (spaces vs tabs)<Space>ts- Set tab size (2/4/8)<Space>tr- Convert all tabs to 4 spaces<Space>tt- Convert leading 4 spaces to tabs<Space>ti- Show current indent config
<F4>- Compile current C/C++ file<F5>- Run current file<F6>- CMake project<F7>- Make project<F8>- Make run<F10>- Toggle quickfix window<F2>- Grep word under cursor (using rg or grep)
<Space>ca/cc/cd/ce/cf/cg/ci/cs/ct- Various cscope find commands<Space>cR- Regenerate cscope database
After editing any .vim config file:
:so %This reloads the current script.
- Add
Plug 'author/plugin-name'ininit-plugins.vim - Add configuration below the Plug statement
- Run
:PlugInstall
Edit init/init-keymaps.vim. Most mappings are organized by category with Chinese comments.
The configuration looks for these markers to identify project root:
.root(empty file you can create).project.svn.git
This is used by gutentags, LeaderF, and asyncrun for project-aware operations.
Tags are stored centrally at ~/.cache/tags/ to avoid polluting project directories.
Defined in autocommand groups:
- C/C++: tab size 4, no expandtab,
//comments - Python: tab size 4, expandtab
- YAML/JSON/Markdown/XML/HTML: tab size 2, expandtab
- Make: tab size 8, no expandtab (required by Make)
- Go: tab size 4, no expandtab