A modular vim configuration split into two main files for better organization and flexibility.
config.vim- Core vim settings, mappings, and basic functionalityplugins.vim- Plugin management, installation, and plugin-specific configurationsAUDIT.md- Known issues found by code auditCLAUDE.md- Guidance for AI assistants working on this config
- Vim 8.2+ (
config.vimusessmoothscroll, which needs Vim 9.0.0640+; on older versions that one line reportsE518and the rest of the config still loads) curlandgit- required to bootstrap vim-plug and fetch plugins
Optional, per plugin:
| Needed for | Requirement |
|---|---|
Tagbar (<F8>) |
ctags (universal-ctags recommended) |
| vim-airline symbols | A powerline-patched or Nerd Font |
| ALE JavaScript fixers | node + eslint |
<F5> / <F6> runners |
python3, node, bash, ruby, or perl |
Clone the repository. The paths below assume ~/config_vim — adjust them if you
clone elsewhere:
git clone https://github.com/Code-Samples-Galore/Config-Vim.git ~/config_vimIf you only want the core vim settings without plugins, add this to your ~/.vimrc:
" Source basic vim configuration
source ~/config_vim/config.vimFor the complete setup including automatic plugin management, add this to your ~/.vimrc:
" Source plugin management and configurations
source ~/config_vim/plugins.vim
" Source basic vim configuration
source ~/config_vim/config.vimNote: Source plugins.vim first to ensure plugins are loaded before the main configuration.
On first launch, vim-plug is downloaded automatically and the plugins are installed. Expect a few errors on that very first start (the gruvbox colorscheme does not exist yet) — restart Vim once installation finishes.
- Optimized display settings with line numbers and syntax highlighting
- Smart indentation and formatting rules
- Enhanced search functionality
- Custom key mappings and leader shortcuts
- Automatic file handling and backup management
- Custom status line showing mode, git branch and file size
- Auto-closing brackets and quotes
- File-type specific settings
The custom status line is only visible in the no-plugin setup. With Option 2, vim-airline replaces it with its own.
- Automatic vim-plug installation
- Auto-installation of missing plugins
- Periodic plugin updates (every 7 days)
- Configured plugins:
- gruvbox - Color scheme
- NERDTree - File explorer
- vim-airline - Enhanced status line
- vim-polyglot - Language pack
- vim-commentary - Easy commenting
- vim-surround - Surround text objects
- ALE - Asynchronous linting
- Tagbar - Code structure overview
- IndentLine - Visual indentation guides
The leader key is , (comma).
| Mapping | Action |
|---|---|
jj |
Exit insert mode |
<space> |
Enter command mode (types :) |
o / O |
Open a blank line below/above and stay in normal mode |
Y |
Yank from cursor to end of line |
j / k |
Move by display line (gj/gk) |
<CR> |
Clear search highlighting |
n / N |
Next/previous search match, centered |
<leader>, |
Jump back to the last cursor position |
| Mapping | Action |
|---|---|
<leader>w |
Save |
<leader>q |
Quit |
<leader>x |
Save and quit |
<leader>e |
Open the built-in file explorer (:Explore) |
<leader>bn / <leader>bp |
Next / previous buffer |
<leader>bd |
Delete buffer |
<leader>P |
Print the current file to the default printer (Linux lp) |
| Mapping | Action |
|---|---|
<C-h> <C-j> <C-k> <C-l> |
Move between splits |
<C-Up> <C-Down> <C-Left> <C-Right> |
Resize the current split |
<leader>v / <leader>s |
Vertical / horizontal split |
<leader>f / <leader>F |
Toggle fold / toggle fold recursively |
| Mapping | Action |
|---|---|
<leader>n |
Toggle line numbers |
<leader>r |
Toggle relative line numbers |
<leader>pp |
Toggle paste mode |
<leader>c |
Toggle copy mode (hide line numbers, listchars and signs) |
<leader>bg |
Toggle dark/light background |
| Mapping | Action |
|---|---|
<F5> |
Save and run the current file with python3 |
<F6> |
Run the current file based on its filetype (python, javascript, sh, ruby, perl) |
| Mapping | Action |
|---|---|
<C-t> |
Toggle NERDTree |
<F8> |
Toggle Tagbar |
Typing ', `, ", (, [ or { inserts the matching pair. Suffixes change
the result:
| Typed | Result |
|---|---|
( |
() with the cursor inside |
(; |
(); with the cursor inside |
(, |
(), with the cursor inside |
(<Tab> |
() with the cursor after the pair |
(<CR> |
Multi-line block with the cursor on a blank middle line |
Because these mappings share prefixes, Vim waits
timeoutlen(500 ms) after each opening character. Use<leader>ppbefore pasting into a terminal Vim, otherwise pasted brackets and quotes are duplicated.
Whitespace dots (·), end-of-line marks (¬) and line numbers are drawn on
screen only — they are never part of the buffer, so Vim's own yank never
includes them. If they show up when you paste, the selection was made by the
terminal rather than by Vim.
- Select with the mouse and press
y.mouse=ais enabled, so dragging creates a Vim visual selection andycopies the real text to the system clipboard. This is the clean path. - Shift-drag bypasses Vim and uses the terminal's own selection, which copies
whatever is painted on screen. Press
<leader>cfirst to hide the line numbers,listcharsand sign column, and the terminal selection comes out clean too. Press it again to restore.
Yanking a whole line with V or yy is linewise and carries a trailing newline
with it. To copy just the text, use ^vg_y (first to last non-blank character)
or y$ from the start of the line.
Clipboard integration needs a Vim built with +clipboard — check with
vim --version | grep clipboard. If it shows -clipboard, install a full build
(vim-gtk3 on Debian/Ubuntu) or use <leader>c plus terminal copy.
| Command | Action |
|---|---|
:UpdatePluginsNow |
Force a plugin update, ignoring the 7-day interval |
- Automatic plugin installation on first run
- Periodic plugin updates (every 7 days, see
g:plug_update_interval) - Auto-creation of necessary directories (
~/.vim/backup,~/.vim/swap,~/.vim/undo) - Trailing whitespace removal on save — skipped for
markdown,diff,gitcommit,gitsendemailandmail, where trailing whitespace is meaningful - ALE applies its configured fixers on save (
eslint --fixfor JavaScript) - Cursor position restoration when reopening files
- NERDTree opens automatically when Vim starts without a file argument
Edit the configuration files directly or override settings in your ~/.vimrc after sourcing these files.
Useful knobs:
g:plug_update_interval(plugins.vim) - seconds between automatic plugin updatesg:plug_auto_update- set to0in your~/.vimrcto skip the update check on startup and update only via:UpdatePluginsNowg:ale_fix_on_save- set to0to stop ALE rewriting files on savemapleader(config.vim) - the leader key, currently,
MIT License