set nocompatible " required filetype off " required """" VIM-PLUG call plug#begin('~/.vim/plugged') Plug 'tpope/vim-sensible' Plug 'nanotech/jellybeans.vim' Plug 'bling/vim-airline' Plug 'bling/vim-bufferline' Plug 'myusuf3/numbers.vim' Plug 'mhinz/vim-signify' Plug 'nathanaelkane/vim-indent-guides' Plug 'danro/rename.vim' Plug 'pbrisbin/vim-mkdir' Plug 'Lokaltog/vim-easymotion' Plug 'tpope/vim-characterize' Plug 'tpope/vim-surround' Plug 'tpope/vim-commentary' Plug 'terryma/vim-multiple-cursors' Plug 'tpope/vim-eunuch' Plug 'majutsushi/tagbar' Plug 'SirVer/ultisnips' Plug 'tpope/vim-fugitive' Plug 'gregsexton/gitv' Plug 'tpope/vim-vinegar' Plug 'ctrlpvim/ctrlp.vim' Plug 'simnalamburt/vim-mundo' Plug 'vim-ruby/vim-ruby' Plug 'tpope/vim-rails' Plug 'janko-m/vim-test' Plug 'tpope/vim-endwise' Plug 'benekastah/neomake' Plug 'Valloric/YouCompleteMe' Plug 'kchmck/vim-coffee-script' Plug 'mtscout6/vim-cjsx' call plug#end() filetype plugin indent on " required """ end vundle """" PLUGIN SETTINGS " YouCompleteMe nnoremap K :YcmCompleter GoTo nnoremap ˚ :YcmCompleter GoToDeclaration let g:ycm_goto_buffer_command = 'horizontal-split' let g:ycm_autoclose_preview_window_after_insertion = 1 " Easymotion map / (easymotion-sn) omap / (easymotion-tn) map n (easymotion-next) map N (easymotion-prev) let g:EasyMotion_landing_highlight = 0 " CtrlP " Use The Silver Searcher https://github.com/ggreer/the_silver_searcher if executable('ag') " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' " ag is fast enough that CtrlP doesn't need to cache let g:ctrlp_use_caching = 0 endif " Gundo map u :GundoToggle " Indent guides let g:indent_guides_start_level = 2 " Syntastic let g:syntastic_quiet_messages = {'level': []} " do NOT silence warnings let g:syntastic_aggregate_errors = 1 " Neomake autocmd! BufWritePost * Neomake " NERDTree let NERDTreeHijackNetrw = 1 let g:netrw_liststyle = 3 " let netrw look like NERDTree " Vim-Test nmap t :TestNearest nmap T :TestFile nmap a :TestSuite nmap l :TestLast nmap g :TestVisit """" END PLUGIN SETTINGS let mapleader="," set nobackup set noswapfile set pastetoggle= filetype on filetype plugin indent on syntax on try colorscheme jellybeans catch " deal with it endtry set t_Co=256 if &term =~ 'xterm-color' set t_ut= endif set nocompatible set laststatus=2 if v:version >= 703 "undo settings set undodir=~/.vim/undofiles set undofile let &colorcolumn="80,".join(range(120,999), ",") endif set hidden set showmode set number set numberwidth=1 set background=dark set cursorline set cursorcolumn set ruler " do not redraw while macroing set lazyredraw set matchpairs+=<:> set list set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$ set ts=2 set shiftwidth=2 set expandtab " Open new split panes to right and bottom, which feels more natural set splitbelow set splitright " Use the OS clipboard by default (on versions compiled with `+clipboard`) set clipboard=unnamed """ Searching and Patterns set ignorecase set smartcase set smarttab set hlsearch " Add the g flag to search/replace by default set gdefault """ Folding set nofoldenable "recalculate the trailing whitespace warning when idle, and after saving autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning "return '[\s]' if trailing white space is detected return '' otherwise function! StatuslineTrailingSpaceWarning() if !exists("b:statusline_trailing_space_warning") if !&modifiable let b:statusline_trailing_space_warning = '' return b:statusline_trailing_space_warning endif if search('\s\+$', 'nw') != 0 let b:statusline_trailing_space_warning = '[\s]' else let b:statusline_trailing_space_warning = '' endif endif return b:statusline_trailing_space_warning endfunction """ Handy remaps noremap ; : inoremap jj map V :source ~/.vimrc:filetype detect:exe ":echo 'vimrc reloaded'" map \q :q map \w :w noremap Q "terminal remaps if has('nvim') tnoremap endif " Quicker window movement nnoremap j nnoremap k nnoremap h nnoremap l " Don’t reset cursor to start of line when moving around. set nostartofline " minimal number of lines to keep above/below cursorline set scrolloff=10 """ Use the mouse set mouse=a """ smart path set path=.,,** command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand() function! s:RunShellCommand(cmdline) echo a:cmdline let expanded_cmdline = a:cmdline for part in split(a:cmdline, ' ') if part[0] =~ '\v[%#<]' let expanded_part = fnameescape(expand(part)) let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') endif endfor botright new setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap call setline(1, 'You entered: ' . a:cmdline) call setline(2, 'Expanded Form: ' .expanded_cmdline) call setline(3,substitute(getline(2),'.','=','g')) execute '$read !'. expanded_cmdline setlocal nomodifiable 1 endfunction function! MoveToPrevTab() "there is only one window if tabpagenr('$') == 1 && winnr('$') == 1 return endif "preparing new window let l:tab_nr = tabpagenr('$') let l:cur_buf = bufnr('%') if tabpagenr() != 1 close! if l:tab_nr == tabpagenr('$') tabprev endif sp else close! exe "0tabnew" endif "opening current buffer in new window exe "b".l:cur_buf endfunc function! MoveToNextTab() "there is only one window if tabpagenr('$') == 1 && winnr('$') == 1 return endif "preparing new window let l:tab_nr = tabpagenr('$') let l:cur_buf = bufnr('%') if tabpagenr() < tab_nr close! if l:tab_nr == tabpagenr('$') tabnext endif sp else close! tabnew endif "opening current buffer in new window exe "b".l:cur_buf endfunc " Local overrides? if filereadable($HOME . "/.vimrc.local") source ~/.vimrc.local endif