The ultimate ~/.vimrc

So many hours spent on this file… It only uses built in functions from the vim-nox package, if you dont already have it installed then issue:

# apt-get install vim-nox

I use vim as a full IDE for all my development, combined with MiniBufExpl plugin and TMux to split screen for tailing log files.

" Number lines and set leader key "
set number
let mapleader = "\<Space>"
 
" Color "
syntax on
colorscheme molokai

" Misc "
filetype plugin indent on
set expandtab
set shiftwidth=4
set tabstop=4
set mouse=a
set nowrap
 
" Encoding "
scriptencoding utf-8
set encoding=utf-8

" Searching "
set incsearch
set ignorecase
set smartcase
set hlsearch
 
" type S, (RegEx Replace) "
nmap S :%s//g<LEFT><LEFT>
vmap S :s//g<LEFT><LEFT>

" Buffer navigation "
map <leader>, :bprev<CR>
map <leader>. :bnext<CR>
map <leader><TAB> :Ex<CR>
map <leader>v :Vex<CR>
map <leader>h :Hex<CR>

" Split like in Tmux "
map <leader>% :vsplit<CR>
map <leader>" :split<CR>

" Tab navigation "
map <leader><leader>, :tabp<CR>
map <leader><leader>. :tabn<CR>
map <leader><leader><TAB> :Tex<CR>
map <leader><leader>n :tabnew<CR>

" Write & quit "
map <leader>w :w<CR>
map <leader>q :q<CR>
map <leader>x :q!<CR> 

" Git bindings "
map <leader>gs :!git status<CR>
map <leader>ga :!git add .<CR>
map <leader>gc :!git commit<CR>

" Misc bindings "
map <leader>b :!bash %<RIGHT>
map <leader>l :!tail -f /var/log/apache/

And of course you need the Molokai Color Theme! You can download it from here and then place the file in ~/.vim/color/molokai.vim

Leave a comment

Your email address will not be published. Required fields are marked *