" this isn't vi and apparently needs to be first? set nocompatible " pathogen call pathogen#infect() " shift O delay after insert mode? fuuuuu set timeout timeoutlen=3000 ttimeoutlen=100 " copypaste set pastetoggle= " filetype stuff syntax on filetype plugin indent on " TODO: understand this " something about background buffers " set hidden " never forget set history=1000 " all the cool kids do this let mapleader = "," " some giant companies with robots hate this set colorcolumn=80 " what the fuck is ex mode? map Q " Thank god this exists - jake! cabbrev W w cabbrev Q q cabbrev Wq wq cabbrev WQ wq " bash like completion set wildmenu set wildmode=list:longest " numbers and stuff set number set numberwidth=4 set ruler set nowrap " intuitive (not broken) backspacing in insert mode set backspace=indent,eol,start " highlight search terms set hlsearch set incsearch " ...dynamically as they are typed. " Make searches case-sensitive only if they contain upper-case characters set ignorecase set smartcase " colors! set t_Co=256 set background=dark "colorscheme solarized "colorscheme base16-default "colorscheme spacedust "colorscheme ir_black "colorscheme eddie "colorscheme vividchalk "colorscheme jellybeans "colorscheme molokai " macvim if has("gui_running") set guioptions-=e set guioptions-=r set guioptions-=L set guioptions-=T set guifont=Inconsolata-dz:h12 " set guifont=Menlo:h12 else colorscheme jellybeans end " splits as dashes :hi VertSplit ctermbg=NONE guibg=NONE " always show tab bar set showtabline=2 " temporary files in a central spot " or just don't make them set nobackup set nowritebackup set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp " GRB: sane editing configuration" set expandtab set tabstop=4 set shiftwidth=4 "set softtabstop=4 set autoindent " set smartindent - what is this? set laststatus=2 set showmatch " GRB: Put useful info in status line set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%) hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red " two spaces au BufNewFile,BufRead Podfile,*.podspec set filetype=ruby autocmd FileType coffee,Rakefile,ruby,haml,eruby,yaml,html,css,htmldjango,javascript,sass,cucumber set ai sw=2 sts=2 et " jump between files nnoremap " ctrlp plugin nnoremap t :CtrlP nnoremap T :ClearCtrlPCache\|:CtrlP let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/](node_modules)$', \ } " show more than 10 let g:ctrlp_max_height = 35 " kill whitespace - does this work? " :nnoremap :let _s=@/:%s/\s\+$//e:let @/=_s:nohl " clear the search buffer when hitting return :nnoremap :nohlsearch " no. map :echo "no!" map :echo "no!" map :echo "no!" map :echo "no!" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MULTIPURPOSE TAB KEY " Indent if we're at the beginning of a line. Else, do completion. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" function! InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\" else return "\" endif endfunction inoremap =InsertTabWrapper() inoremap """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " RUNNING TESTS """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " function! MapCR() " nnoremap :call RunTestFile() " endfunction " call MapCR() " nnoremap T :call RunNearestTest() " nnoremap a :call RunTests('') " " nnoremap c :w\|:!script/features " " nnoremap w :w\|:!script/features --profile wip " function! RunTestFile(...) " if a:0 " let command_suffix = a:1 " else " let command_suffix = "" " endif " " Run the tests for the previously-marked file. " let in_test_file = match(expand("%"), '\(.feature\|Spec.js|_spec.rb\|_test.py\)$') != -1 " if in_test_file " call SetTestFile(command_suffix) " elseif !exists("t:grb_test_file") " return " end " call RunTests(t:grb_test_file . command_suffix) " endfunction " function! RunNearestTest() " let spec_line_number = line('.') " call RunTestFile(":" . spec_line_number) " endfunction " function! SetTestFile(command_suffix) " " Set the spec file that tests will be run for. " echo "setting test file" " let t:grb_test_file=@% . a:command_suffix " endfunction " function! RunTests(filename) " " Write the file and run tests for the given filename " if expand("%") != "" " :w " end " if match(a:filename, '\.feature$') != -1 " exec ":!script/features " . a:filename " else " " First choice: project-specific test script " if filereadable("script/test") " exec ":!script/test " . a:filename " " Fall back to the .test-commands pipe if available, assuming someone " " is reading the other side and running the commands " elseif filewritable(".test-commands") " let cmd = 'rspec --color --format progress --require "~/lib/vim_rspec_formatter" --format VimFormatter --out tmp/quickfix' " exec ":!echo " . cmd . " " . a:filename . " > .test-commands" " " Write an empty string to block until the command completes " sleep 100m " milliseconds " :!echo > .test-commands " redraw! " " Fall back to a blocking test run with Bundler " elseif filereadable("Gemfile") " exec ":!bundle exec rspec --color " . a:filename " " If we see python-looking tests, assume they should be run with Nose " elseif strlen(glob("test/**/*.py") . glob("tests/**/*.py")) " exec "!nosetests " . a:filename " " If we see javascript-looking tests, assume they should be run with Mocha " elseif strlen(glob("test/**/*.js") . glob("tests/**/*.js") . glob("spec/**/*.js")) " exec "!mocha " . a:filename " " Fall back to a normal blocking test run " else " exec ":!rspec --color " . a:filename " end " end " endfunction " Move around splits with nnoremap j nnoremap k nnoremap h nnoremap l " NERDTree map :NERDTreeToggle " STFU set noerrorbells visualbell t_vb= autocmd GUIEnter * set visualbell t_vb= " surround in quotes :nnoremap " viwa"hbi"lel " move to the beginning of the line :nnoremap H 0 " move to the end of the line :nnoremap L $ " open vimrc in vertical split :nnoremap ev :vsplit $MYVIMRC " source vimrc :nnoremap sv :source $MYVIMRC " hmm k :inoremap jk " :inoremap " python test running for a project " better way to do this on a per project basis? " map a :w\|!python test_runner.py " run ruby " map f :w\|!ruby % " run current file as bundle exec rspec " map r :w\|!bundle exec rspec --no-color % " run current file as python " map r :w\|!python % " run current file as javascript map r :w\|!node %