vim – Configs

FIX

You can configure a huge range of behaviors in your .vimrc file to tailor Vim to your workflow. Here’s a categorized breakdown of what you can tweak:


Core Editor Behavior

  • set nocompatible — disables legacy Vi compatibility
  • syntax on — enables syntax highlighting
  • set number — shows line numbers
  • set cursorline — highlights the current line
  • set showcmd and set showmode — display partial commands and current mode

Indentation & Tabs

  • set tabstop=4 — sets tab width
  • set shiftwidth=4 — sets indent width
  • set expandtab — converts tabs to spaces
  • set autoindent and set smartindent — auto-indent new lines

Search Behavior

  • set incsearch — incremental search
  • set ignorecase — case-insensitive search
  • set smartcase — case-sensitive if uppercase used
  • set hlsearch — highlights matches

UI & Display

  • set wrap or set nowrap — line wrapping
  • set scrolloff=5 — keeps cursor centered vertically
  • set wildmenu — enhanced command-line completion
  • colorscheme desert — sets color theme

Plugins & Extensions

If using a plugin manager like vim-plug, you can add:

call plug#begin('~/.vim/plugged')
Plug 'preservim/nerdtree'       " File explorer
Plug 'dense-analysis/ale'       " Linting
Plug 'vim-airline/vim-airline'  " Status line
call plug#end()

Then run :PlugInstall inside Vim.


Key Mappings

inoremap jj <Esc>               " Exit insert mode with 'jj'
nnoremap <leader>w :w<CR>       " Save with \w
nnoremap <F5> :w<CR>:!python3 %<CR>  " Run Python script

Advanced Features

  • Folding: set foldmethod=indent or syntax
  • Persistent Undo: set undofile and set undodir=~/.vim/undo
  • Backup: set backup and set backupdir=~/.vim/backups
  • Mouse Support: set mouse=a

Example .vimrc Starter

set nocompatible
syntax on
set number
set tabstop=4 shiftwidth=4 expandtab
set autoindent smartindent
set incsearch ignorecase smartcase hlsearch
set cursorline scrolloff=5
set wildmenu
colorscheme desert
inoremap jj <Esc>
nnoremap <F5> :w<CR>:!python3 %<CR>

ADD – Tailor for python, bash, expect, sql