# Vim Plugin Not Working
You installed a Vim plugin but nothing happens. The commands don't exist, the features don't work, and you're not sure why. Let me walk you through debugging this systematically.
Verify the Plugin Is Actually Installed
First, check if the plugin files exist where they should be:
```bash # For vim-plug ls ~/.vim/plugged/plugin-name/
# For Vundle ls ~/.vim/bundle/plugin-name/
# For Pathogen ls ~/.vim/bundle/plugin-name/
# For Neovim with lazy.nvim ls ~/.local/share/nvim/lazy/plugin-name/ ```
If the directory is empty or doesn't exist, the plugin wasn't installed correctly.
Plugin Manager Common Issues
vim-plug
Ensure your .vimrc has the correct structure:
```vim call plug#begin('~/.vim/plugged')
" Plugins go here Plug 'tpope/vim-fugitive' Plug 'preservim/nerdtree'
call plug#end() ```
Run the install command:
:PlugInstallCheck for errors during installation. If a plugin fails to download (network issues, repository removed), you'll see an error message.
Vundle
call vundle#begin()
Plugin 'tpope/vim-fugitive'
call vundle#end()Run:
:PluginInstallPacker (Neovim)
Packer requires a specific setup. Your init.lua should contain:
local packer = require('packer')
packer.startup(function(use)
use 'tpope/vim-fugitive'
end)Run:
:PackerSyncLazy.nvim (Neovim)
require("lazy").setup({
"tpope/vim-fugitive",
})Plugins install automatically when you open Neovim, or run :Lazy.
Check Runtime Path
The plugin directory must be in Vim's runtime path. Verify:
:set rtp?Look for your plugin's directory in the comma-separated list. If it's missing, add it manually:
:set rtp+=~/.vim/plugged/my-pluginPlugin Loading Order
Some plugins depend on others being loaded first. The order in your plugin declaration matters:
```vim " Wrong - airline loads before its dependencies Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes'
" Correct - dependencies first Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline' ```
Check Plugin Documentation
Every plugin has documentation. Access it with:
:help plugin-nameIf the help file loads, the plugin is installed. If you get "Sorry, no help for...", the plugin isn't being recognized.
Scriptnames Debug
List all loaded scripts in order:
:scriptnamesSearch for your plugin name in this list. If it appears, the plugin is loading. If not, something is preventing it from loading.
Plugin Conflicts
Disable all other plugins temporarily to test:
vim -u NONE -c 'source ~/.vim/plugged/my-plugin/plugin/my-plugin.vim'If the plugin works in isolation, another plugin is conflicting. Re-enable plugins one by one to identify the culprit.
Missing Dependencies
Many plugins have external dependencies. Check the plugin's README for required tools:
- fzf.vim requires the
fzfbinary - coc.nvim requires Node.js
- vim-go requires Go
- ale requires linters installed separately
Verify the dependency exists:
which fzf
node --version
go versionPython Plugins
Plugins using Python require Vim compiled with Python support:
:echo has('python3')If this returns 0, install a Vim version with Python support:
```bash # Ubuntu/Debian sudo apt install vim-nox
# macOS brew install vim ```
Lua Plugins (Neovim)
Neovim-specific plugins using Lua won't work in standard Vim. Check if you're using Neovim:
:echo has('nvim')If 0, you need Neovim for these plugins.
Plugin Initialization
Some plugins require explicit initialization. Check the README for setup code:
-- nvim-tree requires this
require("nvim-tree").setup()Without the setup call, the plugin loads but doesn't function.
Enable Plugin Loading
Vim must have plugin loading enabled:
filetype plugin onSome minimal configurations disable this:
" This disables plugin loading
set noloadpluginsRemove or comment out this line.
Debug Load Errors
Check for errors during startup:
vim -V1 2>&1 | grep -i errorOr within Vim:
:messagesThis shows all recent messages including errors.
Test With Minimal Config
Create a minimal test configuration:
vim -u ~/.vim/minimal_test.vimWhere minimal_test.vim contains:
set nocompatible
filetype plugin on
set rtp+=~/.vim/plugged/plugin-nameIf the plugin works here, something in your main config is interfering.
Verify Commands Exist
Check if the plugin's commands are defined:
:command PluginCommandReplace PluginCommand with an actual command from the plugin. If you get E492: Not an editor command, the plugin didn't register its commands.
Complete Debugging Checklist
- 1.Plugin files exist in the right directory
- 2.Plugin manager installed it successfully
- 3.Plugin directory is in
rtp - 4.
filetype plugin onis set - 5.Dependencies are installed
- 6.No
set noloadpluginsin config - 7.Setup/initialization code is present
- 8.No conflicting plugins
- 9.Correct Vim/Neovim version
Run through these systematically and you'll find the issue.