set nocompatible " required filetype off " required """" VUNDLE " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " alternatively, pass a path where Vundle should install bundles "let path = '~/some/path/here' "call vundle#rc(path) " let Vundle manage Vundle, required Bundle 'gmarik/vundle' Bundle 'Lokaltog/vim-easymotion' Bundle 'tpope/vim-sensible' Bundle 'tpope/vim-eunuch' Bundle 'tpope/vim-fugitive' Bundle 'scrooloose/nerdtree' Bundle 'tomtom/tcomment_vim' Bundle 'tpope/vim-characterize' Bundle 'jonathanfilip/vim-lucius' Bundle 'nanotech/jellybeans.vim' Bundle 'majutsushi/tagbar' Bundle 'bling/vim-bufferline' Bundle 'sjl/gundo.vim' Bundle 'SirVer/ultisnips' Bundle 'kien/ctrlp.vim' Bundle 'terryma/vim-multiple-cursors' Bundle 'myusuf3/numbers.vim' Bundle 'mhinz/vim-signify' Bundle 'nathanaelkane/vim-indent-guides' Bundle 'tpope/vim-surround' Bundle 'scrooloose/syntastic' Bundle 'Valloric/YouCompleteMe' Bundle 'christoomey/vim-tmux-navigator' 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 " Syntastic let g:syntastic_python_checkers = ['pyflakes', 'pep8', 'pep257'] let g:syntastic_python_pep8_args='--ignore=E501' " Powerline! set rtp+=~/dotfiles/misc-files/powerline/powerline/bindings/vim " """ Easymotion map / (easymotion-sn) omap / (easymotion-tn) map n (easymotion-next) map N (easymotion-prev) let g:EasyMotion_landing_highlight = 1 """ CtrlP """ Gundo map u :GundoToggle """" END PLUGIN SETTINGS let mapleader="," set nobackup set noswapfile set pastetoggle= filetype on filetype plugin indent on syntax on try colorscheme lucius catch " deal with it endtry set t_Co=256 if &term =~ 'xterm-color' set t_ut= endif let g:Powerline_symbols = 'fancy' set nocompatible set laststatus=2 if v:version >= 703 "undo settings set undodir=~/.vim/undofiles set undofile set colorcolumn=+1 "mark the ideal max text width endif 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=4 " 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 nnoremap :TlistToggle map V :source ~/.vimrc:filetype detect:exe ":echo 'vimrc reloaded'" "nnoremap d :NERDTreeToggle map \q :q map \w :w noremap Q noremap b Oimport ipdb;ipdb.set_trace() " 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=.,,** " " Don't use tabs in python files autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4 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 function! RunTests(filename, test_path, debug) let tmux_pane = substitute(system("tmux display-message -p '#S'"),'\n','','') let tmux_pane_target = tmux_pane."_testing:1.0" echo tmux_pane_target let command = "" if l:tmux_pane == "checkout" " checkout uses py.test (or uh it will) if a:test_path != ' ' let pytest_path = substitute(a:test_path, "\\.", "::", "") let full_test_path = a:filename."::".l:pytest_path else let full_test_path = a:filename endif if a:debug == 1 let test_args = "-- -x --ipdb " else let test_args = '' endif if l:full_test_path != "::" let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' tox ".test_args.full_test_path." -- --currency USD 2>/dev/null' Enter" else let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' make test 2>/dev/null' Enter" endif else " yelp-main uses testify if a:test_path != ' ' let full_test_path = a:filename." ".a:test_path else let full_test_path = a:filename endif if a:debug == 1 let test_args = "-d " else let test_args = '' endif if l:full_test_path != " " let command = "silent !tmux send-keys -t ".tmux_pane_target." C-c ' testify ".test_args.full_test_path."' Enter" endif endif echo command exec command exec "redraw!" endfun function! StoreTestPath(filename, lineno) let g:t= a:filename " trololol sorry hbai let g:f = system("python ~hbai/point_at_test/point_at_test.py ".shellescape(a:filename)." ".shellescape(a:lineno)) let g:f=substitute(strtrans(g:f),'\^@',' ','g') echo g:t g:f endfun map s :call StoreTestPath(expand("%"), line(".")) map T :w\|:call StoreTestPath(expand("%"), line("."))\|:call RunTests(g:t, g:f, 0) map t :w\|:call RunTests(g:t, g:f, 0) map dt :w\|:call RunTests(g:t, g:f, 1) map m :call RunTests("", "", 0)