Skip to content

Instantly share code, notes, and snippets.

@rosscooperman
Created November 12, 2013 19:11
Show Gist options
  • Save rosscooperman/7436902 to your computer and use it in GitHub Desktop.
Save rosscooperman/7436902 to your computer and use it in GitHub Desktop.
My .vimrc
"" load plugins from ~/.vim/bundle
call pathogen#infect()
"" general settings
set hidden
let mapleader = ","
set nowrap
set autoread
set history=1000
if has("gui_running")
set guioptions=egmrt
endif
set backupdir=~/.vimtmp
set directory=~/.vimtmp
"" statusline settings
function! Current_branch(...)
if !exists('b:git_dir')
return ''
endif
return ' (' . fugitive#head(7) . ')'
endfunction
set laststatus=2
set statusline=%h%w\ %f\ (#%n)\ %y\ [%l:%c]\ %LL\ (%p%%)%{Current_branch()}\ %m
"" indentation settings
filetype plugin on
filetype indent on
set autoindent
set expandtab
set shiftwidth=2
set softtabstop=2
"" tab completion settings
set wildmenu
set wildmode=list:longest,full
"" look and feel (margins, colors, etc)
colorscheme solarized
syntax enable
set background=dark
set number
set cul
set guifont=Source\ Code\ Pro\ for\ Powerline:h13
set colorcolumn=120
set textwidth=100
set wrapmargin=0
set list listchars=trail:·
"" customize the default color scheme a little bit
set fillchars=vert:\|,stl:\ ,stlnc:\
hi StatusLine guibg=#DDDDDD guifg=#222222
hi StatusLineNC guibg=#BBBBBB guifg=#222222
hi VertSplit guibg=#DDDDDD
hi Search guibg=LightBlue
"" customize file type associations
au BufRead,BufNewFile *.rabl setf ruby
au BufRead,BufNewFile *.pde setf c
"" search settings
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
"" mappings
map <D-F> :Ack
map <leader>t :set ft=
imap jj <esc>
nnoremap <C-j> :m .+1<CR>==
nnoremap <C-k> :m .-2<CR>==
inoremap <C-j> <Esc>:m .+1<CR>==gi
inoremap <C-k> <Esc>:m .-2<CR>==gi
vnoremap <C-j> :m '>+1<CR>gv=gv
vnoremap <C-k> :m '<-2<CR>gv=gv
"" split navigation mappins
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
"" automatically reload vimrc after it is saved
autocmd! bufwritepost .vimrc source %
"" automatically strip trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
"" NERDTree plugin configuration
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
nmap <leader>n :NERDTreeToggle<CR>
"" rails.vim plugin configuration
map :R :Rails
"" Ack.vim plugin configuration
let g:ackprg="ack -H --nocolor --nogroup --column --type-set log=.log --nolog"
"" CtrlP plugin configuration
let g:ctrlp_open_new_file = "t"
let g:ctrlp_custom_ignore = { 'dir': '\v[\/](\.git|log|tmp|public\/docs|public\/uploads|db\/fixtures)$' }
"" powerline plugin configuration
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment