Vim Plugins Setup

Vim Plugins Setup

Why Use Vim Plugins?

In the Vim Basics series, we covered vanilla vim and how powerful it is right out of the box. And honestly, vanilla vim can handle 90% of your daily work as a sysadmin. But sometimes you want that extra 10% - better syntax highlighting, file navigation, or quality of life improvements that make your workflow even smoother.

The key is not to go overboard. I’ve seen people install 30+ plugins and end up with a slow, bloated vim that defeats the purpose of using a lightweight editor in the first place. As a system admin who jumps between servers constantly, I keep my plugin setup minimal and portable.

Enter Pathogen

As of right now, I have been using Pathogen as my vim plugin manager for a few years now. It took a little setup but is massively trivial to add new plugins or “bundles” as Pathogen calls them.

There are newer plugin managers out there (vim-plug, Vundle, etc.), but Pathogen has proven itself over the years. It’s simple, reliable, and doesn’t require any special commands - it just works. Plus, it’s easy to version control your entire vim setup with git.

My current .vimrc and vim files can be found at my github dotfiles repo.

Installing Pathogen

The installation is straightforward. We need to create a couple directories and download the Pathogen script:

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

This creates:

  • ~/.vim/autoload/ - Where Pathogen itself lives
  • ~/.vim/bundle/ - Where all your plugins will be installed

Configuring Your .vimrc

Now we need to tell vim to use Pathogen. If you don’t have a .vimrc yet, create one:

$ vim ~/.vimrc

At the minimum, you’d want the first line (excute pathogen#infect()) but the other lines help improve vim:

" Load Pathogen
execute pathogen#infect()

" Enable syntax highlighting
syntax on

" Enable filetype detection
filetype plugin indent on

The execute pathogen#infect() line is the magic that makes everything work. It tells vim to load all plugins from the ~/.vim/bundle/ directory. That’s it - pathogen is now installed and ready to manage plugins.

My .vimrc file is currently sitting at 182 lines, but most of those are comments and tweaks I’ve accumulated over the years. The core Pathogen setup is just that one line.

Installing Your First Plugin: Vividchalk

Let’s install what is arguably the best color scheme for vim - vividchalk. This theme provides excellent syntax highlighting with colors that are easy on the eyes during long config editing sessions.

Navigate to your bundle directory and clone the plugin:

cd ~/.vim/bundle
git clone https://github.com/tpope/vim-vividchalk.git

That’s it! The plugin is installed. Now we just need to activate it in our .vimrc:

" Set colorscheme to vividchalk
colorscheme vividchalk

Add that line anywhere in your .vimrc after the execute pathogen#infect() line, save the file, and restart vim (or run :source ~/.vimrc).

You should immediately see better syntax highlighting when you open any file. The difference is especially noticeable when editing shell scripts, Python, or configuration files.

How Pathogen Works

Here’s the beauty of Pathogen: each plugin lives in its own directory under ~/.vim/bundle/. This keeps everything organized and makes it easy to:

  1. Add a new plugin - Just git clone it into the bundle directory
  2. Update a plugin - cd into its directory and git pull
  3. Remove a plugin - Delete its directory from bundle
  4. Version control your setup - Your entire vim config can be in git

For example, my bundle directory looks like this:

$ ls ~/.vim/bundle/
vim-vividchalk
nerdtree
vim-fugitive
vim-commentary

Each plugin is its own git repository. When I set up vim on a new server, I just clone my dotfiles repo and I’m good to go.

Essential Plugins for Sysadmins

Over the years, I’ve narrowed down my plugin list to a handful that I actually use every day. Remember, as a sysadmin working across multiple systems, you can’t always have your full plugin setup available. These are the ones worth installing on your main workstation:

1. NERDTree (File Explorer)

When working with multiple config files or exploring directory structures:

cd ~/.vim/bundle
git clone https://github.com/preservim/nerdtree.git

Add to your .vimrc:

" Toggle NERDTree with Ctrl+n
map <C-n> :NERDTreeToggle<CR>

" Show hidden files
let NERDTreeShowHidden=1

" Close vim if NERDTree is the only window left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

Now press Ctrl+n to open a file explorer sidebar. Use the same key combo to close it. Navigate with hjkl keys and press Enter to open files.

2. vim-fugitive (Git Integration)

If you’re managing infrastructure as code or maintaining dotfiles:

cd ~/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git

This gives you git commands right inside vim:

  • :Git status - Check repo status
  • :Git diff - See changes
  • :Git commit - Commit changes
  • :Git push - Push to remote

No need to exit vim to run git commands anymore.

3. vim-commentary (Easy Commenting)

Essential for commenting out blocks of code or config lines:

cd ~/.vim/bundle
git clone https://github.com/tpope/vim-commentary.git

Use gcc to comment/uncomment a line, or select multiple lines in visual mode and use gc. Works with most file types automatically (shell scripts, Python, vim scripts, etc.).

4. vim-airline (Better Status Line)

Makes your status line actually useful:

cd ~/.vim/bundle
git clone https://github.com/vim-airline/vim-airline.git

Add to .vimrc:

" Always show status line
set laststatus=2

" Show buffer numbers
let g:airline#extensions#tabline#buffer_nr_show = 1

Now you get a nice status line showing your current mode, file type, line/column, and more.

Keeping It Simple

Here’s my philosophy on vim plugins as a sysadmin: only install plugins that save you time or improve readability. I deliberately keep my plugin count low because:

  1. Portability - I can replicate my setup quickly on new systems
  2. Performance - Vim stays fast even on older servers
  3. Reliability - Fewer plugins means fewer things that can break
  4. Muscle memory - I don’t want to rely on features that won’t be available when I SSH into a random server

On remote servers, I usually just use vanilla vim with a basic .vimrc. The muscle memory from using vim daily means I’m still productive even without plugins.

My Complete Pathogen .vimrc Setup

Here’s a condensed version of my plugin-related .vimrc configuration:

" Pathogen Plugin Manager
execute pathogen#infect()
syntax on
filetype plugin indent on

" Colorscheme
colorscheme vividchalk

" NERDTree Configuration
map <C-n> :NERDTreeToggle<CR>
let NERDTreeShowHidden=1
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

" Airline Configuration  
set laststatus=2
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1

" Git Fugitive
" (no special config needed, just use :Git commands)

" Commentary
" (works out of the box with gcc)

Testing Your Setup

Let’s verify everything works:

  1. Open vim: vim test.sh
  2. You should see the vividchalk color scheme applied
  3. Try Ctrl+n to toggle NERDTree (if installed)
  4. Check your status line for airline information

If something doesn’t work:

  • Make sure the plugin directory exists in ~/.vim/bundle/
  • Verify execute pathogen#infect() is in your .vimrc
  • Try :source ~/.vimrc to reload your config
  • Check :scriptnames to see what vim has loaded

Plugin Alternatives

While I use Pathogen, here are other popular plugin managers if you’re curious:

vim-plug:

  • Faster than Pathogen
  • Supports lazy loading
  • More features but more complex

Vundle:

  • Similar to vim-plug
  • Popular in the community
  • Slightly more overhead

Native Vim 8+ packages:

  • No plugin manager needed
  • Built into vim 8+
  • Manual setup but zero dependencies

I stick with Pathogen because it’s simple and I know it works. The “best” plugin manager is the one you understand and can troubleshoot when things break at 2 AM on a production server.

Final Thoughts

Plugins can enhance your vim experience, but they’re not mandatory. Start with the basics from the Vim Basics series, get comfortable with vanilla vim, then add plugins one at a time as you identify actual needs.

  • vividchalk: Better colors for long editing sessions
  • NERDTree: Quick directory navigation when needed
  • vim-fugitive: Git integration for my dotfiles and scripts
  • vim-commentary: Fast commenting/uncommenting
  • vim-airline: Better visual feedback

Quick Reference

Install Pathogen:

mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Add to .vimrc:

execute pathogen#infect()
syntax on
filetype plugin indent on

Install a plugin:

cd ~/.vim/bundle
git clone [plugin-repo-url]

Update plugins:

cd ~/.vim/bundle && for dir in */; do cd "$dir"; git pull; cd ..; done

Remove a plugin:

rm -rf ~/.vim/bundle/[plugin-name]

Now go forth and enhance your vim setup! Just remember to keep it simple, keep it portable, and always maintain your vanilla vim skills.