# HG changeset patch # User Steve Losh # Date 1289944980 18000 # Node ID 16e895088b8838c648b3ede15dae67420756364d # Parent d06b84e6f55f55cc4d2aaae7c821431c987cba18 vim: kill makegreen diff -r d06b84e6f55f -r 16e895088b88 vim/.vimrc --- a/vim/.vimrc Tue Nov 16 17:02:06 2010 -0500 +++ b/vim/.vimrc Tue Nov 16 17:03:00 2010 -0500 @@ -167,7 +167,6 @@ au BufNewFile,BufRead test_*.py set makeprg=nosetests\ --machine-out\ --nocapture au BufNewFile,BufRead test_*.py set shellpipe=2>&1\ >/dev/null\ \|\ tee au BufNewFile,BufRead test_*.py set errorformat=%f:%l:\ %m -au BufNewFile,BufRead test_*.py nmap n MakeGreen au BufNewFile,BufRead test_*.py nmap N :make nmap ff :QFix nmap fn :cn diff -r d06b84e6f55f -r 16e895088b88 vim/bundle/makegreen/README.md --- a/vim/bundle/makegreen/README.md Tue Nov 16 17:02:06 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -vim-MakeGreen -============= - -makegreen.vim is a vim (http://www.vim.org) plugin that runs make and shows the -test run status with a red or green bar. - -Installation ------------- - -Copy all files to your ~/.vim directory or use Tim Pope's excellent pathogen plugin (http://github.com/tpope/vim-pathogen). - -Usage ------ - -<Leader>t will run make for the current file and show its status with a red or green message bar. - -example: - - $ cd - $ vim test/unit/user_test.rb - - :compiler rubyunit - press t - -(<Leader> is mapped to '\' by default) - - -Default Key Bindings --------------------- - -<Leader>t: run make and show red/green bar - -You can change default key bindings: - - map ] MakeGreen " change from t to ] - -Configuring Vim's Makeprg -------------------------- - -MakeGreen expects your make program to accept the current file name as its -argument. Specifically, if `:make %` works, MakeGreen will work. - -Using Compilers ---------------- - -The easiest way to use MakeGreen is with compilers. For instance, vim's ruby -configuration files provide an rspec compiler that sets makeprg and errorformat -appropriately for running specs and parsing their output. - -You can tell vim to use the rspec compiler for all *_spec.rb files by adding -this line to your vimrc: - - autocmd BufNewFile,BufRead *_spec.rb compiler rspec - -Then `:make %` (make current file) and MakeGreen will work automatically when -you are in a spec. - -Credits -------- - -- Based on code from the rubytest.vim plugin - (http://github.com/reinh/vim-rubytest) but considerably refactored and - modified for this more specific purpose. - -- Red/Green bar code borrowed from Gary Bernhardt - (http://bitbucket.org/garybernhardt/dotfiles/src/tip/.vimrc) and slightly - modified for my use. Please do check out Gary's coding videos on his blog - for more awesome vim usage (http://blog.extracheese.org/). - -- elik and godlygeek in #vim on irc.freenode.net for vim help - -- Jim Remsik (@jremsikjr on twitter) for debugging and typo fixing. diff -r d06b84e6f55f -r 16e895088b88 vim/bundle/makegreen/plugin/makegreen.vim --- a/vim/bundle/makegreen/plugin/makegreen.vim Tue Nov 16 17:02:06 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -" plugin/makegreen.vim -" Author: Rein Henrichs -" License: MIT License - -" Install this file as plugin/makegreen.vim. - -" ============================================================================ - -" Exit quickly when: -" - this plugin was already loaded (or disabled) -" - when 'compatible' is set -if &cp || exists("g:makegreen_loaded") && g:makegreen_loaded - finish -endif -let g:makegreen_loaded = 1 - -let s:save_cpo = &cpo -set cpo&vim - -function s:RunMake() "{{{1 - silent! w - let s:old_sp = &shellpipe - "set shellpipe=> "quieter make output - silent! make % - let &shellpipe = s:old_sp - - redraw! - - let error = s:GetFirstError() - if error != '' - call s:Bar("red", error) - else - call s:Bar("green","All tests passed") - endif -endfunction -"}}}1 -" Utility Functions" {{{1 -function s:GetFirstError() - if getqflist() == [] - return '' - endif - - for error in getqflist() - if error['valid'] - break - endif - endfor - let error_message = substitute(error['text'], '^ *', '', 'g') - let error_message = substitute(error_message, "\n", ' ', 'g') - let error_message = substitute(error_message, " *", ' ', 'g') - return error_message -endfunction - -function s:Bar(type, msg) - hi GreenBar term=reverse ctermfg=black ctermbg=green guifg=white guibg=green - hi RedBar term=reverse ctermfg=white ctermbg=red guifg=white guibg=red - if a:type == "red" - echohl RedBar - else - echohl GreenBar - endif - echon a:msg repeat(" ", &columns - strlen(a:msg)) - echohl None -endfunction - -" }}}1 -" Mappings" {{{1 - -noremap