Setting Up a Vim Configuration

October 2, 2025

Abstract

Vim is a powerful text editor, but its default configuration can be somewhat bare-bones. This guide shows you how to quickly set up an enhanced Vim environment using the Ultimate vimrc project, along with some essential customizations for improved productivity.

Keywords: Vim, Text Editor, Configuration, Development Tools, Productivity

Installing the Ultimate Vimrc

The Ultimate vimrc project by amix provides a well-curated collection of Vim configurations and plugins that work out of the box. To install it, run the following commands:

# Clone the repository (shallow clone for faster download)
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime

# Install the basic configuration
sh ~/.vim_runtime/install_basic_vimrc.sh

# Install the awesome configuration (includes more plugins)
sh ~/.vim_runtime/install_awesome_vimrc.sh

# Update plugins to the latest versions
python3 ~/.vim_runtime/update_plugins.py

The installation provides two options:

  • Basic version: A minimal setup with essential features
  • Awesome version: A more feature-rich configuration with additional plugins

Understanding the Configuration Structure

After installation, if you open ~/.vimrc, you'll find that the author has included the following content:

" DO NOT EDIT THIS FILE
" Add your own customizations in ~/.vim_runtime/my_configs.vim

set runtimepath+=~/.vim_runtime

source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
try
  source ~/.vim_runtime/my_configs.vim
catch
endtry

This structure is intentionally designed to keep your personal customizations separate from the base configuration. The key insight here is that you should not edit .vimrc directly. Instead, all personal configurations should be placed in ~/.vim_runtime/my_configs.vim.

This approach has several benefits:

  • Your customizations won't be overwritten when updating the Ultimate vimrc
  • It keeps your configuration clean and maintainable
  • You can easily back up or share just your personal settings

Adding Personal Customizations

Now let's add some essential customizations to enhance your Vim experience.

Adding Line Numbers

By default, the Ultimate vimrc doesn't display line numbers. To enable both absolute and relative line numbers, which are incredibly useful for navigation, edit your ~/.vim_runtime/my_configs.vim file:

vim ~/.vim_runtime/my_configs.vim

Add the following configuration:

" Display absolute line numbers
set number

" Display relative line numbers (useful for j/k navigation)
set relativenumber

The combination of number and relativenumber gives you the best of both worlds: the current line shows the absolute line number, while other lines show their relative distance from the cursor. This makes it easy to use motion commands like 5j to jump 5 lines down.

Adding Auto-Save Functionality

To avoid losing work, you can configure Vim to automatically save your files. Add the following to your ~/.vim_runtime/my_configs.vim:

" Auto-save every second when cursor stops moving
set updatetime=1000
autocmd CursorHold,CursorHoldI * if &buftype == '' && filewritable(expand('%')) | update | endif

This configuration:

  • Sets the update time to 1000 milliseconds (1 second)
  • Automatically saves the file when the cursor remains idle
  • Only applies to regular file buffers (not special buffers)
  • Verifies the file is writable before saving

Note: Be aware that auto-save can sometimes interfere with certain workflows, such as when you're experimenting with code changes. You can always disable it temporarily by commenting out these lines or adjusting the updatetime value to a longer interval.

Resolving Key Mapping Conflicts

Restoring Ctrl+F for Page Scrolling

After configuring the Ultimate vimrc, you might notice that Ctrl+F has been remapped to trigger file search instead of its default behavior. In standard Vim, Ctrl+F scrolls forward (down) one page, and Ctrl+B scrolls backward (up) one page. However, the Ultimate vimrc's CtrlP plugin maps Ctrl+F to file search functionality.

This mapping is defined in the ~/.vim_runtime/vimrcs/plugins_config.vim file, where CtrlP assigns Ctrl+F for fuzzy file finding.

Solutions

There are two approaches to resolve this conflict:

To disable the CtrlP mapping for Ctrl+F and restore Vim's native page scrolling functionality, you have two approaches:

  1. Directly edit the ~/.vim_runtime/vimrcs/plugins_config.vim file and comment out line 56:

    " Comment out this line:
    " let g:ctrlp_map = '<C-f>'
  2. Override the mapping in your personal config (recommended): Add the following to your ~/.vim_runtime/my_configs.vim:

    " Unmap Ctrl+F to restore default page forward scrolling
    silent! nunmap <C-f>

The second approach is recommended because it keeps your customizations in the designated personal config file, making updates to the Ultimate vimrc easier to manage.

With either change, you can still access CtrlP's file search using <leader>j (where <leader> is comma , by default), or by directly calling :CtrlP.

Option 2: Remap CtrlP to a different key

If you prefer to keep CtrlP on a keyboard shortcut but want to free up Ctrl+F, you can remap it to another key combination. For example:

" Unmap Ctrl+F from CtrlP
silent! nunmap <C-f>

" Remap CtrlP to Ctrl+P instead (if not already mapped)
nnoremap <C-p> :CtrlP<CR>

Recommendation: Option 1 is generally preferred because it preserves Vim's default navigation behavior, which is important for muscle memory and consistent workflow. The <leader>j mapping provides a convenient alternative for file searching without sacrificing core Vim functionality.

Summary

With these simple configurations, you now have a powerful and productive Vim setup:

  1. A feature-rich Vim environment from the Ultimate vimrc project with well-chosen plugins and sensible defaults
  2. Clear configuration structure that separates base settings from personal customizations, making updates easy
  3. Line numbers for easier navigation with both absolute and relative line numbers for efficient cursor movement
  4. Automatic file saving to prevent data loss during your editing sessions

These enhancements significantly improve the Vim experience while maintaining the editor's legendary efficiency and speed. The modular configuration approach also makes it easy to add more customizations in the future – just keep adding to your ~/.vim_runtime/my_configs.vim file.

Next Steps

Once you're comfortable with this basic setup, consider exploring:

  • Additional plugins available in the Ultimate vimrc project
  • Custom key mappings to match your workflow
  • Language-specific configurations for your programming languages
  • Color schemes and visual customizations