Skip to content

Instantly share code, notes, and snippets.

@meowgorithm
Created December 5, 2011 20:00
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 meowgorithm/bf86b8bc9d24223c7656 to your computer and use it in GitHub Desktop.
Save meowgorithm/bf86b8bc9d24223c7656 to your computer and use it in GitHub Desktop.
Roshambo’s .vimrc
scriptencoding utf-8
set encoding=utf-8
set nocompatible
filetype off
" Initialize Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" Bundles
Bundle 'git://git.wincent.com/command-t.git'
"Bundle 'hallettj/jslint.vim'
Bundle 'mileszs/ack.vim'
Bundle 'scrooloose/nerdcommenter'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'msanders/snipmate.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'taglist.vim'
Bundle 'PickAColor.vim'
Bundle 'BufOnly.vim'
"Bundle 'ervandew/supertab'
Bundle 'kchmck/vim-coffee-script'
Bundle 'groenewege/vim-less'
Bundle 'majutsushi/tagbar'
filetype plugin indent on "enable filetype-specific indenting, syntax, and plugins
syntax on
" Vim 7.3 and newer can persist undo history across sessions
if v:version >= 703
set undofile
set undodir=~/.vim/tmp
endif
set directory=~/.vim/tmp
set backupdir=~/.vim/backup
set viewdir=~/.vim/view
set autoread "re-read files when they're changed externally
set nobackup
set nowritebackup
set noswapfile
" Modelines
set modeline
set modelines=5
" Tabs and spacing
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab "expandtab for spaces, noexpandtab for tabs
set smarttab
set autoindent
set smartindent
set shiftround
autocmd FileType,BufEnter,WinEnter python,javascript,coffee,css,less set expandtab tabstop=4 shiftwidth=4 softtabstop=4 "textwidth=79 "PEP0008 compliance
autocmd FileType,BufEnter,WinEnter ruby,html,django,eruby set expandtab tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType,BufEnter,WinEnter django set ft=django.html
autocmd FileType,BufEnter,WinEnter eruby set ft=eruby.html
autocmd FileType,BufEnter,WinEnter css,less set ft=less.css
autocmd FileType,BufEnter,WinEnter scss set ft=scss.css
set ruler
set nowrap
set number
set laststatus=2
set report=0
"set showcmd
set listchars=tab:\|\ ,trail:·,eol:¶
" Show current line in current window only
set cursorline
autocmd WinEnter,BufEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
" Searching
set nohlsearch " don't highlight search results by default
set ignorecase
set smartcase
set incsearch " search-as-you-type
set gdefault " assume the /g flag on :s substitutions to replace all matches in a line
set wrapscan " searches wrap around the end of the file
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=.DS_Store,*.pyc
set wildignore+=media/*,html/*,source/media/*
set wildignore+=node_modules/*
set wildignore+=tmp/*
set infercase "ignore case on insert completion
" MacVIM shift+arrows to select behavior. Required in .vimrc instead of
" .gvimrc for some reason.
let macvim_hig_shift_movement=1
" Window management
set splitbelow " open new horizontal splits below the current
set splitright " open new veritcal splits to the right of the current
" Statusline
"set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P "default
set statusline=%<%f%(\ %h%m%r%w%q%)
set statusline+=%(\ (%{&ff})%)
set statusline+=%=
set statusline+=%-19.{fugitive#statusline()}\ %-14.(%l,%c%V%)\ %P
" PLATFORM-SPECIFIC SETTINGS
if has('mac')
set mouse=a "enable the mouse in iTerm
endif
" GENERAL KEYBINDINGS
let mapleader=','
map <Leader>i :set invlist<CR>:exe ":echo 'toggling invisibles'"<CR>
map <Leader>r :registers<CR>
map <Leader>. :set number! nonumber?<CR>
" Toggle search highlighting
map <Leader>s :set hlsearch! hlsearch?<CR>
" Toggle line wrapping
map <Leader>w :set wrap! wrap?<CR>
" Tabs
nmap TN :wa<CR>:tabnext<CR>
nmap TP :wa<CR>:tabnext<CR>
" Buffers
nmap BN :wa<CR>:bnext<CR>
nmap BP :wa<CR>:bprev<CR>
nmap BO :wa<CR>:BufOnly<CR>
" Session management
nmap SSA :wa<CR>:mksession! ~/.vim/session/
nmap SO :wa<CR>:so ~/.vim/session/
" Splits
map SP :wa<CR>:sp<CR>
map VS :wa<CR>:vs<CR>
" Tri-Split
nmap SSS :wa<CR>:vs<CR><C-w><C-l>:sp<CR><C-w><C-h>:exe ":echo 'C-C-C-C-Combo Breaker'"<CR>
" File Handling
nmap E :wa<CR>:e
" Shortcut to open stuff in the Vim directory
nmap <Leader>v :wa<CR>:e ~/.vim/
" Spaces and tabs settings
nmap <Leader>1 :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>:exe ":echo 'Spaces, 4'"<CR>
nmap <Leader>2 :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>:exe ":echo 'Spaces, 2'"<CR>
nmap <Leader>3 :set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>:exe ":echo 'Tabs, 4'"<CR>
nmap <Leader>4 :set noexpandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>:exe ":echo 'Tabs, 2'"<CR>
" PLUGIN CONFIGURATION
" NERDTree
map <Leader>n :NERDTreeToggle<CR>
let NERDChristmasTree=1 "colorize
let NERDTreeHighlightCursorline=1
let NERDTreeShowBookmarks=1
let NERDTreeShowHidden=1 "show hidden files
"let NERDTreeHijackNetrw=0 "don't hijack NETRW
let NERDTreeIgnore=['\.$', '\~$', '\.git']
" NERDCommenter
let NERDSpaceDelims=1 "add a space before comments
" Exuberant CTags
map <Leader>l :TlistToggle<CR>
map <Leader>m :TagbarToggle<CR>
" Command-T
map <Leader>t :CommandT<CR>
let g:CommandTMatchWindowAtTop=0
let g:CommandTMaxHeight=20
" SuperTab
let g:SuperTabDefaultCompletionType='context' "let SuperTab determine which completion mode should be used
" SnipMate
let g:snips_author='Roshambo'
" Coffee-Script Auto-Compilation
"autocmd BufWritePost *.coffee silent CoffeeMake! | cwindow | redraw!
" Syntastic
map <Leader>e :Errors<CR>
let g:syntastic_enable_signs=1
let g:syntastic_quiet_warnings=0
let g:syntastic_auto_jump=0
let g:syntastic_auto_loc_list=2
" Syntastic/PyFlakes
" We have to run a mini Python script here to append 'site-packages' to the Python
" path at runtime.
if has('python')
python << EOF
import os
import sys
import vim
sys.path.append("/usr/local/lib/python2.7/site-packages")
EOF
endif
" CoffeeTags. Generated via:
" $ gem install CoffeeTags
" $ coffeetags --vim-conf --includevars >> ~/.vimrc
let g:tagbar_type_coffee = {
\ 'kinds' : [
\ 'f:functions',
\ 'o:object'
\ ],
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object'
\},
\ 'sro' : ".",
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : ' ',
\}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment