Skip to content

Instantly share code, notes, and snippets.

@lattwood
Created September 26, 2014 17:17
Show Gist options
  • Save lattwood/5c81024f0bb70a649526 to your computer and use it in GitHub Desktop.
Save lattwood/5c81024f0bb70a649526 to your computer and use it in GitHub Desktop.
" vim exits with non-zero sometimes, thanks to pathogen.
filetype indent plugin on
call pathogen#infect()
call pathogen#helptags()
syntax on
let mapleader=","
if has("autocmd")
filetype plugin indent on
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
endif
filetype off
filetype plugin indent off
filetype plugin indent on
syntax on
set t_Co=256
set background=dark
colorscheme hybrid
" When I want to change thing
nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr>
" SLIME
let g:slime_target = "tmux"
au BufRead,BufNewFile todo.txt,done.txt set filetype=todo
" read our profile for $PATH and other environment vairables
silent !source ~/.zsh.d/env/01-path.zsh
set encoding=utf-8
nnoremap <Leader><Space> za
vnoremap <Leader><Space> zf
" Spelling (useful for documentation/commits)
nnoremap <Leader>s :setlocal spell! spell?<cr>
nnoremap <Leader>f :setlocal foldenable! foldenable?<cr>
nnoremap <Leader>qc :cclose <bar> :lclose<cr>
set wildmenu
set wildmode=list:longest,full
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ruler
set showmode
set laststatus=2
set statusline=%f\ %m%h%r%w\ %y\ %{fugitive#statusline()}%=\ B%3n\ ·\ L%5l/%5L\ ·\ C%7(%c%V%)\ ·\ %4(0x%B%)\ ·\ %P
set incsearch " Incremental search
set nu
set preserveindent
set softtabstop=4
set shiftwidth=4
set tabstop=4
set ci
set copyindent " Preserve vertical alignment when indenting
set autoindent tabstop=4 shiftwidth=4
set colorcolumn=81 " Highlight long lines
set hlsearch
set hidden
set title
set autoread
set so=7
set nobackup
set nowb
match ErrorMsg '\%>80v.\+'
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" per-project .vimrc
set exrc
" "fix" regex
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
" "fix" backspace
set backspace=2
set nocompatible
" MacVIM and gVIM options
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
set guifont=Meslo\ LG\ M\ DZ\ for\ Powerline:h14
if has("gui_macvim")
let macvim_hig_shift_movement = 1
set guioptions-=T
endif
else
set guifont=Ubuntu\ Mono\ for\ Powerline\ 12
endif
endif
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
" Enable omni completion. Not required if they are already set elsewhere in
" .vimrc
augroup vimrc_autocmd
" autocmd!
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete|set ts=2 sts=2 sw=2 et
autocmd FileType puppet setlocal tabstop=8 expandtab shiftwidth=2 softtabstop=2
augroup end
let g:sql_type_default = 'mysql'
" Helpers. Trailing space isn't a mistake
nnoremap <leader>a :Ack --ignore-dir=node_modules --ignore-dir=build --ignore-dir=vendor
nmap <leader>wt :tabclose<cr>
nmap <leader>nt :tabnew<cr>
nmap <leader><left> :tabprevious<cr>
nmap <leader><right> :tabnext<cr>
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let NERDTreeIgnore = ['\.pyc$', '^__pycache__$']
let g:syntastic_enable_signs=1
let g:syntastic_auto_loc_list=1
let g:syntastic_java_javac_config_file_enabled=1
let g:syntastic_aggregate_errors=1
let g:syntastic_python_checkers = ['pylint']
let g:syntastic_ruby_checkers = ['mri', 'rubocop']
let g:syntastic_javascript_checkers = ['jshint']
" NERDTree can be a little annoying
let g:nerdtree_tabs_open_on_gui_startup = 1
let g:nerdtree_tabs_open_on_new_tab = 1
" snipMate
let g:snips_email = 'logan@therounds.ca'
let g:snips_auth = 'Logan Attwood'
" YouCompleteMe
noremap <leader>jd YcmCompleter GoToDefinitionElseDeclaration
" Highlight trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
augroup vimrc_whitespace_autogroup
autocmd!
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
augroup end
map <F10> :NERDTreeToggle<cr>
imap <F10> :NERDTreeToggle<cr>
vmap <F10> :NERDTreeToggle<cr>
map <S-F10> :NERDTreeMirror<cr>
imap <S-F10> :NERDTreeMirror<cr>
vmap <S-F10> :NERDTreeMirror<cr>
map <F11> :NERDTreeFind<cr>
imap <F11> :NERDTreeFind<cr>
vmap <f11> :NERDTreeFind<cr>
nmap <F8> :TagbarToggle<CR>
imap <F8> :TagbarToggle<CR>
vmap <F8> :TagbarToggle<CR>
nnoremap <F5> :GundoToggle<CR>
inoremap <F5> :GundoToggle<CR>
vnoremap <F5> :GundoToggle<CR>
set noerrorbells
set vb
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR>
" Don't autoload/autosave sessions
let g:session_autosave = 'no'
let g:session_autoload = 'no'
if has("unix")
let s:uname = system("uname")
if s:uname == "Darwin\n"
map <D-1> 1gt
imap <D-1> 1gt
map <D-2> 2gt
imap <D-2> 2gt
map <D-3> 3gt
imap <D-3> 3gt
map <D-4> 4gt
imap <D-4> 4gt
map <D-5> 5gt
imap <D-5> 5gt
map <D-6> 6gt
imap <D-6> 6gt
map <D-7> 7gt
imap <D-7> 7gt
map <D-8> 8gt
imap <D-8> 8gt
map <D-9> 9gt
imap <D-9> 9gt
map <D-0> 10gt
imap <D-0> 10gt
endif
map <Esc>1 1gt
imap <Esc>1 1gt
map <Esc>2 2gt
imap <Esc>2 2gt
map <Esc>3 3gt
imap <Esc>3 3gt
map <Esc>4 4gt
imap <Esc>4 4gt
map <Esc>5 5gt
imap <Esc>5 5gt
map <Esc>6 6gt
imap <Esc>6 6gt
map <Esc>7 7gt
imap <Esc>7 7gt
map <Esc>8 8gt
imap <Esc>8 8gt
map <Esc>9 9gt
imap <Esc>9 9gt
map <Esc>0 10gt
imap <Esc>0 10gt
endif
let g:buffergator_viewport_split_policy = 'T'
let g:airline_powerline_fonts = 1
let g:airline_solarized_bg='dark'
let g:airline_theme='hybrid'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
" My preference with using buffers. See `:h hidden` for more details
set hidden
" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nmap <leader>T :enew<cr>
" Move to the next buffer
nmap <leader>l :bnext<CR>
" Move to the previous buffer
nmap <leader>h :bprevious<CR>
" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
if ! has('gui_running')
augroup FastEscape
au!
set notimeout
set ttimeout
set timeoutlen=10
au InsertEnter * set timeout
au InsertLeave * set notimeout
augroup END
endif
if &term =~ '^screen'
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
execute "set <xHome>=\e[1;*H"
execute "set <xEnd>=\e[1;*F"
execute "set <PageUp>=\e[5;*~"
execute "set <PageDown>=\e[6;*~"
execute "set <F1>=\eOP"
execute "set <F2>=\eOQ"
execute "set <F3>=\eOR"
execute "set <F4>=\eOS"
execute "set <xF1>=\eO1;*P"
execute "set <xF2>=\eO1;*Q"
execute "set <xF3>=\eO1;*R"
execute "set <xF4>=\eO1;*S"
execute "set <F5>=\e[15;*~"
execute "set <F6>=\e[17;*~"
execute "set <F7>=\e[18;*~"
execute "set <F8>=\e[19;*~"
execute "set <F9>=\e[20;*~"
execute "set <F10>=\e[21;*~"
execute "set <F11>=\e[23;*~"
execute "set <F12>=\e[24;*~"
endif
" Prompt for a command to run
map <Leader>vp :VimuxPromptCommand<CR>
" Run last command executed by VimuxRunCommand
map <Leader>vl :VimuxRunLastCommand<CR>
" Inspect runner pane
map <Leader>vi :VimuxInspectRunner<CR>
" Close vim tmux runner opened by VimuxRunCommand
map <Leader>vq :VimuxCloseRunner<CR>
" Interrupt any command running in the runner pane
map <Leader>vx :VimuxInterruptRunner<CR>
" Zoom the runner pane (use <bind-key> z to restore runner pane)
map <Leader>vz :call VimuxZoomRunner()<CR>
autocmd BufReadPre *.js let b:javascript_lib_use_jquery = 1
autocmd BufReadPre *.js let b:javascript_lib_use_underscore = 1
autocmd BufReadPre *.js let b:javascript_lib_use_backbone = 1
autocmd BufReadPre *.js let b:javascript_lib_use_requirejs = 1
set mouse+=a
if &term =~ '^screen'
" tmux knows the extended mouse mode. tmux knows.
set ttymouse=xterm2
set clipboard=unnamed
endif
" tern
let tern#is_show_argument_hints_enabled = 1
" golang stuff
let g:go_auto_type_info = 1
let g:go_highlight_operators = 1
let g:go_highlight_functions = 0
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment