Skip to content

Instantly share code, notes, and snippets.

@dustinfarris
Last active December 23, 2015 14:19
Show Gist options
  • Save dustinfarris/6647883 to your computer and use it in GitHub Desktop.
Save dustinfarris/6647883 to your computer and use it in GitHub Desktop.
VI settings
scriptencoding utf-8
" Powerline setup
set guifont=Droid\ Sans\ Mono\ for\ Powerline:h15
set laststatus=2
" MVim options
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set cpoptions+=$ " puts a $ marker for the end of words/lines in cw/c$ commands
set number
set bg=light
" colorscheme macvim
colorscheme codeschool
" Highlight the current line
set cursorline
" Python mode
let g:pymode_rope = 1
let g:pymode_doc = 1
let g:pymode_doc_key = 'K'
let g:pymode_lint = 1
let g:pymode_lint_checker = 'pyflakes,pep8'
let g:pymode_lint_write = 1
let g:pymode_lint_ignore = 'E121,W404,W0401,F403,E501'
let g:pymode_virtualenv = 1
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = ';b'
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
let g:pymode_folding = 0
scriptencoding utf-8
" vim setting overrides
" Dustin Farris Nov 19 2011
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'scrooloose/nerdtree'
Bundle 'klen/python-mode'
Bundle 'pangloss/vim-javascript'
Bundle 'nono/vim-handlebars'
Bundle 'groenewege/vim-less'
Bundle 'altercation/vim-colors-solarized'
Bundle 'vim-ruby/vim-ruby'
Bundle 'tpope/vim-fugitive'
" NERDTree
map ;n :NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
syntax on
set bg=dark
" Enable filetype plugins
filetype plugin on
filetype indent on
" Tab settings
set ts=8
set shiftwidth=4
set expandtab
set softtabstop=4
set autoindent
" Turn off backups
set nobackup
set nowb
set noswapfile
" Sounds/errors
set noerrorbells
set novisualbell
set t_vb=
autocmd! GUIEnter * set vb t_vb=
" Searching
set ignorecase
set smartcase
set incsearch
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Wild
set wildmenu
set wildignore=*.o,*~,*.pyc
" Misc
set encoding=utf8 " Set UTF8 encoding
set ruler " Enable ruler
set autoread " Silently reload a file if modified externally
set showmatch " Show matching brackets when cursor is over them
set mat=2 " Show matching brackets for 200ms
set encoding=utf8 " Set encoding
set modeline " Honor mode lines
set cmdheight=2 " Height of the command bar
set autoread " Detect when a file is changed outside
set path=.,**,, " Set path to recurisvely include working dir
set nu " Show line numbers
" Django template syntax highlighting
autocmd FileType html setfiletype htmldjango
" Better frame movement
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Delete trailing white-space (for Python)
function! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
" Special files
au FileType python syn keyword pythonDecorator True None False self
au BufRead,BufNewFile *.handlebars,*.hbs set ft=html syntax=handlebars
autocmd BufEnter,BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class shiftwidth=4 softtabstop=4
autocmd BufEnter,BufRead *.rb,*.html,*.haml,*.js,*.coffee,*.less,*.css,*.sass set shiftwidth=2 softtabstop=2
augroup vimrc_autocmds
autocmd!
" highlight characters past column 120
autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType python match Excess /\%120v.*/
autocmd FileType python set nowrap
augroup END
" Fugitive
map ;gs :Gstatus<CR>
map ;gc :Gcommit<CR>
map ;gw :Gwrite<CR>
" Shell commands
map ;m :!make test<CR> " Run all tests
map ;t :!py.test %<CR> " Run tests in current buffer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment