Skip to content

Instantly share code, notes, and snippets.

@DanBradbury
Created June 4, 2014 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanBradbury/e2203fa2c7cc68fc7fbb to your computer and use it in GitHub Desktop.
Save DanBradbury/e2203fa2c7cc68fc7fbb to your computer and use it in GitHub Desktop.
~/.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"
" " let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'chikamichi/mediawiki.vim'
Plugin 'chrisbra/csv.vim'
Plugin 'ekalinin/Dockerfile.vim'
Plugin 'godlygeek/tabular'
Plugin 'honza/vim-snippets'
Plugin 'kchmck/vim-coffee-script'
Plugin 'kien/ctrlp.vim'
Plugin 'majutsushi/tagbar'
Plugin 'mattn/gist-vim'
Plugin 'mattn/webapi-vim'
Plugin 'mileszs/ack.vim'
Plugin 'mmalecki/vim-node.js'
Plugin 'othree/html5.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'rking/ag.vim'
Plugin 'saltstack/salt-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'sjl/gundo.vim'
Plugin 'slim-template/vim-slim'
Plugin 'tomasr/molokai'
Plugin 'tpope/vim-abolish'
Plugin 'tpope/vim-endwise'
Plugin 'tpope/vim-eunuch'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-pastie'
Plugin 'tpope/vim-pathogen'
Plugin 'tpope/vim-ragtag'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-speeddating'
Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-vividchalk'
Plugin 'vim-ruby/vim-ruby'
Plugin 'vim-scripts/apachelogs.vim'
Plugin 'vim-scripts/apachestyle'
Plugin 'vim-scripts/bats.vim'
Plugin 'vim-scripts/dhcpd.vim'
Plugin 'vim-scripts/fontzoom.vim'
Plugin 'vim-scripts/iptables'
Plugin 'vim-scripts/nginx.vim'
" " git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" " The sparkup vim script is in a subdirectory of this repo called vim.
" " Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" " Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
"
" " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" " To ignore plugin indent changes, instead use:
filetype plugin on
" " Put your non-Plugin stuff after this line
set hidden " don't unload buffer when switching away
set modeline " allow per-file settings via modeline
set exrc " enable per-directory .vimrc files
set secure " disable unsafe commands in local .vimrc files
set encoding=utf-8 fileencoding=utf-8 termencoding=utf-8 " saving and encoding
set nobackup nowritebackup noswapfile autoread " no backup or swap
set hlsearch incsearch ignorecase smartcase " search
set wildmenu " completion
set backspace=indent,eol,start " sane backspace
" set clipboard=unnamedplus " use the system clipboard for yank/put/delete
set mouse=a " enable mouse for all modes settings
set nomousehide " don't hide the mouse cursor while typing
set mousemodel=popup " right-click pops up context menu
set ruler " show cursor position in status bar
" set relativenumber " show relative line numbers
set number " show absolute line number of the current line
set nofoldenable " I fucking hate code folding
set scrolloff=10 " scroll the window so we can always see 10 lines around the cursor
set textwidth=80 " show a vertical line at the 79th character
set cursorline " highlight the current line
set cursorcolumn " highlight the current line
set printoptions=paper:letter " use letter as the print output format
set guioptions-=T " turn off GUI toolbar (icons)
set guioptions-=r " turn off GUI right scrollbar
set guioptions-=L " turn off GUI left scrollbar
set winaltkeys=no " turn off stupid fucking alt shortcuts
set laststatus=2 " always show status bar
" check the parent directories for tags, too.
set tags+=./tags,../tags,../../tags,../../../tags,../../../../tags
set tags+=../../../../../tags,../../../../../../tags,../../../../../../../tags
set tags+=../../../../../../../../tags,../../../../../../../../../tags
" middle-click paste
map! <S-Insert> <MiddleMouse>
" appearance
syntax on
set background=dark
set t_Co=256 " 256 colors in terminal
if has('gui_gnome')
set guifont=Ubuntu\ Mono\ 8.4
endif
"" Molokai theme
" highlight the 80th column
"
" In Vim >= 7.3, also highlight columns 120+
"if exists('+colorcolumn')
" (I picked 120-320 because you have to provide an upper bound and 320 just
" covers a 1080p GVim window in Ubuntu Mono 11 font.)
" let &colorcolumn="80,".join(range(120,320),",")
"else
" fallback for Vim < v7.3
" autocmd BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
"endif
" formatting
filetype plugin indent on
set shiftwidth=2 tabstop=2 softtabstop=2 expandtab autoindent
autocmd filetype c,asm,python setlocal shiftwidth=4 tabstop=4 softtabstop=4
" Makefile no expandtab
autocmd FileType make setlocal noexpandtab
" bindings to:
" - cd current window to parent directory of file
" - generate ctags
" - flush command-t index
" - better range
" - fix white space
" - rerun previous :command
" - underline a line with equals (h1 in Markdown documents)
" - underline a line with hyphens (h2 in Markdown documents)
" - sort selection
noremap <Leader>cd :lcd %:h<CR>:pwd<CR>
noremap <Leader>ct :!ctags -R .<CR><CR>
noremap <Leader>cf :CommandTFlush<CR>
noremap <Leader>bd :1,999bd<CR>:NERDTree<CR>:NERDTree<CR>
noremap ' `
map <Leader>W :FixWhitespace<CR>
map <Leader>] @:
map <Leader>= yypVr=
map <Leader>- yypVr-
map <Leader>s :sort<CR>
" fugitive shortcuts
noremap <Leader>gs :Gstatus<CR>
noremap <Leader>gc :Gcommit<CR>
norema <Leader>ga :Gwrite<CR>
noremap <Leader>gl :Glog<CR>
noremap <Leader>gd :Gdiff<CR>
noremap <Leader>gb :Gblame<CR>
" move between windows with M-hjkl (urxvt then gvim)
noremap <Esc>h <C-w>h
noremap <Esc>j <C-w>j
noremap <Esc>k <C-w>k
noremap <Esc>l <C-w>l
"noremap <D-h> <C-w>h
"noremap <D-j> <C-w>j
"noremap <D-k> <C-w>k
"noremap <D-l> <C-w>l
" jump 5 lines with C-jk
noremap <C-j> 5j
noremap <C-k> 5k
noremap <C-l> 10l
noremap <C-h> 10h
" NERDTree
let NERDTreeWinPos='right'
map <C-Bslash> :NERDTreeToggle<CR>
" Tagbar
nmap <Leader>rt :TagbarToggle<CR>
" Ack
nmap <Leader>f :Ack<Space>
" Tabular
nmap <Leader>T :Tabularize<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment