sponsor Vim development Vim logo Vim Book Ad

testname : Generate unused file name for testing purpose

 script karma  Rating 0/0, Downloaded by 807  Comments, bugs, improvements  Vim wiki

created by
Andy Wokula
script type
Get an unused file name for testing purpose.

File names are counted A1,A2,..,A9,B10,..,B99,C100,..  Several "sets" can be
defined.  A set specifies path and extension of the file name to be
generated.  Files named "lastnr.dat" maintain the counter(s) for each set.
Select a set with a KEY.  An expr-abbr is a useful way to trigger the

Usage: edit a new test file:
    :new tn#

Customization: variables in the vimrc

g:testname#set    (dictionary)

    :let g:testname#set = {}
    :let g:testname#set[KEY] = { "ext": EXT, "path": PATH [, "lnk": LNPK] }
    KEY - (string) the selector; for use in the abbreviation, e.g. "vim"
    EXT - (string) extension for the file name to be generated, e.g. ".vim"
    PATH - (string) path in which to create the new files and "lastnr.dat"
        (user creates the files, script only creates lastnr.dat)
    LNPK - (string) optional selector to choose the path for lastnr.dat from
        another set; "LastNr.dat Path Key".  Makes it possible to have a
        single lastnr.dat file for all paths.
    * You can overwrite the one default KEY "vim".
    * Different KEYs can share PATH (the lastnr file contains a line for
      each KEY), only PATH + EXT must be unique (in general).

g:testname#lastnrfile     (string)

    name of lastnr-file in PATH; must be given without (esp. absolute) path;
    default is "lastnr.dat"

g:testname#firstnr    (string)

    first "number" to be used, default "A1"
install details
put the script in your autoload folder

customize g:testname#set

setup an abbrevation for each set, the following will work with default
    :cabbr <expr> tn# testname#GetFreeName("vim")

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
testname.vim 0.1 2009-10-19 7.0 Andy Wokula Initial upload
ip used for rating:

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.