Skip to content

Repository files navigation

vim

A highly configurable text editor with performance optimizations

⚡ Recently Optimized - 5-10x faster startup, 30-40% less memory usage!

Quick Install

Automatic install/update:

bash -c "$(curl -LSs https://github.com/dfmgr/vim/raw/main/install.sh)"

Manual install:

mv -fv "$HOME/.config/vim""$HOME/.config/vim.bak"
git clone "https://github.com/dfmgr/vim""$HOME/.config/vim"cd"$HOME/.config/vim"&& ./install.sh

Note: The installer uses vim-plug for faster plugin management with lazy loading. Plugins install automatically on first run.


Features

  • Fast startup with lazy-loaded plugins (200-500ms)
  • 🎨 Beautiful Dracula theme with vim-airline statusline
  • 📝 Smart completion with deoplete (Python 3 required)
  • 🔍 Fuzzy file search with FZF
  • 🌳 File explorer with NERDTree
  • 📦 60+ plugins optimized for performance
  • 🔧 Organized configuration with modular autocmds
  • 📚 Full Git integration with fugitive and gitgutter
  • Syntax highlighting for 100+ languages

Requirements

Debian/Ubuntu based:

apt install vim-nox python3-neovim ctags vim-scripts

Fedora/RHEL based:

yum install vim python3-neovim ctags

Arch based:

pacman -S vim python-neovim ctags

MacOS:

brew install vim ctags python
pip3 install neovim pynvim

Plugin Management

Install/Update Plugins

# Install and update all plugins
vim +PlugInstall +PlugUpdate +qall
# Clean unused plugins
vim +PlugClean +qall
# Check plugin status
vim +PlugStatus

Reinstall From Scratch

cd~/.config/vim
rm -rf ~/.local/share/vim/plugged
./install.sh

Performance Optimizations

What Changed?

1. Plugin Manager Migration (Vundle → vim-plug)

  • 5-10x faster startup time
  • Plugins load on-demand based on file type or command
  • Auto-installs vim-plug on first run

Lazy Loading Strategy:

  • NERDTree: Loads only when toggled (:NERDTreeToggle)
  • Language plugins: Load by filetype (Python, PHP, TypeScript, etc.)
  • Utilities: Load on command (Autoformat, Prettier, Magit)

2. Removed Duplicate/Competing Plugins

  • 30-40MB less memory usage
  • Removed: neocomplete, supertab, ddc.vim, vim-multiple-cursors
  • Kept: deoplete (async completion), ultisnips (snippets), vim-airline

3. Optimized Autocmds

  • ~200ms faster startup
  • Organized 76 scattered autocmds into 9 focused groups
  • Eliminated duplicate event handlers
  • Added abort flags to functions

4. Simplified Statusline

  • ~70 lines removed
  • Using vim-airline exclusively
  • Disabled expensive whitespace checking
  • Enabled section skipping for empty sections

Performance Metrics

MetricBeforeAfterImprovement
Startup time2-3s200-500ms5-10x faster
Initial memory80-100MB40-60MB40% less
Lines of code86179368 lines removed
Autocmd groupsScattered9 groupsOrganized
Plugin conflictsYes (3)NoneResolved

Plugin Load Strategy

Always Loaded (Core - Fast)

  • vim-airline, vim-fugitive, vim-gitgutter
  • vim-sneak, rainbow, auto-pairs
  • dracula theme, vim-startify
  • editorconfig, tmux-navigator

Lazy Loaded (On-Demand)

By Command:

  • NERDTree → :NERDTreeToggle or <C-z>
  • Autoformat → :Autoformat
  • Magit → :Magit
  • TaskList → :TaskList

By Filetype:

  • Python: python-mode, jedi-vim, python-syntax
  • JavaScript/TypeScript: yats, prettier, emmet
  • PHP: phpcomplete
  • Markdown: vim-markdown, vimwiki
  • HTML/CSS: emmet, vim-css-color
  • Docker: Dockerfile syntax
  • Shell: bash-support

Keyboard Shortcuts

Quick Help: Press ,? in vim to show an interactive keybind reference!

Leader Key

The leader key is , (comma). All commands shown as <Leader> use comma.

Navigation & Windows

KeybindDescription
<C-h/j/k/l>Navigate between splits (left/down/up/right)
<S-Tab>Cycle through windows
<C-z>Toggle NERDTree file explorer

Search & Find

KeybindDescription
<C-p>FZF fuzzy file finder
<Leader><Enter> or ,<Enter>Show open buffers
<Leader>l or ,lSearch lines in all open buffers
,rFind and replace (enters :%s///g mode)
,rcFind and replace with confirmation
s*Search word under cursor (use cgn to change matches)

Editing & Text Manipulation

KeybindDescription
<F2>Toggle paste mode (auto-paste usually handles this)
,cCopy selection to system clipboard
,vPaste from system clipboard
<C-c>Copy selection (visual mode)
<C-x>Cut selection (visual mode)
<Space>/Toggle comment (visual mode)

Spelling

KeybindDescription
<F7>Toggle spell check on/off
,spFix spelling for nearest word
z=Show spelling suggestions (vim built-in)
]sJump to next misspelled word
[sJump to previous misspelled word

Tasks & Utilities

KeybindDescription
,tlShow task list (TODO, FIXME, HACK, XXX, WIP)
,rsReload all snippets

Markdown Mode

When editing .md or .rmd files:

KeybindDescriptionExample
,wWrap word in markdown link[word](url)
,nInsert horizontal rule---
,bBold text**text**
,sStrikethrough~~text~~
,eItalic text*text*
,iInsert image![alt](url)
,aInsert link[text](url)
,1Insert H1 heading#
,2Insert H2 heading##
,3Insert H3 heading###
,lInsert horizontal line--------
,rInsert R code block ```{r}
,pInsert Python code block ```{python}
,cInsert generic code block```

Motion Plugins

Vim-Sneak - Jump to any location with 2 characters:

KeybindDescription
s{char}{char}Jump forward to 2 characters
S{char}{char}Jump backward to 2 characters
gsRepeat last sneak forward
gSRepeat last sneak backward

Quick-Scope - Highlights f-key jump targets:

KeybindDescription
f{char}Jump forward to character (targets highlighted)
F{char}Jump backward to character
t{char}Jump forward before character
T{char}Jump backward before character

Completion (Insert Mode)

KeybindDescription
<Tab>Trigger UltiSnips snippet or Deoplete completion
<S-Tab>Jump backward in snippet
<Up>/<Down>Navigate completion menu
<CR> (Enter)Accept completion
<Right>Accept and continue
<Left>Cancel completion

Clipboard & Copy/Paste

KeybindDescription
,cCopy to system clipboard (normal/visual)
,vPaste from system clipboard
<C-c>Copy selection (visual mode)
<C-x>Cut selection (visual mode)
<C-v>Paste (visual mode or insert mode)

Help

KeybindDescription
,?Show interactive keybind reference
:h <topic>Vim help on any topic
:h vimrcHelp for vimrc configuration

Paste Mode

Automatic paste detection is enabled! When you paste text from your clipboard:

  • Modern vim (8.0.0238+) and neovim automatically detect paste operations
  • Paste mode enables automatically, then disables when done
  • No more mangled indentation or auto-completion interference
  • Manual toggle available with <F2> if needed

Configuration Files

~/.config/vim/
├── etc/
│ ├── vimrc # Main config (optimized)
│ ├── vimrc.bak # Backup of original
│ ├── plugins.vimrc # Plugin definitions (vim-plug)
│ ├── minimal.vimrc # Lightweight config
│ └── simple.vimrc # Mid-weight config
├── install.sh # Installation script
└── README.md # This file
~/.local/share/vim/
├── plugged/ # vim-plug plugins
├── .undo/ # Undo history
├── .backup/ # Backup files
└── .swp/ # Swap files

Troubleshooting

Plugin not loading

Check if it needs to be triggered:

:PlugStatus" See which plugins are loaded

The plugin might be lazy-loaded. Use it once to load:

:NERDTreeToggle" Loads NERDTree and related plugins

Slow startup still happening

Profile your startup:

vim --startuptime /tmp/vim-startup.log +qall
cat /tmp/vim-startup.log | tail -20

Completion not working

Make sure Python 3 and neovim packages are installed:

python3 -m pip install --user neovim pynvim msgpack

Revert to original configuration

cd~/.config/vim/etc
mv vimrc.bak vimrc # Restore original

Customization

Local Configuration

Create ~/.config/local/vimrc.local for your personal settings:

" Example local configurationletg:author='Your Name'letg:email='your@email.com'letg:github='yourusername'" Custom key mappingsnnoremap<leader>x :CustomCommand<CR>" Plugin settingsletg:airline_theme='molokai'

This file is sourced at the end of the main vimrc and won't be overwritten.


Additional Resources

vim wiki | vim site | vim-plug


License

WTFPL - Do What The F*ck You Want To Public License


Last Updated: 2025-12-09
Vim Version: 8.0+ / Neovim 0.5+
Performance: 5-10x faster startup, 30-40% less memory