Skip to content

Instantly share code, notes, and snippets.

@Pradeek
Created August 20, 2011 05:04
Show Gist options
  • Save Pradeek/1158692 to your computer and use it in GitHub Desktop.
Save Pradeek/1158692 to your computer and use it in GitHub Desktop.
My .vimrc
set nocompatible " Forget vi.
call pathogen#infect() " Set up pathogen
syntax on
filetype plugin indent on
" Keep the buffer around when switching between buffers
set hidden
" Show what mode i'm in
set showmode
" Show line numbers
set number
" Basic editing stuff
set wrap " Don't wrap lines
set tabstop=4 " Set tab as 4 spaces
set backspace=indent,eol,start " Allow backspace for everything in insert mode
set autoindent " Auto indent everything
set copyindent " Copy previous indentation on autoindenting
set number " Show line numbers
set shiftwidth=4 " No of spaces for autoindent
set shiftround " Use multiple of shiftwidth when indenting with stuff like <
set showmatch " Show matching parenthesis
set ignorecase " Ignore case when searching
set smartcase " ignore case if search pattern is lowercase, case sensitive otherwise
set hlsearch " Hightlight search terms
set incsearch " Show search matches as you type
" Clear search terms
nnoremap <leader><space> :noh<CR>
set history=1000 " More history!
set undolevels=1000 " More undo levels!
set title " Show title
set ruler " Display cursor position in lower right corner
set showcmd " Display the command in lower right corner
set wildmenu " Better command-line completion
set wildmode=list:longest " Auto-complete menu
set splitright " Split window below/to the right
set autochdir " Automatically change working directory to the current directory
set mouse=a " Enable mouse
set linespace=1 " Sets linespace (duh!)
" Make cursor move as expected with wrapped lines
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
" Don't backup files.
set nobackup
set noswapfile
" Shows the current command
set showcmd
" Set leader to , instead of \
let mapleader=","
" Quick edit for the vimrc files
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" Map F1 key to ESC key in all modes
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Map <leader>ee to ESC in insert mode
imap <leader>e <ESC>
vmap <leader>e <ESC>
" Customize navigation in splits
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Make vim look pretty
colorscheme wombat
set guifont=Monaco\ 12
set guioptions-=m
set guioptions-=T
" Set shortcut for NERDTree
inoremap <leader>nt :NERDTreeToggle <CR>
nnoremap <leader>nt :NERDTreeToggle <CR>
vnoremap <leader>nt :NERDTreeToggle <CR>
" Map spacebar to colon
nmap <space> :
" Map <leader>s to save file
imap <leader>s <ESC> :w <CR>
nmap <leader>s :w <CR>
vmap <leader>s <ESC> :w <CR>
" Bubble single lines
nmap <C-Up> ddkP
nmap <C-Down> ddp
" Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
" Copy paste the normal way
nmap <C-V> "+gP
vmap <C-X> "+x
vmap <C-C> "+y
" vmap <C-V> "+gP
" Save when you lose focus (don't warn about unsaved files)
au FocusLost * silent! wa
" Do it when i change buffers as well
set autowrite
" Shortcut for Taglist plugin
inoremap <leader>tt :TlistToggle <CR>
nnoremap <leader>tt :TlistToggle <CR>
vnoremap <leader>tt :TlistToggle <CR>
" Make cursor to always stay in the middle of the window
set scrolloff=999
" Yank(Copy) entire file
nmap <leader>cc :%y+ <CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment