Skip to content

Instantly share code, notes, and snippets.

Created January 8, 2014 03:19
Show Gist options
  • Save erikhazzard/8311228 to your computer and use it in GitHub Desktop.
Save erikhazzard/8311228 to your computer and use it in GitHub Desktop.
set encoding=utf-8
set nocompatible
syntax on
set mouse=a
set selectmode=mouse
set et
set sw=4
set smarttab
set tabstop=4
set expandtab
set shiftwidth=4
set hls
"allow backspacing over everything in insert mode
set backspace=indent,eol,start
behave xterm
filetype plugin on
filetype plugin indent on
let g:tex_flavor='latex'
set clipboard=unnamed
set background=dark
"set background=light
colorscheme ir_black
"colorscheme solarized
set cursorline
set incsearch
set hlsearch " highlight search terms
set linespace=0
"Line numbers
set number
highlight lineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=DarkCyan gui=NONE guibg=NONE
set numberwidth=4
set colorcolumn=81
"Status stuff
set laststatus=2
set ruler
set title
"Status displays
set showmode
set showcmd
set showmatch
""Highlight after 80
"match ErrorMsg '\%>80v.\+'
set smartindent
set autoindent
filetype indent on
au FileType python source ~/.vim/syntax/python.vim
au FileType css source ~/.vim/syntax/css.vim
au FileType javascript source ~/.vim/syntax/javascript.vim
"set foldmethod=indent
"set foldcolumn=2
" Space will toggle folds
nnoremap <space> za
" Set page up pagedown for k /j
nnoremap <C-j> <PageDown>
nnoremap <C-k> <PageUp>
"nnoremap <F6> .!pbcopy<CR><CR>
nmap <F6> :.w !pbcopy<CR><CR>
"File tree
"Map F3 to open tag list
map <F3> :NERDTree<cr>
"Tab completion (for filenames and whatnot)
set wildmenu
set wildmode=list:longest,full
"Remove _ from keyword list
set iskeyword-=_
"Save Backups to a Different Location
" (These directories must be manually created)
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
"set directory=.,$TEMP
call pathogen#infect()
"Auto commands
"autocmd BufRead,BufNewFile *.py syntax on
autocmd BufRead,BufNewFile *.py set ai
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
"Remember last position in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
"Coffee script stuff
"Set spaces
au BufNewFile,BufReadPost *.coffee setl shiftwidth=4 expandtab
"Fold by indentation
au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
au BufNewFile,BufRead *.less let &filetype='css'
"au BufNewFile,BufRead *.server let &filetype='javascript'
"au BufWritePost *.coffee silent CoffeeMake! -b | cwindow 5 | redraw!
au BufRead,BufNewFile *.handlebars,*.hbs set ft=handlebars
"Javascript stuff
" Fold markers
au FileType javascript setlocal foldmethod=marker
au FileType javascript setlocal foldmarker={,}
vnoremap <silent> * :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
vnoremap <silent> # :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
"set virtualedit=onemore " allow for cursor beyond last character
set history=400 " Store a ton of history (default is 20)
"set spell " spell checking on
"Command and status line
set ruler " show the ruler
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids
set showcmd " show partial commands in status line and
" selected characters/lines in visual mode
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " filetype
set statusline+=\ [%{getcwd()}] " current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
"The default leader is '\', but many people prefer ',' as it's in a standard
"location. To override this behavior and set it back to '\' (or any other
"character) add let g:spf13_leader='\' in your .vimrc.bundles.local file
let mapleader = ','
"clearing highlighted search
nmap <silent> <leader>/ :nohlsearch<CR>
""" Code folding options
nmap <leader>f0 :set foldlevel=0<CR>
nmap <leader>f1 :set foldlevel=1<CR>
nmap <leader>f2 :set foldlevel=2<CR>
nmap <leader>f3 :set foldlevel=3<CR>
nmap <leader>f4 :set foldlevel=4<CR>
nmap <leader>f5 :set foldlevel=5<CR>
nmap <leader>f6 :set foldlevel=6<CR>
nmap <leader>f7 :set foldlevel=7<CR>
nmap <leader>f8 :set foldlevel=8<CR>
nmap <leader>f9 :set foldlevel=9<CR>
" Buffer explorer {
nmap <leader>b :BufExplorer<CR>
" }
set listchars=tab:,.,trail:.,extends:#,nbsp:. " Highlight problematic whitespace
" Fugitive {
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
" TagBar {
nnoremap <silent> <leader>tt :TagbarToggle<CR>
"Coffee tags
if executable('coffeetags')
let g:tagbar_type_coffee = {
\ 'ctagsbin' : 'coffeetags',
\ 'ctagsargs' : '',
\ 'kinds' : [
\ 'f:functions',
\ 'o:object',
\ ],
\ 'sro' : ".",
\ 'kind2scope' : {
\ 'f' : 'object',
\ 'o' : 'object',
\ }
\ }
"Indent Guides
" indent_guides {
"set guifont=Source\ Code\ Pro\ for\ Powerline:h14
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#212121 ctermbg=3
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#404040 ctermbg=4
set ts=4 sw=4 et
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
let g:indent_guides_enable_on_vim_startup = 1
" }
"POWERLINE settings
let g:Powerline_symbols = 'fancy'
set rtp+=~/.vim/bundle/powerline/powerline/bindings/vim
map <leader>l :ListMethods
map <leader>do :exec("CocoaDoc ".expand("<cword>"))<CR>
"set tabstop=2
"set shiftwidth=2
"set expandtab
let @w = ':%s/"{/{/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment