Skip to content

Instantly share code, notes, and snippets.

@jancuk
Created January 18, 2016 17:28
Show Gist options
  • Save jancuk/84070bac9a87cbeaad62 to your computer and use it in GitHub Desktop.
Save jancuk/84070bac9a87cbeaad62 to your computer and use it in GitHub Desktop.
config vim
" Plugins are managed by Vundle. Once VIM is open run :BundleInstall to
" install plugins.
" Plugins requiring no additional configuration or keymaps
Bundle "git://github.com/tpope/vim-git.git"
Bundle "git://github.com/altercation/vim-colors-solarized.git"
Bundle "git://github.com/tpope/vim-endwise.git"
Bundle "git://github.com/tpope/vim-fugitive.git"
Bundle "git://github.com/tpope/vim-haml.git"
Bundle "git://github.com/pangloss/vim-javascript.git"
Bundle "git://github.com/vim-scripts/L9.git"
Bundle "git://github.com/tpope/vim-rake.git"
Bundle "git://github.com/vim-ruby/vim-ruby.git"
Bundle "git://github.com/ervandew/supertab.git"
Bundle "git://github.com/tomtom/tcomment_vim.git"
Bundle "git://github.com/michaeljsmith/vim-indent-object.git"
Bundle "git://github.com/kana/vim-textobj-user.git"
Bundle "git://github.com/nelstrom/vim-textobj-rubyblock.git"
Bundle "git://github.com/tpope/vim-repeat.git"
Bundle "git://github.com/vim-scripts/ruby-matchit.git"
Bundle "git://github.com/wavded/vim-stylus.git"
Bundle "git://github.com/tpope/vim-abolish"
Bundle "git://github.com/majutsushi/tagbar"
Bundle "git://github.com/airblade/vim-gitgutter"
Bundle "git://github.com/jeetsukumaran/vim-buffergator"
Bundle "git://github.com/terryma/vim-multiple-cursors"
Bundle "git://github.com/docunext/closetag.vim"
Bundle "git://github.com/scrooloose/nerdcommenter"
Bundle "git://github.com/t9md/vim-choosewin"
Bundle "git://github.com/klen/python-mode"
Bundle "git://github.com/fatih/vim-go"
Bundle "git://github.com/derekwyatt/vim-scala"
Bundle "git://github.com/mattn/emmet-vim"
" Promptline
Bundle "git://github.com/edkolev/promptline.vim"
" " Powerline
Bundle "git://github.com/bling/vim-airline"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
" CtrlP
Bundle "git://github.com/kien/ctrlp.vim.git"
" respect the .gitignore
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others']
" Coffee script
Bundle "git://github.com/kchmck/vim-coffee-script.git"
au BufNewFile,BufRead *.coffee set filetype=coffee
" AG aka The Silver Searcher
Bundle 'git://github.com/rking/ag.vim.git'
nmap g/ :Ag!<space>
nmap g* :Ag! -w <C-R><C-W><space>
nmap ga :AgAdd!<space>
nmap gn :cnext<CR>
nmap gp :cprev<CR>
nmap gq :ccl<CR>
nmap gl :cwindow<CR>
" NERDTree for project drawer
Bundle "git://github.com/scrooloose/nerdtree.git"
let NERDTreeHijackNetrw = 0
nmap g :NERDTree \| NERDTreeToggle \| NERDTreeFind<CR>
" Tabular for aligning text
Bundle "git://github.com/godlygeek/tabular.git"
function! CustomTabularPatterns()
if exists('g:tabular_loaded')
AddTabularPattern! symbols / :/l0
AddTabularPattern! hash /^[^>]*\zs=>/
AddTabularPattern! chunks / \S\+/l0
AddTabularPattern! assignment / = /l0
AddTabularPattern! comma /^[^,]*,/l1
AddTabularPattern! colon /:\zs /l0
AddTabularPattern! options_hashes /:\w\+ =>/
endif
endfunction
autocmd VimEnter * call CustomTabularPatterns()
" shortcut to align text with Tabular
map <Leader>a :Tabularize<space>
" ZoomWin to fullscreen a particular buffer without losing others
Bundle "git://github.com/vim-scripts/ZoomWin.git"
map <Leader>z :ZoomWin<CR>
" Syntastic for catching syntax errors on save
Bundle "git://github.com/scrooloose/syntastic.git"
let g:syntastic_enable_signs=1
let g:syntastic_quiet_messages={'level': 'warnings'}
" syntastic is too slow for haml and sass
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['haml','scss','sass'] }
" gundo for awesome undo tree visualization
Bundle "git://github.com/sjl/gundo.vim.git"
map <Leader>h :GundoToggle<CR>
" rails.vim, nuff' said
Bundle "git://github.com/tpope/vim-rails.git"
" You can set these mappings, but they're really not _that_ useful...
" map <Leader>oc :Rcontroller<Space>
" map <Leader>ov :Rview<Space>
" map <Leader>om :Rmodel<Space>
" map <Leader>oh :Rhelper<Space>
" map <Leader>oj :Rjavascript<Space>
" map <Leader>os :Rstylesheet<Space>
" map <Leader>oi :Rintegration<Space>
" surround for adding surround 'physics'
Bundle "git://github.com/tpope/vim-surround.git"
" # to surround with ruby string interpolation
let g:surround_35 = "#{\r}"
" - to surround with no-output erb tag
let g:surround_45 = "<% \r %>"
" = to surround with output erb tag
let g:surround_61 = "<%= \r %>"
" Refactoring
Bundle "https://github.com/ecomba/vim-ruby-refactoring"
" Easy RSpec running
Bundle 'thoughtbot/vim-rspec'
" Not using Tmux? Use this command...
" let g:rspec_command = "!spring rspec --no-profile {spec}"
" Using Tmux and Vimux? Use this command...
let g:rspec_command = 'call VimuxRunCommand("spring rspec {spec}\n")'
nmap <Leader>rf :wa<CR> :call RunCurrentSpecFile()<CR>
nmap <Leader>rn :wa<CR>:call RunNearestSpec()<CR>
nmap <Leader>rl :wa<CR> :call RunLastSpec()<CR>
nmap <Leader>ra :wa<CR> :call RunAllSpecs()<CR>
nmap <C-\>:wa<CR> :call RunLastSpec()<CR>
" Tmux integration
Bundle 'benmills/vimux'
nmap <Leader>vi :VimuxInspectRunner<CR>
nmap <Leader>vv :call VimuxZoomRunner()<CR>
" this function will zoom the vimux pane
function! VimuxZoomRunner()
call VimuxInspectRunner()
call system("tmux resize-pane -Z")
endfunction
Bundle 'christoomey/vim-tmux-navigator'
" In Tmux Set the cursor to a vertical line in insert mode and a solid block in command mode
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
" Upon hitting escape to change modes, send successive move-left and move-right commands to immediately redraw the cursor
inoremap <special> <Esc> <Esc>hl
" don't blink the cursor
set guicursor+=i:blinkwait0
endif
" Drag visual selections easily
Bundle 'gavinbeatty/dragvisuals.vim'
vmap <expr> H DVB_Drag('left')
vmap <expr> L DVB_Drag('right')
vmap <expr> J DVB_Drag('down')
vmap <expr> K DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
" Remove any introduced trailing whitespace after moving...
let g:DVB_TrimWS = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment