Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

203 lines (158 sloc) 6.244 kb
"" Thanks:
"" Gary Bernhardt <>
"" Drew Neil <>
"" Tim Pope <>
"" Janus <>
set nocompatible
syntax enable
set encoding=utf-8
call pathogen#infect()
filetype plugin indent on
set background=dark
color molokai
set number
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
" highlight current line and column of current pane
set cursorline
set cursorcolumn
autocmd WinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
autocmd WinEnter * setlocal cursorcolumn
autocmd WinLeave * setlocal nocursorcolumn
" Ignore files with these extensions
set wildignore+=*.py[co],*.log
" Allow backgrounding buffers without writing them, and remember marks/undo
" for backgrounded buffers
set hidden
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
" List chars
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
function s:setupWrapping()
set wrap
set wrapmargin=2
set textwidth=72
if has("autocmd")
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make set noexpandtab
" Make sure all mardown files have the correct filetype set and setup wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} setf markdown | call s:setupWrapping()
" Treat JSON files like JavaScript
au BufNewFile,BufRead *.json set ft=javascript
" make Python follow PEP8 ( )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" Remember last location in file, but not for commit messages.
" see :help last-position-jump
au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
" Add a few more file types to ruby syntax
au BufRead,BufNewFile {*.thor} set ft=ruby
" Setup less files
au BufRead,BufNewFile {*.less} set ft=scss
" Setup Haproxy configs
au BufRead,BufNewFile haproxy* set ft=haproxy
au BufRead,BufNewFile *.coffee set ft=coffee
" Remove trailing whitespace on save
" au BufWritePre * KillWhitespace
" Use verbose syntax highlight in Python
let python_highlight_all=1
" Options for Ruby syntax highlighting
let ruby_operators = 1
" provide some context when editing
set scrolloff=3
" don't use Ex mode, use Q for formatting
map Q gq
" clear the search buffer when hitting return
:nnoremap <CR> :nohlsearch<cr>
let mapleader=","
map <leader>gv :CommandTFlush<cr>\|:CommandT app/views<cr>
map <leader>gc :CommandTFlush<cr>\|:CommandT app/controllers<cr>
map <leader>gm :CommandTFlush<cr>\|:CommandT app/models<cr>
map <leader>gh :CommandTFlush<cr>\|:CommandT app/helpers<cr>
map <leader>gl :CommandTFlush<cr>\|:CommandT lib<cr>
map <leader>gf :CommandTFlush<cr>\|:CommandT features<cr>
map <leader>gg :topleft 100 :split Gemfile<cr>
map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>
nnoremap <leader>l <c-^>
" find merge conflict markers
nmap <silent> <leader>cf <ESC>/\v^[<=>]{7}( .*\|$)<CR>
command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
map <leader>w :KillWhitespace<cr>
" easier navigation between split windows
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" disable cursor keys in normal mode
map <Left> :echo "no!"<cr>
map <Right> :echo "no!"<cr>
map <Up> :echo "no!"<cr>
map <Down> :echo "no!"<cr>
" Map shortcut for touch tmp/restart.txt
map <leader>t :!if [ -e tmp/ ]; then touch tmp/restart.txt && echo "App Restarted"; else echo "No tmp/ folder. NOT Restarted"; fi<CR>
set backupdir=~/.vim/_backup " where to put backup files.
set directory=~/.vim/_temp " where to put swap files.
" Use an undodir to persist all undo history
set undodir=~/.vim/_backup
set undofile
" Remap F1
map <F1> <Esc>
imap <F1> <Esc>
" Add shortcuts for Fugitive
nnoremap <Leader>ggs :Gstatus<CR>
nnoremap <Leader>ggb :Gblame<CR>
nnoremap <Leader>ggd :Gdiff<CR>
nnoremap <Leader>ggr :Gread<CR>
nnoremap <Leader>ggl :Glog<CR>
autocmd BufReadPost fugitive://* set bufhidden=delete
" Gundo
nnoremap <F5> :GundoToggle<CR>
" Powerline
let g:Powerline_symbols = 'fancy'
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" " Start the status line
" set statusline=%f\ %m\ %r
" " Add fugitive
" set statusline+=%{fugitive#statusline()}
" " Finish the statusline
" set statusline+=\ Line:%l/%L[%p%%]
" set statusline+=\ Col:%v
" set statusline+=\ Buf:#%n
" set statusline+=\ [%b][0x%B]
let g:CommandTMaxHeight=10
" NERDTree
map <Leader>n :NERDTreeToggle<CR>
map <Leader>r :NERDTreeFind<CR>
let NERDTreeSortOrder=['*', '\.swp$', '\.bak$', '\~$']
" Bufexplorer options
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowRelativePath=1
" Quick edit this file
map ,v :sp ~/.vimrc<CR><C-W>_
map <silent> ,V :source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
Jump to Line
Something went wrong with that request. Please try again.