specky/doc/specky.txt
branchvim-stuff
changeset 19 763cef799c74
parent 10 a8f9271a7cab
child 21 cd1f3381c1ed
equal deleted inserted replaced
18:bf8f3c788cad 19:763cef799c74
     6                                   specky!
     6                                   specky!
     7 
     7 
     8 A Plugin for testing Ruby code with RSpec -- and more                 *specky*
     8 A Plugin for testing Ruby code with RSpec -- and more                 *specky*
     9 ==============================================================================
     9 ==============================================================================
    10 CONTENTS                                                      *SpeckyContents*
    10 CONTENTS                                                      *SpeckyContents*
    11 
       
    12 
    11 
    13     1) Intro........................................|SpeckyIntro|
    12     1) Intro........................................|SpeckyIntro|
    14     2) Functionality................................|SpeckyFunctionality|
    13     2) Functionality................................|SpeckyFunctionality|
    15     3) Enabling Specky..............................|SpeckyVimrcExample|
    14     3) Enabling Specky..............................|SpeckyInstallation|
    16     4) Configuration................................|SpeckyOptions|
    15     4) Configuration................................|SpeckyOptions|
    17         4.1) Create text banners....................|g:speckyBannerKey|
    16         4.1) Create text banners....................|g:speckyBannerKey|
    18         4.2) Cycling quote styles...................|g:speckyQuoteSwitcherKey|
    17         4.2) Cycling quote styles...................|g:speckyQuoteSwitcherKey|
    19         4.3) Display ruby documentation.............|g:speckyRunRdocKey|
    18         4.3) Display ruby documentation.............|g:speckyRunRdocKey|
    20         4.4) Toggle editing between spec and code...|g:speckySpecSwitcherKey|
    19         4.4) Toggle editing between spec and code...|g:speckySpecSwitcherKey|
    21         4.5) Run specs for the current buffer.......|g:speckyRunSpecKey|
    20         4.5) Run specs for the current buffer.......|g:speckyRunSpecKey|
    22         4.6) Modify the default spec command........|g:speckyRunSpecCmd|
    21         4.6) Modify the default spec command........|g:speckyRunSpecCmd|
    23         4.7) Modify the default rdoc command........|g:speckyRunRdocCmd|
    22         4.7) Modify the default rdoc command........|g:speckyRunRdocCmd|
    24         4.8) Alter new window behavior..............|g:speckyWindowType|
    23         4.8) Alter new window behavior..............|g:speckyWindowType|
       
    24         4.9) Running older rspec (1.x) .............|g:speckySpecVersion|
    25     5) Author.......................................|SpeckyAuthor|
    25     5) Author.......................................|SpeckyAuthor|
    26     6) License......................................|SpeckyLicense|
    26     6) License......................................|SpeckyLicense|
    27 
    27 
    28 
    28 
    29 
    29 
    30 ==============================================================================
    30 ==============================================================================
    31 1. INTRO                                                         *SpeckyIntro*
    31 1. INTRO                                                         *SpeckyIntro*
    32 
    32 
    33 
       
    34 Specky is primarily a small collection of functions to help make behavioral
    33 Specky is primarily a small collection of functions to help make behavioral
    35 testing streamlined and easy when working with ruby and rspec.
    34 testing streamlined and easy when working with ruby and rspec.  Specky
       
    35 supports rspec 2.x by default, and is backwards compatible with rspec 1.x.
    36 
    36 
    37 Specky secondarily includes a couple of conveniences to make your everyday
    37 Specky secondarily includes a couple of conveniences to make your everyday
    38 programming tasks smooooth and pleasurable.
    38 programming tasks smooooth and pleasurable.
    39 
    39 
    40 
    40 
    41 
       
    42 ==============================================================================
    41 ==============================================================================
    43 2. FUNCTIONALITY                                         *SpeckyFunctionality*
    42 2. FUNCTIONALITY                                         *SpeckyFunctionality*
    44 
       
    45 
    43 
    46 Okay then, what does it do?
    44 Okay then, what does it do?
    47 
    45 
    48 By default?  Nothing but syntax highlighting unless you are comfortable using
    46 By default?  Nothing but syntax highlighting unless you are comfortable using
    49 the menus.  I decided the easiest way to cherry pick the functionality that
    47 the menus.  I decided the easiest way to cherry pick the functionality that
    78 plugin by Michael Sanders <msanders42+vim@gmail.com>. (Minimum version 0.74.)
    76 plugin by Michael Sanders <msanders42+vim@gmail.com>. (Minimum version 0.74.)
    79 
    77 
    80 	http://www.vim.org/scripts/script.php?script_id=2540
    78 	http://www.vim.org/scripts/script.php?script_id=2540
    81 
    79 
    82 ==============================================================================
    80 ==============================================================================
    83 3. ENABLING-SPECKY                                        *SpeckyVimrcExample*
    81 3. ENABLING-SPECKY                                        *SpeckyInstallation*
    84 
    82 
    85 
    83 Getting Specky to work should be a fairly trivial process.  Specky now
    86 Here's what my config looks like. >
    84 uses a custom rspec formatter to function reliably, and it needs to know
    87 
    85 where that lives on your system.
    88     let g:speckyBannerKey = "<C-S>b"
    86 
       
    87 If you installed Specky from Vimball, it is likely found at:
       
    88 
       
    89 	~/.vim/ruby/specky_formatter.rb ~
       
    90 
       
    91 Otherwise, you'll need to locate it, and tell rspec to use it in one of two
       
    92 ways.
       
    93 
       
    94 	1) Set the *g:speckyRunSpecCmd* variable explicitly:
       
    95 
       
    96 		let g:speckyRunRdocCmd = "rspec -r ~/.vim/ruby/specky_formatter.rb -f SpeckyFormatter" ~
       
    97 
       
    98 	2) or, leave *g:speckyRunSpecCmd* at its default value, and instead use
       
    99 	   an '.rspec' settings file in the root directory of the the project
       
   100 	   you're working in.  I find this method much more flexible -- the
       
   101 	   '.rspec' file can be carried with your project, and customized to
       
   102 	   include additional bits like custom $LOAD_PATH injections, etc.
       
   103 	   Here's what mine usually looks like: >
       
   104 
       
   105 		-r loadpath
       
   106 		-r ~/.vim/bundle/specky/ruby/specky_formatter
       
   107 		-f SpeckyFormatter
       
   108 
       
   109 
       
   110 After that is taken care of, then just set up your keybindings in your
       
   111 .vimrc.  Here's what my config looks like. >
       
   112 
       
   113     let g:speckyBannerKey        = "<C-S>b"
    89     let g:speckyQuoteSwitcherKey = "<C-S>'"
   114     let g:speckyQuoteSwitcherKey = "<C-S>'"
    90     let g:speckyRunRdocKey = "<C-S>r"
   115     let g:speckyRunRdocKey       = "<C-S>r"
    91     let g:speckySpecSwitcherKey = "<C-S>x"
   116     let g:speckySpecSwitcherKey  = "<C-S>x"
    92     let g:speckyRunSpecKey = "<C-S>s"
   117     let g:speckyRunSpecKey       = "<C-S>s"
    93     let g:speckyRunSpecCmd = "spec -fs -r loadpath.rb"
   118     let g:speckyRunRdocCmd       = "fri -L -f plain"
    94     let g:speckyRunRdocCmd = "fri -L -f plain"
   119     let g:speckyWindowType       = 2
    95     let g:speckyWindowType = 2
   120 
    96 
   121 With these bindings, all Specky commands start with <ctrl-s> ("s" for
    97 
   122 Specky!), followed by a mnemonic function to run:
    98 With these bindings, all specky commands start with <ctrl-s> ("s" for
       
    99 specky!), followed by a mnemonic function to run:
       
   100 
   123 
   101     b ----> Banner creation ~
   124     b ----> Banner creation ~
   102     ' ----> Quote cycling ~
   125     ' ----> Quote cycling ~
   103     r ----> run Rdoc ~
   126     r ----> run Rdoc ~
   104     x ----> code and spec eXchange ~
   127     x ----> code and spec eXchange ~
   105     s ----> run Spec ~
   128     s ----> run rSpec ~
   106 
   129 
   107 Of course, <ctrl-s> is a "suspend" signal for most terminals, so these
   130 Of course, <ctrl-s> is a "suspend" signal for most terminals, so these
   108 bindings are meant for a |gui| environment, such as gvim.  Your mileage (and
   131 bindings are meant for a |gui| environment, such as gvim.  Your mileage (and
   109 tastes) will doubtlessly vary.  Do what you will.  I won't judge you.
   132 tastes) will doubtlessly vary.  Do what you will.  I won't judge you.
   110 
   133 
   111 
   134 
   112 
       
   113 ==============================================================================
   135 ==============================================================================
   114 4. CONFIGURATION-OPTIONS                                       *SpeckyOptions*
   136 4. CONFIGURATION-OPTIONS                                       *SpeckyOptions*
   115 
       
   116 
   137 
   117 Here are all of the available configuration options.
   138 Here are all of the available configuration options.
   118 
   139 
   119 Please note that you must set binding variables:
   140 Please note that you must set binding variables:
   120 
   141 
   122     |g:speckyQuoteSwitcherKey|
   143     |g:speckyQuoteSwitcherKey|
   123     |g:speckyRunRdocKey|
   144     |g:speckyRunRdocKey|
   124     |g:speckySpecSwitcherKey|
   145     |g:speckySpecSwitcherKey|
   125     |g:speckyRunSpecKey|
   146     |g:speckyRunSpecKey|
   126 
   147 
   127 ...in order to enable the respective specky functionality.  See
   148 ...in order to enable the respective Specky functionality.  See
   128 |SpeckyVimrcExample| for details. Any other options are entirely optional.
   149 |SpeckyInstallation| for details. Any other options are entirely optional.
   129 Put these into your |vimrc|, or wherever else you enjoy storing this kind of
   150 Put these into your |vimrc|, or wherever else you enjoy storing this kind of
   130 stuff.
   151 stuff.
   131 
   152 
   132 
   153 
   133 
       
   134 ------------------------------------------------------------------------------
   154 ------------------------------------------------------------------------------
   135 4.1                                                        *g:speckyBannerKey*
   155 4.1                                                        *g:speckyBannerKey*
   136 
       
   137 
   156 
   138 Setting this binding enables comment banner creation.
   157 Setting this binding enables comment banner creation.
   139 
   158 
   140 This is purely a convenience routine, and a stylistic one at that.  I prefer
   159 This is purely a convenience routine, and a stylistic one at that.  I prefer
   141 large advertising of what "area" of code you are in, along with other
   160 large advertising of what "area" of code you are in, along with other
   156 the years, your RSI-free hands will thank you.  And the total time savings!!
   175 the years, your RSI-free hands will thank you.  And the total time savings!!
   157 Oh man, what are you going to DO with all of that extra free time?
   176 Oh man, what are you going to DO with all of that extra free time?
   158 The possibilities are staggering.
   177 The possibilities are staggering.
   159 
   178 
   160 
   179 
   161 
       
   162 ------------------------------------------------------------------------------
   180 ------------------------------------------------------------------------------
   163 4.2                                                 *g:speckyQuoteSwitcherKey*
   181 4.2                                                 *g:speckyQuoteSwitcherKey*
   164 
       
   165 
   182 
   166 Setting this binding enables quote "style switching".
   183 Setting this binding enables quote "style switching".
   167 
   184 
   168 If you aren't in ruby mode, this just changes the word under the cursor
   185 If you aren't in ruby mode, this just changes the word under the cursor
   169 back and forth from double quoting to single quoting.
   186 back and forth from double quoting to single quoting.
   175     "string" -> 'string' -> :string -> "string" ... ~
   192     "string" -> 'string' -> :string -> "string" ... ~
   176 
   193 
   177 Note that quote cycling only works with a |word|.
   194 Note that quote cycling only works with a |word|.
   178 
   195 
   179 
   196 
   180 
       
   181 ------------------------------------------------------------------------------
   197 ------------------------------------------------------------------------------
   182 4.3                                                       *g:speckyRunRdocKey*
   198 4.3                                                       *g:speckyRunRdocKey*
   183 
       
   184 
   199 
   185 Setting this enables the display of rdoc documentation for the current
   200 Setting this enables the display of rdoc documentation for the current
   186 word under the cursor.  For lookups with multiple matches, you can continue
   201 word under the cursor.  For lookups with multiple matches, you can continue
   187 using this binding to "drill down" to the desired documentation.
   202 using this binding to "drill down" to the desired documentation.
   188          
   203          
   189 
   204 
   190 
       
   191 ------------------------------------------------------------------------------
   205 ------------------------------------------------------------------------------
   192 4.4                                                  *g:speckySpecSwitcherKey*
   206 4.4                                                  *g:speckySpecSwitcherKey*
   193 
       
   194 
   207 
   195 Setting this enables spec to code switching, and visa versa.
   208 Setting this enables spec to code switching, and visa versa.
   196 
   209 
   197 Switching uses path searching instead of reliance on directory structure in
   210 Switching uses path searching instead of reliance on directory structure in
   198 your project.  The idea here is that you'd |:chdir| into your project
   211 your project.  The idea here is that you'd |:chdir| into your project
   203  
   216  
   204 Because it leaves respective buffers open, you can essentially think of this
   217 Because it leaves respective buffers open, you can essentially think of this
   205 as a quick toggle between code and tests.
   218 as a quick toggle between code and tests.
   206 
   219 
   207 
   220 
   208 
       
   209 ------------------------------------------------------------------------------
   221 ------------------------------------------------------------------------------
   210 4.5                                                       *g:speckyRunSpecKey*
   222 4.5                                                       *g:speckyRunSpecKey*
   211 
   223 
   212 
   224 Setting this variable runs "rspec" on the current buffer.
   213 Setting this variable runs "spec" on the current buffer.
       
   214 
   225 
   215 All output is sent to a syntax highlighted scratch buffer. This new window is
   226 All output is sent to a syntax highlighted scratch buffer. This new window is
   216 re-used for each spec run.  You can quickly "jump" to assertion failures and
   227 re-used for each spec run.  You can quickly "jump" to assertion failures and
   217 their associated details with the following keys:
   228 their associated details with the following keys:
   218 
   229 
   230         q ~
   241         q ~
   231             Closes the spec output buffer. 
   242             Closes the spec output buffer. 
   232 
   243 
   233 
   244 
   234 Normally, you'd only want to perform this keystroke while in a spec file
   245 Normally, you'd only want to perform this keystroke while in a spec file
   235 buffer.  If specky thinks you are in code, rather than a buffer (as indicated
   246 buffer.  If Specky thinks you are in code, rather than a buffer (as indicated
   236 by the lack of a "_spec.rb" file naming convention) then it will attempt to
   247 by the lack of a "_spec.rb" file naming convention) then it will attempt to
   237 switch to the spec before running the command.
   248 switch to the spec before running the command.
   238 
   249 
   239 
   250 
   240 
       
   241 ------------------------------------------------------------------------------
   251 ------------------------------------------------------------------------------
   242 4.6                                                       *g:speckyRunSpecCmd*
   252 4.6                                                       *g:speckyRunSpecCmd*
   243 
       
   244 
   253 
   245 This is the program, with flags, that the current file is sent to when
   254 This is the program, with flags, that the current file is sent to when
   246 executing the |g:speckyRunSpecKey| keybinding.
   255 executing the |g:speckyRunSpecKey| keybinding.
   247 
   256 
   248 A common addition is to include an "-r" flag for sucking in local libraries
   257 A common addition is to include an "-r" flag for sucking in local libraries
   249 necessary for testing your project.  The spec "plain" output format is
   258 necessary for testing your project.  In fact, this is required to use the 
   250 supported too, though less useful.
   259 rspec formatter supplied by Specky.  See |SpeckyInstallation| for more info.
   251 
   260 
   252     Default: ~
   261     Default: ~
   253         spec -fs
   262         rspec
   254 
       
   255 
   263 
   256 
   264 
   257 ------------------------------------------------------------------------------
   265 ------------------------------------------------------------------------------
   258 4.7                                                       *g:speckyRunRdocCmd*
   266 4.7                                                       *g:speckyRunRdocCmd*
   259 
       
   260 
   267 
   261 If you prefer an rdoc display program other than "ri", you can set it
   268 If you prefer an rdoc display program other than "ri", you can set it
   262 with this variable.  "fri -L -f plain" is always a nice choice, for example.
   269 with this variable.  "fri -L -f plain" is always a nice choice, for example.
   263 
   270 
   264     Default: ~
   271     Default: ~
   265         ri
   272         ri
   266 
   273 
   267 
   274 
   268 
       
   269 ------------------------------------------------------------------------------
   275 ------------------------------------------------------------------------------
   270 4.8                                                       *g:speckyWindowType*
   276 4.8                                                       *g:speckyWindowType*
   271 
       
   272 
   277 
   273 For both spec and rdoc commands, this variable controls the behavior of the
   278 For both spec and rdoc commands, this variable controls the behavior of the
   274 newly generated window.
   279 newly generated window.
   275 
   280 
   276 	Default: ~
   281 	Default: ~
   282 		Split the current window horizontally
   287 		Split the current window horizontally
   283 	2 ~
   288 	2 ~
   284 		Split the current window vertically
   289 		Split the current window vertically
   285 
   290 
   286 
   291 
       
   292 ------------------------------------------------------------------------------
       
   293 4.9                                                      *g:speckySpecVersion*
       
   294 
       
   295 Specky should work out of the box with rspec 2.x.  If you'd like to use rspec
       
   296 1.x instead, you can do so with the following Vim settings: >
       
   297 
       
   298     let g:speckySpecVersion = 1
       
   299 	let g:speckyRunRdocCmd  = "spec -fs" 
       
   300 
       
   301 If you have both rspec 1.x and 2.x installed at the same time, you need to 
       
   302 be explicit with what version you are executing: >
       
   303 
       
   304 	let g:speckyRunRdocCmd  = "spec _1.3.0_ -fs" 
       
   305 
       
   306 
   287 ==============================================================================
   307 ==============================================================================
   288 5. AUTHOR                                                       *SpeckyAuthor*
   308 5. AUTHOR                                                       *SpeckyAuthor*
   289 
   309 
   290 
   310 
   291 Specky was written by Mahlon E. Smith.
   311 Specky was written by Mahlon E. Smith.
   300 
   320 
   301 
   321 
   302 Specky is distributed under the BSD license.
   322 Specky is distributed under the BSD license.
   303     http://www.opensource.org/licenses/bsd-license.php
   323     http://www.opensource.org/licenses/bsd-license.php
   304 >
   324 >
   305     Copyright (c) 2008-2009, Mahlon E. Smith <mahlon@martini.nu>
   325     Copyright (c) 2008-2010, Mahlon E. Smith <mahlon@martini.nu>
   306     All rights reserved.
   326     All rights reserved.
   307 
   327 
   308     Redistribution and use in source and binary forms, with or without
   328     Redistribution and use in source and binary forms, with or without
   309     modification, are permitted provided that the following conditions are
   329     modification, are permitted provided that the following conditions are
   310     met:
   330     met:
   329     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   349     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   330 
   350 
   331 
   351 
   332 
   352 
   333 vim: set noet nosta sw=4 ts=4 ft=help :
   353 vim: set noet nosta sw=4 ts=4 ft=help :
       
   354