# HG changeset patch # User Mahlon E. Smith # Date 1452973159 28800 # Node ID cc3094023778f5489dc50ac0b7dbdc3159c82850 # Parent 2b198f0a86fe788de47c7454b89e03f8ec4300f3 Split vim projects into separate repos. diff -r 2b198f0a86fe -r cc3094023778 hgrev/Makefile --- a/hgrev/Makefile Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -PLUGIN = hgrev - -SOURCE = plugin/hgrev.vim -SOURCE += doc/hgrev.txt - -${PLUGIN}.vba: ${SOURCE} - - vim --cmd 'let g:plugin_name="${PLUGIN}"' -S build.vim -cq\! - gzip ${PLUGIN}.vba - -install: - rsync -Rv ${SOURCE} ${HOME}/.vim/ - -clean: - rm ${PLUGIN}.vba.gz diff -r 2b198f0a86fe -r cc3094023778 hgrev/build.vim --- a/hgrev/build.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -let g:vimball_home="." -e Makefile -%!grep ^SOURCE -%s/^SOURCE\s\++\?=\s\+// -execute '%MkVimball!' . g:plugin_name diff -r 2b198f0a86fe -r cc3094023778 hgrev/doc/hgrev.txt --- a/hgrev/doc/hgrev.txt Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -*hgrev.txt* Last change: $Id$ - - VIM REFERENCE MANUAL by Mahlon E. Smith - - - HGRev - -A simple plugin for showing the current buffer's HG revision *HGRev* -============================================================================== -CONTENTS *HGRevContents* - - - 1) Intro........................................|HGRevIntro| - 2) Configuration................................|HGRevOptions| - 2.1) Altering revision info shown...........|g:hgrevFlags| - 2.2) Appending file status info.............|g:hgrevAddStatus| - 2.3) Automatically updating status..........|g:hgrevAutoUpdate| - 2.4) Changing non-repo buffer behavior......|g:hgrevNoRepoChar| - 3) Author.......................................|HGRevAuthor| - 4) License......................................|HGRevLicense| - - - -============================================================================== -1. INTRO *HGRevIntro* - -HGRev is a small plugin that can find the current buffer's revision ID from a -Mercurial repository. For more information on Mercurial, see: - - http://mercurial.selenic.com/ - -It is intended for use in the |statusline|- here's an example to enable it: - - set statusline=[r%{HGRev()}] ~ - -HGRev exports the 'HGRev()' function (for use in the statusline), and a -command called -> - :RefreshMercurialRev - -Which you can use to manually update the revision information for the current -buffer. If you've added HGRev() to your statusline, you'll see the file -revision, branch, tags, and file status reflected -- if you used the -statusline example above, you should see something like this: - - [r192+ default tip M] ~ - -The information displayed can be easily customized, and HGRev can also -automatically update the status line on file changes. (This behavior is -disabled by default.) - - -============================================================================== -2. CONFIGURATION-OPTIONS *HGRevOptions* - -Here are the available configuration options and their defaults: -> - let g:hgrevFlags = '-nbt' - let g:hgrevAddStatus = 1 - let g:hgrevAutoUpdate = 0 - let g:hgrevNoRepoChar = '-' - - ------------------------------------------------------------------------------- -2.1 *g:hgrevFlags* - -These are the flags passed directly to 'hg id'. The flags "-nbt" are passed -by default, which show a local rev id, branch, and tags. - -If you wanted to show the global rev hash (and nothing else) as an example, -you can set this to: -> - let g:hgrevFlags = '-i' - - ------------------------------------------------------------------------------- -2.2 *g:hgrevAddStatus* - -This settings will append the current file status to the output, by running -'hg stat'. I find it useful, so it is enabled by default -- you can disable -it like so: -> - let g:hgrevAddStatus = 0 -> - ------------------------------------------------------------------------------- -2.3 *g:hgrevAutoUpdate* -> -When this option is enabled, some |autocmd-events| are added that -automatically call :RefreshMercurialRev on file changes -- when a buffer is -read, written to, or modified outside of Vim. This is disabled by default, as -the additional time needed (however small) to system() to hg for every -read/write outweighs running :RefreshMercurialRev manually for my tastes. -Yours tastes, of course, may vary, so you can enable it like so: -> - let g:hgrevAutoUpdate = 1 - -Alternatively, you can leave it disabled, and add your own |autocmd| events -for :RefreshMercurialRev to what works best for you. - - ------------------------------------------------------------------------------- -2.4 *g:hgrevNoRepoChar* -> -If the current buffer doesn't seem to be a member of a Mercurial repository, -HGRev() returns this character instead of a revision ID. - -Some examples: -> - let g:hgrevNoRepoChar = '-' (default) - set statusline=[r%{HGRev()}] - -This will output something like '[r12+ default tip M]' for repo files, -and '[r-]' for non-repo. -> - let g:hgrevNoRepoChar = '' - set statusline=%{HGRev()?'[r'.HGRev().']':''} - -This will output something like '[r512 default tip]' for repo files, and -nothing at all for non-repo. - - -============================================================================== -3. AUTHOR *HGRevAuthor* - -HGRev was written by Mahlon E. Smith. - - mahlon@martini.nu ~ - http://www.martini.nu/ - - - -============================================================================== -4. LICENSE *HGRevLicense* - -HGRev is distributed under the BSD license. - http://www.opensource.org/licenses/bsd-license.php -> - Copyright (c) 2010-2012, Mahlon E. Smith - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -vim: set noet nosta sw=4 ts=4 ft=help : diff -r 2b198f0a86fe -r cc3094023778 hgrev/plugin/hgrev.vim --- a/hgrev/plugin/hgrev.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -" vim: set noet nosta sw=4 ts=4 fdm=marker : -" -" HGRev -" Mahlon E. Smith -" $Id$ -" -" Simplistic file revision checker, meant for adding current revision -" information to the statusbar, a la: -" -" set statusline=[r%{HGRev()}] -" - -if exists( 'hgrev_loaded' ) - finish -endif -let hgrev_loaded = '$Rev$' - -" }}} -" Defaults for misc settings {{{ -" -if !exists( 'g:hgrevFlags' ) - let g:hgrevFlags = '-nbt' -endif - -if !exists( 'g:hgrevAddStatus' ) - let g:hgrevAddStatus = 1 -endif - -if !exists( 'g:hgrevAutoUpdate' ) - let g:hgrevAutoUpdate = 0 -endif - -if !exists( 'g:hgrevNoRepoChar' ) - let g:hgrevNoRepoChar = '-' -endif - - - -"}}} -" Commands {{{ -" -command! RefreshMercurialRev :call RefreshMercurialRev() - - -" HGRev() {{{ -" Return the current buffer rev id from the global dictionary. -" -function! HGRev() - if exists( 'g:hg_revs' ) - let l:key = getcwd() . '/' . bufname('%') - return has_key(g:hg_revs, l:key) ? g:hg_revs[l:key] : g:hgrevNoRepoChar - else - call RefreshMercurialRev() - call HGRev() - endif -endfunction - - -" }}} -" RefreshMercurialRev() {{{ -" -" Locate the hgroot and fetch the current rev id, populating the global -" dictionary. -" -function! RefreshMercurialRev() - if ! exists( 'g:hg_revs' ) - let g:hg_revs = {} - endif - - " Find the closest HG root for the buffer. 'hg root' won't do it, since - " it works off the cwd, and we need the nearest root from the filename. - " - - " (we're unlikely to get lucky finding '.hg' in http:// or similar) - " - if matchstr(bufname('%'), "^[^:/]\\+://") != '' - return - endif - - let l:searchpaths = split( expand('%:p:h'), '/' ) - let l:dircount = len(l:searchpaths) - let l:root = '' - while l:dircount > 0 - let l:root = '/' . join( l:searchpaths[0 : l:dircount], '/' ) - if isdirectory( l:root . '/' . '.hg' ) - break - endif - let l:dircount = l:dircount - 1 - endwhile - - if l:dircount == -1 - return - endif - - let l:key = getcwd() . '/' . bufname('%') - - " Find the rev for the repo containing the current file buffer. - " - let l:cmd = 'hg id ' . g:hgrevFlags . ' ' . l:root - let l:rev = system( l:cmd ) - let l:hg_exit = v:shell_error - - if l:hg_exit == 0 - let l:rev = substitute( l:rev, '\n', '', 'g' ) - let g:hg_revs[ l:key ] = l:rev - endif - - " Add file repo status. - " - if g:hgrevAddStatus == 1 - let l:cmd = 'hg stat ' . bufname('%') - let l:stat = system( l:cmd ) - let l:hg_exit = v:shell_error - - if l:hg_exit == 0 && len(l:stat) > 0 - let l:stat = split( l:stat, '\s\+' )[0] - let g:hg_revs[ l:key ] = g:hg_revs[ l:key ] . ' ' . l:stat - endif - endif - - return -endfunction -"}}} - - -" Refresh the rev for the current buffer on reads/writes. -" -if g:hgrevAutoUpdate == 1 - autocmd BufReadPost * call RefreshMercurialRev() - autocmd BufWritePost * call RefreshMercurialRev() - autocmd FileChangedShellPost * call RefreshMercurialRev() -endif - diff -r 2b198f0a86fe -r cc3094023778 specky/Makefile --- a/specky/Makefile Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -PLUGIN = specky - -SOURCE = syntax/rdoc.vim -SOURCE += syntax/specrun.vim -SOURCE += syntax/specrun1.vim -SOURCE += syntax/rspec.vim -SOURCE += ftdetect/rspec.vim -SOURCE += ftplugin/rspec.vim -SOURCE += doc/specky.txt -SOURCE += plugin/specky.vim -SOURCE += snippets/rspec.snippets -SOURCE += ruby/specky_formatter.rb - - -${PLUGIN}.vba: ${SOURCE} - - vim --cmd 'let g:plugin_name="${PLUGIN}"' -S build.vim -cq\! - gzip ${PLUGIN}.vba - -install: - rsync -Rv ${SOURCE} ${HOME}/.vim/ - -clean: - rm ${PLUGIN}.vba.gz diff -r 2b198f0a86fe -r cc3094023778 specky/build.vim --- a/specky/build.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -let g:vimball_home="." -e Makefile -v/^SOURCE/d -%s/^SOURCE\s\++\?=\s\+// -execute '%MkVimball!' . g:plugin_name diff -r 2b198f0a86fe -r cc3094023778 specky/doc/specky.txt --- a/specky/doc/specky.txt Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,358 +0,0 @@ -*specky.txt* Last change: $Id$ - - VIM REFERENCE MANUAL by Mahlon E. Smith - - - specky! - -A Plugin for testing Ruby code with RSpec -- and more *specky* -============================================================================== -CONTENTS *SpeckyContents* - - 1) Intro........................................|SpeckyIntro| - 2) Functionality................................|SpeckyFunctionality| - 3) Enabling Specky..............................|SpeckyInstallation| - 4) Configuration................................|SpeckyOptions| - 4.1) Create text banners....................|g:speckyBannerKey| - 4.2) Cycling quote styles...................|g:speckyQuoteSwitcherKey| - 4.3) Display ruby documentation.............|g:speckyRunRdocKey| - 4.4) Toggle editing between spec and code...|g:speckySpecSwitcherKey| - 4.5) Run specs for the current buffer.......|g:speckyRunSpecKey| - 4.6) Modify the default spec command........|g:speckyRunSpecCmd| - 4.7) Modify the default rdoc command........|g:speckyRunRdocCmd| - 4.8) Alter new window behavior..............|g:speckyWindowType| - 4.9) Running older rspec (1.x) .............|g:speckySpecVersion| - 5) Author.......................................|SpeckyAuthor| - 6) License......................................|SpeckyLicense| - - - -============================================================================== -1. INTRO *SpeckyIntro* - -Specky is primarily a small collection of functions to help make behavioral -testing streamlined and easy when working with ruby and rspec. Specky -supports rspec 2.x by default, and is backwards compatible with rspec 1.x. - -Specky secondarily includes a couple of conveniences to make your everyday -programming tasks smooooth and pleasurable. - - -============================================================================== -2. FUNCTIONALITY *SpeckyFunctionality* - -Okay then, what does it do? - -By default? Nothing but syntax highlighting unless you are comfortable using -the menus. I decided the easiest way to cherry pick the functionality that -you'd like was to enable them via key bindings. By doing this, Specky won't -make assumptions about your current environment, and won't stomp on anything -you don't want it to. - - Specky won't do -anything- with your environment until you enable ~ - the key bindings!! ~ - -After you've configured your bindings, here are some of the things you can -now do with a single key stroke: -> - - Switch back and forth from code to testing spec - - - Run the spec, with results going to a new, syntax highlighted buffer - - - Jump quickly to spec failures and failure detail - - 'e' and 'r' to move back and forth on each failed assertion, - - 'E' to jump details for it. - - '' to "forget" the currently selected failed assertion - - 'q' to close the spec output buffer. - - - View rdoc of the word under the cursor - - - Dynamically switch string types for the word under the cursor - (double quoted, quoted, symbol) - - - Make lovely and quick comment banners for ruby code. - -Specky also includes a "snippets" file that can be used with the Snipmate -plugin by Michael Sanders . (Minimum version 0.74.) - - http://www.vim.org/scripts/script.php?script_id=2540 - -============================================================================== -3. ENABLING-SPECKY *SpeckyInstallation* - -Getting Specky to work should be a fairly trivial process. Specky now -uses a custom rspec formatter to function reliably, and it needs to know -where that lives on your system. - -If you installed Specky from Vimball, it is likely found at: - - ~/.vim/ruby/specky_formatter.rb ~ - -Otherwise, you'll need to locate it, and tell rspec to use it in one of two -ways. - - 1) Set the 'g:speckyRunSpecCmd' variable explicitly: - - let g:speckyRunSpecCmd = "rspec -r ~/.vim/ruby/specky_formatter.rb -f SpeckyFormatter" ~ - - 2) or, leave 'g:speckyRunSpecCmd' at its default value, and instead use - an '.rspec' settings file in the root directory of the the project - you're working in. I find this method much more flexible -- the - '.rspec' file can be carried with your project, and customized to - include additional bits like custom $LOAD_PATH injections, etc. - Here's what mine usually looks like: > - - -r loadpath - -r ~/.vim/bundle/specky/ruby/specky_formatter - -f SpeckyFormatter - - You can also use both of these methods, and use the - 'SpeckyConsoleFormatter' class from your .rspec file, if it suits - your fancy. - - -After that is taken care of, then just set up your keybindings in your -.vimrc. Here's what my config looks like. > - - let g:speckyBannerKey = "b" - let g:speckyQuoteSwitcherKey = "'" - let g:speckyRunRdocKey = "r" - let g:speckySpecSwitcherKey = "x" - let g:speckyRunSpecKey = "s" - let g:speckyRunRdocCmd = "fri -L -f plain" - let g:speckyWindowType = 2 - -With these bindings, all Specky commands start with ("s" for -Specky!), followed by a mnemonic function to run: - - b ----> Banner creation ~ - ' ----> Quote cycling ~ - r ----> run Rdoc ~ - x ----> code and spec eXchange ~ - s ----> run rSpec ~ - -Of course, is a "suspend" signal for most terminals, so these -bindings are meant for a |gui| environment, such as gvim. Your mileage (and -tastes) will doubtlessly vary. Do what you will. I won't judge you. - - -============================================================================== -4. CONFIGURATION-OPTIONS *SpeckyOptions* - -Here are all of the available configuration options. - -Please note that you must set binding variables: - - |g:speckyBannerKey| - |g:speckyQuoteSwitcherKey| - |g:speckyRunRdocKey| - |g:speckySpecSwitcherKey| - |g:speckyRunSpecKey| - -...in order to enable the respective Specky functionality. See -|SpeckyInstallation| for details. Any other options are entirely optional. -Put these into your |vimrc|, or wherever else you enjoy storing this kind of -stuff. - - ------------------------------------------------------------------------------- -4.1 *g:speckyBannerKey* - -Setting this binding enables comment banner creation. - -This is purely a convenience routine, and a stylistic one at that. I prefer -large advertising of what "area" of code you are in, along with other -miscellaneous labels for humans to read. If this isn't how you roll, then by -all means, don't enable this binding! :) - -As an example -- you can just type: - - instance methods ~ - -Then hit the keystroke. It will magically turn into: > - - ######################################################################## - ### I N S T A N C E M E T H O D S - ######################################################################## - -With all those saved extra keystrokes this might provide you per banner over -the years, your RSI-free hands will thank you. And the total time savings!! -Oh man, what are you going to DO with all of that extra free time? -The possibilities are staggering. - - ------------------------------------------------------------------------------- -4.2 *g:speckyQuoteSwitcherKey* - -Setting this binding enables quote "style switching". - -If you aren't in ruby mode, this just changes the word under the cursor -back and forth from double quoting to single quoting. - - string -> "string" -> 'string' -> "string" ... ~ - -In ruby mode, symbols are also put into the rotation. - - "string" -> 'string' -> :string -> "string" ... ~ - -Note that quote cycling only works with a |word|. - - ------------------------------------------------------------------------------- -4.3 *g:speckyRunRdocKey* - -Setting this enables the display of rdoc documentation for the current -word under the cursor. For lookups with multiple matches, you can continue -using this binding to "drill down" to the desired documentation. - - ------------------------------------------------------------------------------- -4.4 *g:speckySpecSwitcherKey* - -Setting this enables spec to code switching, and visa versa. - -Switching uses path searching instead of reliance on directory structure in -your project. The idea here is that you'd |:chdir| into your project -directory. Spec files just need to end in '_spec.rb', which is a common -convention. - - aRubyClass.rb ---> aRubyClass_spec.rb~ - -Because it leaves respective buffers open, you can essentially think of this -as a quick toggle between code and tests. - - ------------------------------------------------------------------------------- -4.5 *g:speckyRunSpecKey* - -Setting this variable runs "rspec" on the current buffer. - -All output is sent to a syntax highlighted scratch buffer. This new window is -re-used for each spec run. You can quickly "jump" to assertion failures and -their associated details with the following keys: - - e and r ~ - Move forward and backward through the failed assertions. - - E~ - While on a failure line, jump to the details of the failure. - - ~ - "Forget" the last found failed assertion, and start over at the - beginning of the list. (ie, the next 'e' keystroke will select - error #1.) - - q ~ - Closes the spec output buffer. - - -Normally, you'd only want to perform this keystroke while in a spec file -buffer. If Specky thinks you are in code, rather than a buffer (as indicated -by the lack of a "_spec.rb" file naming convention) then it will attempt to -switch to the spec before running the command. - - ------------------------------------------------------------------------------- -4.6 *g:speckyRunSpecCmd* - -This is the program, with flags, that the current file is sent to when -executing the |g:speckyRunSpecKey| keybinding. - -A common addition is to include an "-r" flag for sucking in local libraries -necessary for testing your project. In fact, this is required to use the -rspec formatter supplied by Specky. See |SpeckyInstallation| for more info. - - Default: ~ - rspec - - ------------------------------------------------------------------------------- -4.7 *g:speckyRunRdocCmd* - -If you prefer an rdoc display program other than "ri", you can set it -with this variable. "fri -L -f plain" is always a nice choice, for example. - - Default: ~ - ri - - ------------------------------------------------------------------------------- -4.8 *g:speckyWindowType* - -For both spec and rdoc commands, this variable controls the behavior of the -newly generated window. - - Default: ~ - 0 - - 0 ~ - Create a new tabbed window - 1 ~ - Split the current window horizontally - 2 ~ - Split the current window vertically - - ------------------------------------------------------------------------------- -4.9 *g:speckySpecVersion* - -Specky should work out of the box with rspec 2.x. If you'd like to use rspec -1.x instead, you can do so with the following Vim settings: > - - let g:speckySpecVersion = 1 - let g:speckyRunRdocCmd = "spec -fs" - -If you have both rspec 1.x and 2.x installed at the same time, you need to -be explicit with what version you are executing: > - - let g:speckyRunRdocCmd = "spec _1.3.0_ -fs" - - -============================================================================== -5. AUTHOR *SpeckyAuthor* - - -Specky was written by Mahlon E. Smith. - - mahlon@martini.nu ~ - http://www.martini.nu/ - - - -============================================================================== -6. LICENSE *SpeckyLicense* - - -Specky is distributed under the BSD license. - http://www.opensource.org/licenses/bsd-license.php -> - Copyright (c) 2008-2010, Mahlon E. Smith - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -vim: set noet nosta sw=4 ts=4 ft=help : - diff -r 2b198f0a86fe -r cc3094023778 specky/ftdetect/rspec.vim --- a/specky/ftdetect/rspec.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -au BufRead,BufNewFile *_spec.rb set filetype=rspec diff -r 2b198f0a86fe -r cc3094023778 specky/ftplugin/rspec.vim --- a/specky/ftplugin/rspec.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -if exists("b:did_ftplugin") - finish -endif - -" Behave just like Ruby -runtime! ftplugin/ruby.vim - diff -r 2b198f0a86fe -r cc3094023778 specky/plugin/specky.vim --- a/specky/plugin/specky.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,370 +0,0 @@ -" vim: set noet nosta sw=4 ts=4 fdm=marker : -" -" Specky! -" Mahlon E. Smith -" $Id$ -" - - -" Hook up the functions to the user supplied key bindings. {{{ -" -if exists( 'g:speckySpecSwitcherKey' ) - execute 'map ' . g:speckySpecSwitcherKey . ' :call SpecSwitcher()' -" map &g:speckySpecSwitcherKey SpecSwitcher() -endif - -if exists( 'g:speckyQuoteSwitcherKey' ) - execute 'map ' . g:speckyQuoteSwitcherKey . ' :call QuoteSwitcher()' -endif - -if exists( 'g:speckyBannerKey' ) - execute 'map ' . g:speckyBannerKey . ' :call MakeBanner()' -endif - -if exists( 'g:speckyRunSpecKey' ) - execute 'map ' . g:speckyRunSpecKey . ' :call RunSpec()' -endif - -if exists( 'g:speckyRunRdocKey' ) - execute 'map ' . g:speckyRunRdocKey . ' :call RunRdoc()' -endif - -if exists( 'specky_loaded' ) - finish -endif -let specky_loaded = '$Rev$' - - -"}}} -" Menu configuration {{{ -" -let s:menuloc = '&Plugin.&specky' -execute 'menu ' . s:menuloc . '.&Jump\ to\ code/spec :call SpecSwitcher()' -execute 'menu ' . s:menuloc . '.Run\ &spec :call RunSpec()' -execute 'menu ' . s:menuloc . '.&RDoc\ lookup :call RunRdoc()' -execute 'menu ' . s:menuloc . '.Rotate\ "e\ style :call QuoteSwitcher()' -execute 'menu ' . s:menuloc . '.Make\ a\ &banner :call MakeBanner()' - - -" }}} -" SpecSwitcher() {{{ -" -" When in ruby code or an rspec BDD file, try and search recursively through -" the filesystem (within the current working directory) to find the -" respectively matching file. (code to spec, spec to code.) -" -" This operates under the assumption that you've used chdir() to put vim into -" the top level directory of your project. -" -function! SpecSwitcher() - - " If we aren't in a ruby or rspec file then we probably don't care - " too much about this function. - " - if &ft != 'ruby' && &ft != 'rspec' - call s:err( "Not currently in ruby or rspec mode." ) - return - endif - - " Ensure that we can always search recursively for files to open. - " - let l:orig_path = &path - set path=** - - " Get the current buffer name, and determine if it is a spec file. - " - " /tmp/something/whatever/rubycode.rb ---> rubycode.rb - " A requisite of the specfiles is that they match to the class/code file, - " this emulates the eigenclass stuff, but doesn't require the same - " directory structures. - " - " rubycode.rb ---> rubycode_spec.rb - " - let l:filename = matchstr( bufname('%'), '[0-9A-Za-z_.-]*$' ) - let l:is_spec_file = match( l:filename, '_spec.rb$' ) == -1 ? 0 : 1 - - if l:is_spec_file - let l:other_file = substitute( l:filename, '_spec\.rb$', '\.rb', '' ) - else - let l:other_file = substitute( l:filename, '\.rb$', '_spec\.rb', '' ) - endif - - let l:bufnum = bufnr( l:other_file ) - if l:bufnum == -1 - " The file isn't currently open, so let's search for it. - execute 'find ' . l:other_file - else - " We've already got an open buffer with this file, just go to it. - execute 'buffer' . l:bufnum - endif - - " Restore the original path. - execute 'set path=' . l:orig_path -endfunction - - -" }}} -" QuoteSwitcher() {{{ -" -" Wrap the word under the cursor in quotes. If in ruby mode, -" cycle between quoting styles and symbols. -" -" variable -> "variable" -> 'variable' -> :variable -" -function! QuoteSwitcher() - let l:type = strpart( expand(""), 0, 1 ) - let l:word = expand("") - - if l:type == '"' - " Double quote to single - execute ":normal viWc'" . l:word . "'" - - elseif l:type == "'" - if &ft == 'ruby' || &ft == 'rspec' - " Single quote to symbol - execute ':normal viWc:' . l:word - else - " Single quote to double - execute ':normal viWc"' . l:word . '"' - end - - else - " Whatever to double quote - execute ':normal viWc"' . l:word . '"' - endif - - " Move the cursor back into the cl:word - call cursor( 0, getpos('.')[2] - 1 ) -endfunction - - -" }}} -" MakeBanner() {{{ -" -" Create a quick banner from the current line's text. -" -function! MakeBanner() - let l:banner_text = toupper(join( split( getline('.'), '\zs' ), ' ' )) - let l:banner_text = substitute( l:banner_text, '^\s\+', '', '' ) - let l:sep = repeat( '#', &textwidth == 0 ? 72 : &textwidth ) - let l:line = line('.') - - call setline( l:line, l:sep ) - call append( l:line, [ '### ' . l:banner_text, l:sep ] ) - execute 'normal 3==' - call cursor( l:line + 3, 0 ) -endfunction - - -" }}} -" RunSpec() {{{ -" -" Run this function while in a spec file to run the specs within vim. -" -function! RunSpec() - - " If we're in the code instead of the spec, try and switch - " before running tests. - " - let l:filename = matchstr( bufname('%'), '[0-9A-Za-z_.-]*$' ) - let l:is_spec_file = match( l:filename, '_spec.rb$' ) == -1 ? 0 : 1 - if ( ! l:is_spec_file ) - silent call SpecSwitcher() - endif - - let l:spec = bufname('%') - let l:buf = 'specky:specrun' - let l:bufnum = bufnr( l:buf ) - let l:specver = (exists( 'g:speckySpecVersion') && g:speckySpecVersion == 1) ? 1 : 2 - - " Squash the old buffer, if it exists. - " - if buflisted( l:buf ) - execute 'bd! ' . l:buf - endif - - execute NewWindowCmd() . l:buf - setlocal buftype=nofile bufhidden=delete noswapfile - if ( l:specver == 1 ) - setlocal filetype=specrun1 - set foldtext='--'.getline(v:foldstart).v:folddashes - else - setlocal filetype=specrun - set foldtext=_formatFoldText() - endif - - " Set up some convenient keybindings. - " - nnoremap q :close - nnoremap e :call FindSpecError(1) - nnoremap r :call FindSpecError(-1) - nnoremap E :call FindSpecError(0) - nnoremap :let b:err_line=1 - - " Default cmd for spec - " - if !exists( 'g:speckyRunSpecCmd' ) - let g:speckyRunSpecCmd = l:specver == 1 ? 'spec -fs' : 'rspec' - endif - - " Call spec and gather up the output - " - let l:cmd = g:speckyRunSpecCmd . ' ' . l:spec - call append( line('$'), 'Output of: ' . l:cmd ) - call append( line('$'), '' ) - let l:output = system( l:cmd ) - call append( line('$'), split( l:output, "\n" ) ) - normal gg - - " Lockdown the buffer - setlocal nomodifiable -endfunction - - -" }}} -" RunRdoc() {{{ -" -" Get documentation for the word under the cursor. -" -function! RunRdoc() - - " If we aren't in a ruby file (specs are ruby-mode too) then we probably - " don't care too much about this function. - " - if ( &ft != 'ruby' && &ft != 'rdoc' && &ft != 'rspec' ) - call s:err( "Not currently in a rubyish-mode." ) - return - endif - - " Set defaults - " - if !exists( 'g:speckyRunRdocCmd' ) - let g:speckyRunRdocCmd = 'ri' - endif - - let l:buf = 'specky:rdoc' - let l:bufname = bufname('%') - - if ( match( l:bufname, l:buf ) != -1 ) - " Already in the rdoc buffer. This allows us to lookup - " something like Kernel#require. - " - let l:word = expand('') - else - " Not in the rdoc buffer. This allows us to lookup - " something like 'each' in some_hash.each { ... } - " - let l:word = expand('') - endif - - " Squash the old buffer, if it exists. - " - if buflisted( l:buf ) - execute 'bd! ' . l:buf - endif - - " With multiple matches, strip the commas from the cWORD. - let l:word = substitute( l:word, ',', '', 'eg' ) - - execute NewWindowCmd() . l:buf - setlocal buftype=nofile bufhidden=delete noswapfile filetype=rdoc - nnoremap q :close - - " Call the documentation and gather up the output - " - let l:cmd = g:speckyRunRdocCmd . ' ' . l:word - let l:output = system( l:cmd ) - call append( 0, split( l:output, "\n" ) ) - execute 'normal gg' - - " Lockdown the buffer - setlocal nomodifiable -endfunction - - -" }}} -" FindSpecError( detail ) {{{ -" -" detail: -" 1 -- find the next failure -" -1 -- find the previous failure -" 0 -- expand the current failure's detail -" -" Convenience searches for jumping to spec failures. -" -function! FindSpecError( detail ) - - let l:specver = (exists( 'g:speckySpecVersion') && g:speckySpecVersion == 1) ? 1 : 2 - let l:err_str = l:specver == 1 ? '(FAILED\|ERROR - \d\+)$' : 'FAILED - #\d\+)$' - - if ( a:detail == 0 ) - " Find the detailed failure text for the current failure line, - " and unfold it. - " - let l:orig_so = &so - set so=100 - if l:specver == 1 - call search('^' . matchstr(getline('.'),'\d\+)$') ) - else - call search('^FAILURE - #' . matchstr(getline('.'),'\d\+)$') ) - endif - if has('folding') - silent! normal za - endif - execute 'set so=' . l:orig_so - - else - " Find the 'regular' failure line - " - if exists( 'b:err_line' ) - call cursor( b:err_line, a:detail == -1 ? 1 : strlen(getline(b:err_line)) ) - endif - call search( l:err_str, a:detail == -1 ? 'b' : '' ) - let b:err_line = line('.') - nohl - - endif -endfunction - - -" }}} -" NewWindowCmd() {{{ -" -" Return the stringified command for a new window, based on user preferences. -" -function! NewWindowCmd() - if ( ! exists('g:speckyWindowType' ) ) - return 'tabnew ' - endif - - if ( g:speckyWindowType == 1 ) - return 'new ' - elseif ( g:speckyWindowType == 2 ) - return 'vert new ' - else - return 'tabnew ' - endif -endfunction - - -" }}} -" _formatFoldText() {{{ -" -" Make folded failure detail visually appealing when folded. -" -function! _formatFoldText() - let l:fold = tolower( getline(v:foldstart) ) - let l:fold = substitute( l:fold, '-', 'detail', 'e' ) - let l:fold = '--[ ' . substitute( l:fold, ')', ' ]', 'e' ) - return l:fold -endfunction - - -" }}} -" s:err( msg ) "{{{ -" Notify of problems in a consistent fashion. -" -function! s:err( msg ) - echohl WarningMsg|echomsg 'specky: ' . a:msg|echohl None -endfunction " }}} - diff -r 2b198f0a86fe -r cc3094023778 specky/ruby/specky_formatter.rb --- a/specky/ruby/specky_formatter.rb Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,215 +0,0 @@ - -require 'rspec/core/formatters/base_text_formatter' - -### SpeckyFormatter: A basic RSpec 2.x text formatter, to be used -### with the 'Specky' vim plugin (or from the command line, if you -### dig it over the default 'documentation' format!) -### -### rspec -r /path/to/this/specky_formatter.rb -f SpeckyFormatter specs -### -class SpeckyFormatter < RSpec::Core::Formatters::BaseTextFormatter - - def initialize( *args ) - super - @indent_level = 0 - @failure_index = 0 - @failures = [] - @txt = '' - @summary = '' - end - - - ######################################################################## - ### R S P E C H O O K S - ######################################################################## - - ### Example group hook -- increase indentation, emit description - ### - def example_group_started( example_group ) - self.out '+', '-' * (example_group.description.length + 2), '+' - self.out '| ', example_group.description, ' |' - self.out '+', '-' * (example_group.description.length + 2), '+' - @indent_level += 1 - end - - - ### Example group hook -- decrease indentation - ### - def example_group_finished( example_group ) - @indent_level -= 1 - end - - - ### Called on example success - ### - def example_passed( example ) - msg = self.format_example( example ) - msg << ')' - self.out msg - end - - - ### Called on a pending example - ### - def example_pending( example ) - msg = self.format_example( example ) - pending_msg = example.metadata[ :execution_result ][ :pending_message ] - msg << ", PENDING%s)" % [ ": #{pending_msg}" || '' ] - self.out msg - end - - - ### Called on example failure - ### - def example_failed( example ) - @failure_index += 1 - msg = self.format_example( example ) - msg << ", FAILED - #%d)" % [ @failure_index ] - self.out msg - - @failures << example - end - - - ### Called after all examples are run. Emit details for each failed example, - ### for Vim to fold. - ### - def dump_failures - self.out "\n" unless @failures.empty? - cwd = Regexp.new( Dir.pwd ) - bt_regexp = /(.+?):(\d+)(|:\d+)/ - - @failures.each_with_index do |example, index| - desc = example.metadata[ :full_description ] - exception = example.execution_result[ :exception ] - file = line = nil - - # remove files that are not in within the cwd. - # - # this isn't optimal, but it does stay within specky's notion of - # running it from within the project directory, and makes sure we don't - # inadvertently display code from rspec itself. - # - bt_file = exception.backtrace.find { |line| line =~ bt_regexp && line =~ cwd } - file, line = $1, $2.to_i if bt_file =~ bt_regexp - self.out "FAILURE - #%d)" % [ index + 1 ] - self.out "%s:%d" % [ file, line ] if bt_file - - if exception.respond_to?( :pending_fixed? ) && exception.pending_fixed? - self.out "%s FIXED" % [ desc ] - self.out "Expected pending '%s' to fail. No error was raised." % [ - example.metadata[ :execution_result ][ :pending_message ] - ] - else - self.out desc - self.out "Failure/Error: %s" % [ read_failed_line( exception, example).strip ] - exception.message.split("\n").each {|l| self.out l} - - # logic taken from the base class - if shared_group = find_shared_group(example) - self.out "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\" called from " + - "#{backtrace_line(shared_group.metadata[:example_group][:location])}" - end - end - - self.out exception_source( file, line-1 ) if file && line - end - end - - - ### Emit the source of the exception, with context lines. - ### - def exception_source( file, line ) - context = '' - low, high = line - 3, line + 3 - - File.open( file ).each_with_index do |cline, i| - cline.chomp!.rstrip! - next unless i >= low && i <= high - context << " %s%4d: %s\n" % [ ( i == line ? '>>' : ' |' ), i, cline ] - end - - return context - - rescue - 'Unable to parse exception context lines.' - end - - - ### Emit summary data for all examples. - ### - def dump_summary( duration, example_count, failure_count, pending_count ) - succeeded = example_count - failure_count - pending_count - @summary << "+%s+\n" % [ '-' * 49 ] - @summary << "|%s-- Summary --%s|\n" % [ ' ' * 18, ' ' * 18 ] - @summary << "+----------+-----------+--------+---------+-------+\n" - @summary << "| Duration | Succeeded | Failed | Pending | Total |\n" - @summary << "+----------+-----------+--------+---------+-------+\n" - - @summary << "| %7ss | %9s | %6s | %7s | %5s |\n" % [ - "%0.3f" % duration, succeeded, failure_count, - pending_count, example_count - ] - - @summary << "+----------+-----------+--------+---------+-------+\n\n" - end - - - ### End of run. Dump it all out! - ### - def close - output.puts @summary - output.puts @txt - end - - - ######### - protected - ######### - - ### Send a string to the output IO object, after indentation. - ### - def out( *msg ) - msg = msg.join - @txt << "%s%s\n" % [ ' ' * @indent_level, msg ] - end - - ### Format the basic example information, along with the run duration. - ### - def format_example( example ) - metadata = example.metadata - duration = metadata[ :execution_result ][ :run_time ] - description = metadata[ :description ] - return "| %s (%0.3fs" % [ description, duration ] - end -end # SpeckyFormatter - - -### Identical to the regular SpeckyFormatter, but it puts summary -### information at the bottom of the screen instead of the top, and just -### spits out rudamentary failure info. Mimics the progress -### formatter for status feedback -### -class SpeckyFormatterConsole < SpeckyFormatter - - def example_passed( ex ); print '.'; end - def example_failed( ex ); print 'F'; super; end - def example_pending( ex ); print '*'; end - - def close - puts - puts "Failures:" unless @failures.empty? - @failures.each do |test| - metadata = test.metadata - msg = "- %s\n %s\n %s:%d\n\n" % [ - metadata[:full_description], - test.exception.message, - metadata[:file_path], - metadata[:line_number] - ] - puts msg - end - output.puts @summary - end -end - diff -r 2b198f0a86fe -r cc3094023778 specky/snippets/rspec.snippets --- a/specky/snippets/rspec.snippets Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,173 +0,0 @@ -# -# specky: snippet file for rspec, to be used with the quite excellent -# 'snipmate' Vim plugin by Michael Sanders . -# http://www.vim.org/scripts/script.php?script_id=2540 -# -# $Id$ -# - -snippet .and and_raise() - .and_raise( ${1:exception}.new("${2:message}") ) -snippet .and and_return { } - .and_return { ${1} } -snippet .and and_return() - .and_return( ${1:value} ) -snippet .and and_throw() - .and_throw( ${1:sym} ) -snippet .and and_yield() - .and_yield( ${1:values} ) -snippet .at at_least() - .at_least( ${1:n} ).times -snippet .at at_most() - .at_most( ${1:n} ).times -snippet .on - .once -snippet .tw - .twice -snippet .any - .any_number_of_times -snippet des Describe subject - describe "${1:subject}" do - ${2} - end -snippet des Describe Type - describe ${1:Type} do - ${2} - end -snippet des Describe Type, description - describe ${1:Type}, "${2:description}" do - ${3} - end -snippet des Describe a shared group - describe "${1:A Shared Thing}", :shared => true do - ${2} - end -snippet it it block - it "${1:should do something}" do - ${2} - end -snippet it it (pending) - it "${1:does something}"${2} -snippet .ex - .exactly( ${1:n} ).times -snippet .w - .with( ${1:args} )${2} -snippet con - context "${1:context}" do - ${2} - end -# this is the 'old' mock syntax (rspec 1.x) -# use 'double' for rspec 2.x -snippet mock - ${1:var} = mock( "${2:mock_name}"${3:, :null_object => true} ) - ${4} -snippet dou - ${1:var} = double( "${2:double_name}" )${3:.as_null_object} - ${4} -snippet st - stub!( :${1:expectation} ).with( ${2:args} ).and_return( ${3} ) -snippet bef Before each test - before( :each ) do - ${1} - end -snippet bef Before all tests - before( :all ) do - ${1} - end -snippet aft After each test - after( :each ) do - ${1} - end -snippet aft After all tests - after( :all ) do - ${1} - end -snippet sh= - ${1:target}.should == ${2:value} - ${3} -snippet shn= - ${1:target}.should_not == ${2:value} - ${3} -snippet she - ${1:target}.should equal( ${2:value} ) - ${3} -snippet shne - ${1:target}.should_not equal( ${2:value} ) - ${3} -snippet shm Should contain - ${1:target}.should =~ /${2:regexp}/ - ${3} -snippet shnm - ${1:target}.should_not =~ /${2:regexp}/ - ${3} -snippet shm Should match - ${1:target}.should match( /${2:regexp}/ )${3} -snippet shb - ${1:target}.should be( ${2:result} ) - ${3} -snippet shnb - ${1:target}.should_not be( ${2:result} ) - ${3} -snippet shbko - ${1:target}.should be_a_kind_of( ${2:klass} ) - ${3} -snippet shnbko - ${1:target}.should_not be_a_kind_of( ${2:klass} ) - ${3} -snippet shbio - ${1:target}.should be_instance_of( ${2:klass} ) - ${3} -snippet shnbio - ${1:target}.should_not be_instance_of( ${2:klass} ) - ${3} -snippet shbc - ${1:target}.should be_close( ${2:result}, ${3:tolerance} ) - ${4} -snippet shnbc - ${1:target}.should_not be_close( ${2:result}, ${3:tolerance} ) - ${4} -snippet shh - ${1:target}.should have( ${2:num} ).${3:things} - ${4} -snippet shhal - ${1:target}.should have_at_least( ${2:num} ).${3:things} - ${4} -snippet shham - ${1:target}.should have_at_most( ${2:num} ).${3:things} - ${4} -snippet shbp - ${1:target}.should ${2:be_${3:predicate}} ${4} -snippet shnbp - ${1:target}.should_not ${2:be_${3:predicate}} ${4} -snippet exre - expect { ${1} }.to raise_exception( ${2:ErrorClass}, /${3:message match}/i ) - ${4} -snippet exnre - expect { ${1} }.to_not raise_exception( ${2:ErrorClass} ) - ${3} -snippet shre - lambda { ${1} }.should raise_exception( ${2:ErrorClass}, /${3:message match}/i ) - ${4} -snippet shnre - lambda { ${1} }.should_not raise_exception( ${2:ErrorClass} ) - ${3} -snippet shr - ${1:mock}.should_receive( :${2:message} )${3} -snippet shnr - ${1:mock}.should_not_receive( :${2:message} )${3} -snippet shrt - ${1:target}.should respond_to( :${2:sym} ) -snippet shnrt - ${1:target}.should_not respond_to( :${2:sym} ) -snippet shbl - it_should_behave_like "${1:shared behavior}" - ${2} -snippet sim - def ${1:matcher_method}( expected ) - simple_matcher do |given, matcher| - matcher.description = "${2:verb} with #{expected.inspect}" - matcher.failure_message = "expected #{given.inspect} to $2 with #{expected.inspect}" - matcher.negative_failure_message = "expected #{given.inspect} not to $2 with #{expected.inspect}" - given.${3:...checks something and returns a boolean} - end - end diff -r 2b198f0a86fe -r cc3094023778 specky/syntax/rdoc.vim --- a/specky/syntax/rdoc.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -" -" specky: syntax highlighting for 'rdoc' output -" $Id$ - - -" Separator lines -" -syntax match rdocSpeckyLines /^------\+\s\?/ contains=rdocSpeckyTarget,rdocSpeckyMultiples -highlight link rdocSpeckyLines Comment - -" The class/method that we're reading -" -syntax match rdocSpeckyTarget / .\+/hs=s+1 contained -highlight link rdocSpeckyTarget Underlined - -" When there are multiple matches to choose from. -" This is only output by fri. -" -syntax match rdocSpeckyMultiples / Multiple choices/hs=s+1 contained -highlight link rdocSpeckyMultiples WarningMsg - -" Secondary headers -" -syntax region rdocSpeckyHeader start="^\S\+.\+:$\n-\+" end="-$" keepend contains=rdocSpeckyHeaderLine -highlight link rdocSpeckyHeader Question - -" Secondary header lines -" -syntax match rdocSpeckyHeaderLine /^-\+$/ contained -highlight link rdocSpeckyHeaderLine NonText - -" Remove the formatting characters from the display -" -highlight link rdocSpeckySpecials NonText - -" _word_ --> italic -" -syntax region rdocSpeckyItalic matchgroup=rdocSpeckySpecials start=" _" end="_" -highlight link rdocSpeckyItalic Special - -" *word* --> bold -" -syntax region rdocSpeckBold matchgroup=rdocSpeckySpecials start=" \*" end="\*" -highlight link rdocSpeckyBold Constant - -" +word+ --> typewriter -" -syntax region rdocSpeckyType matchgroup=rdocSpeckySpecials start=" +" end="+" -highlight link rdocSpeckyType Identifier - -let b:current_syntax = "rdoc" - diff -r 2b198f0a86fe -r cc3094023778 specky/syntax/rspec.vim --- a/specky/syntax/rspec.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -" -" specky: syntax highlighting for rspec files. -" This includes keywords for both rspec 1.x and rspec 2.x. -" $Id$ -" - -runtime! syntax/ruby.vim -unlet b:current_syntax - -syntax keyword rspecGroupMethods context describe example it its let it_should_behave_like shared_examples_for subject it_behaves_like pending specify -highlight link rspecGroupMethods Type - -syntax keyword rspecBeforeAndAfter after after_suite_parts append_after append_before before before_suite_parts prepend_after prepend_before around -highlight link rspecBeforeAndAfter Statement - -syntax keyword rspecMocks double mock stub stub_chain -highlight link rspecMocks Constant - -syntax keyword rspecMockMethods and_raise and_return and_throw and_yield build_child called_max_times expected_args invoke matches -highlight link rspecMockMethods Function - -syntax keyword rspecKeywords should should_not should_not_receive should_receive -highlight link rspecKeywords Constant - -syntax keyword rspecMatchers be change eql equal exist expect have have_at_least have_at_most have_exactly include match matcher raise_error raise_exception respond_to satisfy throw_symbol to to_not when wrap_expectation -syntax match rspecMatchers /\<\(be\|have\)_\w\+\>/ -highlight link rspecMatchers Function - -syntax keyword rspecMessageExpectation advise any_args any_number_of_times anything at_least at_most exactly expected_messages_received generate_error hash_including hash_not_including ignoring_args instance_of matches_at_least_count matches_at_most_count matches_exact_count matches_name_but_not_args negative_expectation_for never no_args once ordered similar_messages times twice verify_messages_received with -highlight link rspecMessageExpectation Function - -let b:current_syntax = "rspec" - diff -r 2b198f0a86fe -r cc3094023778 specky/syntax/specrun.vim --- a/specky/syntax/specrun.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -" -" specky: syntax highlighting for rspec test output, using the -" custom specky formatter. (rspec 2.x) -" $Id$ -" - -if has("folding") - setlocal foldmethod=syntax -endif - -" Command line as it was called, inserted by Specky -syntax match specSpeckyCmd /^Output of: .*/ - -" Pending specs that somehow pass -syntax keyword specCallout FIXED - -" Passed specs -syntax match specPassed /.*(\d\+.\d\+s)/ contains=specDuration,specBoxLine -syntax keyword specPassedKeyword Succeeded - -" Pending specs -syntax match specPending /.*PENDING: .*)$/ contains=specDuration,specBoxLine -syntax keyword specPendingKeyword Pending - -" Failed specs -syntax match specFailed /.*FAILED - #\d\+)/ contains=specDuration,specBoxLine -syntax keyword specFailedKeyword Failed - -" Failure details -syntax region specFailedDetails start="^FAILURE - #\d\+)" end="^$" fold contains=specCallout,specErrorLine -syntax match specErrorLine /^ >>/ - - -" Boxes -syntax match specBox /^\(\s\+\)\?\(+[+-]\+\||.*|\)$/ contains=specFailedKeyword,specDurationKeyword,specPendingKeyword,specPassedKeyword,specBoxContent -syntax match specBoxContent /[a-zA-Z0-9]\+/ contained -syntax match specBoxLine /^\(\s\+\)\?|/ contained - -" Spec timing -" syntax match specDuration /\d\+\.\d\+s/ contained -" syntax keyword specDurationKeyword Duration - -highlight def link specSpeckyCmd Question -highlight def link specCallout Todo -highlight def link specPassed MoreMsg -highlight def link specPassedKeyword specPassed -highlight def link specPending Function -highlight def link specPendingKeyword specPending -highlight def link specFailed WarningMsg -highlight def link specFailedKeyword specFailed -highlight def link specFailedDetails specFailed -highlight def link specDuration Normal -highlight def link specBox LineNr -highlight def link specBoxContent Constant -highlight def link specBoxLine LineNr -highlight def link specErrorLine ErrorMsg - -let b:current_syntax = "specrun" - diff -r 2b198f0a86fe -r cc3094023778 specky/syntax/specrun1.vim --- a/specky/syntax/specrun1.vim Wed Jan 02 09:14:17 2013 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -" -" specky: syntax highlighting for the 'spec' script output (rspec 1.x) -" $Id$ -" - -if has("folding") - setlocal foldmethod=syntax -endif - -" Command line as it was called, inserted by Specky -" -syntax match specSpeckyCmd /^Output of: .*/ -highlight link specSpeckyCmd Question -"syntax match WarningMsg /\.\./ - -" Plain output block (...P..F...) -" -syntax region specPlain start="^[\.PF]\+" end="^$" contains=specFailedPlain,specPendingPlain -highlight link specPlain MoreMsg - -" Passed specs (specdoc output) -" -syntax match specPassed /^- .*/ contains=specFailed,specPending -highlight link specPassed MoreMsg - -" Pending specs (specdoc output) -" -syntax match specPending /.*PENDING: .*)$/ contained -highlight link specPending Function -" -" (Plain output) -syntax match specPendingPlain /P/ contained -highlight link specPendingPlain Function - -" Failed specs (specdoc output) -" -syntax match specFailed /.*\(FAILED\|ERROR\) - \d\+)/ contained -highlight link specFailed WarningMsg -" -" (Plain output) -syntax match specFailedPlain /F/ contained -highlight link specFailedPlain WarningMsg - -" Warning details -" -syntax region specFailedDetails start="^\d\+)" end="^$" fold -highlight link specFailedDetails WarningMsg - -" Pending specs -" -syntax region specPendingDetails start="^Pending:" end="^$" fold -highlight link specPendingDetails Function - -" Timing information -" -syntax match specTimedRun /^Finished in.*/ -highlight link specTimedRun Question - -" Status summary -" -syntax match specExamplesTotal /^\d\+ examples, .\+/ contains=specTotalFailed,specNoFailures,specTotalPending -highlight link specExamplesTotal Special -" -syntax match specTotalFailed /\d\+ failure\%[s]/ contained -highlight link specTotalFailed WarningMsg -" -syntax match specTotalPending /\d pending/ contained -highlight link specTotalPending Function -" -syntax match specNoFailures /0 failures/ contained -highlight link specNoFailures MoreMsg - - -let b:current_syntax = "specrun" -