sponsor Vim development Vim logo Vim Book Ad

TUT (toggle_unit_tests) : A plug-in for toggling between source and unit test files

 script karma  Rating 15/9, Downloaded by 1024  Comments, bugs, improvements  Vim wiki

created by
Pete Johns
 
script type
utility
 
description
Usage:

Use this plug-in when you are doing Test-Driven Development [TDD] in any
language to quickly switch between unit-test and production code. To make this
really fast bind the Toggle function to a function key in your .vimrc:

    "   [F3]    toggles between (header, ) source and test files.
    nnoremap    <F3> :<C-U>TUT<CR>

This plug-in assumes source and unit test files are in the same directory.

Commands:

:TUT
    Toggles betwixt source and unit test file

Mappings:

<Leader>tut
    Calls :TUT

Settings:

By default, unit-test filenames are deemed to begin with 't_'.

Tell toggle_unit_tests.vim your own prefix by setting the following global
variable, perhaps in your .vimrc:

    let g:unit_test_prefix='test_'

Update:

You can now grab the latest version, submit an improvement or report a bug on
GitHub:

    http://github.com/johnsyweb/vim-tut/
 
install details
I recommend installing pathogen.vim (vimscript#2332), and then simply copy and paste:

    cd ~/.vim/bundle
    git clone git://github.com/johnsyweb/vim-tut.git
    vim -cHelptags -cq

Once help tags have been generated, you can view the manual with:

    :help toggle_unit_tests

Alternatively, just unzip the file into your 'runtimepath' and run :helptags.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-tut-1.2.zip 1.2 2014-02-27 7.0 Pete Johns https://github.com/johnsyweb/vim-tut/compare/1.1...1.2
toggle_unit_tests.vba 1.1 2009-08-05 7.0 Pete Johns Fixed annoying bug where if a file was already loaded into a buffer, the cursor would move to the top when switching.

Refactored code to make easier to read and maintain.
toggle_unit_tests.vba 1.0 2009-01-01 7.0 Pete Johns Initial upload
ip used for rating: 18.224.149.242

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github