writing

My musings/writings/learnings

View the Project on GitHub manu29d/writing

Simplifying Vim: 95% of my Vim Usage

I’ve been using Vim for a decade now, and over the years, I’ve gradually streamlined my usage to a minimalistic subset of its powerful features. While Vim can seem intimidating to newcomers, I’ve found that the 80-20 principle applies here as well. By focusing on a handful of essential features and a few select plugins, you can become highly productive with this amazing software. In this blog post, I’ll share my minimalist Vim setup, including the plugins I use, my key combinations, and some handy commands.

My Essential Vim Plugins

1. vim-gitgutter

vim-gitgutter is a lightweight Git gutter plugin that provides a clear visual indication of changes in your Git repository directly in your code.

2. CtrlP

CtrlP simplifies file navigation with its fuzzy file finder. I’ve configured it with a custom command to search for Git-tracked files.

let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']

3. Nerdtree

Nerdtree is a file system explorer that helps you navigate your project directory easily.

4. vim-airline

vim-airline provides a sleek status bar at the bottom of your Vim window. Note that it requires nerd-fonts for full functionality, but if you’re using zsh with a theme like spaceship, you might already have these fonts installed.

My Vim Configuration

Here’s a glimpse of my Vim configuration:

syntax on
set mouse+=a
set hlsearch cursorline incsearch nu
set termguicolors
set background=dark
set expandtab tabstop=2 shiftwidth=2
set autoindent smartindent
set splitright splitbelow

call plug#begin()
  Plug 'vim-airline/vim-airline'
  Plug 'ctrlpvim/ctrlp.vim'
  Plug 'airblade/vim-gitgutter'
  Plug 'preservim/nerdtree'
call plug#end()

let g:airline_powerline_fonts = 1

let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
let g:ctrlp_working_path_mode = 'ra'

nnoremap <C-\> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
let g:NERDTreeShowHidden=1
let NERDTreeIgnore=['\.swp$']

My Minimalist Key Combinations

I’ve deliberately kept my Vim keybindings simple. Here are the key combinations I use regularly:

Handy Vim Commands

Here are some Vim commands I use almost daily (I really don’t I use much else):

Terminal Integration

For tasks that fall outside of Vim’s scope, I often turn to the terminal:

Simplifying your Vim workflow can make it more approachable and productive. By focusing on essential features and plugins, you can harness the power of Vim without feeling overwhelmed by its extensive capabilities. Remember, Vim is a highly customizable editor, so feel free to adapt these tips to suit your preferences and workflow. Happy Vimming!