This repository contains my personal daily drive Vim configuration for C/C++ development.
- Download the vimrc file
wget https://raw.githubusercontent.com/Berry484/VimConfig/refs/heads/main/vimrc
- Move it to correct location
mv vimrc ~/.vimrc
- Install
vim-plug
if not already installed:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Open Vim and install plugins
:PlugInstall
- Color Schemes & Syntax Highlighting
- Uses
onedark
color scheme - Custom highlights for comments, strings, and standard C library functions
- Uses
- Cursor
- Distinct cursor shapes for normal and insert modes
- Visual cues using
vim-cursorword
for better focus
- Editing Enhancements
- Smart indentation for C/C++ (
smartindent
,autoindent
) auto-pairs
for automatic closing of brackets and quotes
- Smart indentation for C/C++ (
- File Navigation
- NERDTree file explorer with toggle mappings
- Easy toggling of NERDTree focus without moving editing cursor
- Tags Support
- Preconfigured tags for C/C++ projects to enable navigation and completion
Mode | Key | Action |
---|---|---|
Normal | Ctrl-n |
Toggle NERDTree |
Normal | F9 |
In diff mode: open a new buffer and read svn diff |
Normal | Alt-Down |
In diff mode: jump to next diff hunk (]c ) |
Normal | Alt-Up |
In diff mode: jump to previous diff hunk ([c ) |
Normal | Alt-Left |
In diff mode: do (get changes from other window) |
Normal | Alt-Right |
In diff mode: dp (put changes to other window) |
Normal | Alt-Down |
In spell mode: jump to next spelling error (]s ) |
Normal | Alt-Up |
In spell mode: jump to previous spelling error ([s ) |
tpope/vim-commentary
— Easy commentingjiangmiao/auto-pairs
— Auto-closing brackets and quotespreservim/nerdtree
— File explorerjoshdick/onedark.vim
— Color schemeitchyny/vim-cursorword
— Highlight the word under cursorvim-cpp-enhanced-highlight
— Better C++ highlighting
Helpful notes (Ubuntu/Debian)
On Ubuntu/Debian, the default Vim package is often a minimal build (vim-tiny
) that lacks support for plugins like vim-plug.
To fix this, first uninstall the minimal version, then install a full build such as vim-nox
or vim-gtk3
:
sudo apt remove --purge vim vim-tiny
sudo apt autoremove
sudo apt update && sudo apt install vim-nox
Helpful notes (macOS)
The default Vim that comes preinstalled on macOS is outdated and missing many features required for plugin managers like vim-plug.
It’s recommended to install a modern build via Homebrew:
brew install vim