sponsor Vim development Vim logo Vim Book Ad

tselectfiles : A quick file selector/browser/explorer (sort of)

 script karma  Rating 884/221, Downloaded by 4483  Comments, bugs, improvements  Vim wiki

created by
Tom Link
script type
This plugin provides a simple file browser. It is not a full blown
explorer but can be nevertheless be useful for quickly selecting a few
files or renaming them.

As the plugin does some caching in the background, the filelist is only
generated once for each path or when called with [!]. In conjuncture
with the use of the [wbg]:tselectfile_filter_rx variable, this provides
for use as a simple ad-hoc project manager.

When I open a file under "~/vimfiles", I set b:tselectfiles_dir
to all the relevant directories under "~/vimfiles" and then set
b:tselectfile_filter_rx = expand('%:t:r'). Thus, when I open
"~/vimfiles/plugin/foo.vim", b:tselectfile_filter_rx is "foo", and
:TSelectFiles shows all the files under "~/vimfiles" matching "foo".

    - list files (recursively or the in the current directory only),
      dynamically select files matching a pattern
    - open files
    - preview files
    - rename/move files
    - batch rename/move files (using a regular expression)
    - copy files
    - delete files
    - show file info

Advanced uses:

Related files: If you set |g:tselectfiles_filter_rx| to some appropriate
value, only files matching that regexp will be shown initially. This can
be used to restrict the list to "related" files. (The initial filter can
be removed by pressing <c-bs>.) See also |tselectfiles#BaseFilter()| and

Rolodex: If a filename matches an entry in
|g:tselectfiles_filedescription_rx| (a dictionnary patter => funcref),
funcref(filename) will be called to retrieve the file's description.
This function could be used to extract metadata or selected lines from
the file etc. By mapping one record onto one file, you would get some
sort of rolodex-like database. See
|tselectfiles#FormatVikiMetaDataOrFirstLine()| for an example for
viki/deplate (vimscript #861) formatted files.

Demo: http://vimsomnia.blogspot.com/2012/09/tselectfiles-demo.html
install details
Edit the vba file and type: >

    :so %

See :help vimball for details. If you have difficulties, please make
sure, you have the current version of vimball (vimscript #1502)

This script requires tlib (vimscript #1863) to be installed.

Also available via git

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
tselectfiles.vba 0.11 2012-09-16 7.0 Tom Link - tselectfiles#AgentPreviewFile(): redraw
- Convert encoding if the assumed &fenc != &enc
- tselectfiles#FormatVikiMetaDataOrFirstLine: Reversed argument order (world is optional)
- Renamed variables named g:tselectfiles_* to g:tselectfiles#*
- .gitignore
- g:tselectfiles#use_vcs
MD5 checksum: 41885c7229478d59e37fd7a222767a61
tselectfiles.vba.gz 0.10 2009-10-11 7.0 Tom Link - :TSelectFiles, :TSelectFilesInSubdirs, tselectfiles#SelectFiles: take
an initial pattern as the second optional argument (i.e. if you pass a
directory as first optional argument, you'll have to escape blanks with
a backslash).
- tselectfiles#SelectFiles: if dir is &, search &path
- tselectfiles_filter_rx is always evaluated unless a pattern is
provided as extra argument
- tselectfiles_prefix is always evaluated
tselectfiles.vba.gz 0.9 2009-02-12 7.0 Tom Link - Don't assume s:select_files_pattern.limit is set
- Include .* in tselectfiles_hidden_rx
- FIX: Include .* files (but hide them by default; thanks to
naquad/Daniil F.).
- FIX: If 'splitbelow' is false, opening buffers in split view didn't
properly work (thanks to naquad/Daniil F.)
tselectfiles.vba.gz 0.8 2008-12-02 7.0 Tom Link - Require tlib 0.28
tselectfiles.vba.gz 0.7 2008-10-16 7.0 Tom Link - NEW: g:tselectfiles_part_subst* variables (for use with tselectfiles#BaseFilter())
- NEW: [bg]:tselectfiles_filter_basename variable (if true, match on basename only)
tselectfiles.vba.gz 0.6 2008-10-05 7.0 Tom Link - [gbw]tselectfiles_prefix: Remove prefix from filenames in list
- [gbw]tselectfiles_limit variable
- [wbg]:tselectfiles_filter_rx is used only when no directory is given on the command line.
- Require tlib >= 0.18
- If the filename matches an entry in g:tselectfiles_filedescription_rx, use the expression there to construct a file description (eg the file's first line)
- Option to run vimgrep on selected files.
- tselectfiles#BaseFilter(): Set b:tselectfiles_filter_rx to something useful.
- tselectfiles#BaseFilter(): takes 2 optional arguments to substitute a rx in the current buffer's filename.
- tselectfiles_filter_rx: Set as array
- Problem when browsing single directories
tselectfiles.vba.gz 0.4 2007-09-11 7.0 Tom Link - "Delete file" will ask whether to delete a corresponding buffer too.
- <c-w> ... View file in original window
- Disabled <c-o> Open dir
- Require tlib >= 0.13
- When renaming a file that's loaded, rename also the buffer.
- You can filter the list of selected files via setting the
[wbg]:tselectfiles_filter_rx variable.
- Renamed g:tselectfiles_no_cache to g:tselectfiles_no_cache_rx
- [bg]:tselectfiles_use_cache and [bg]:tselectfiles_no_cache_rx can now
also be set per buffer.
- Renamed some variables from tselectfile_* to tselectfiles_*.
- Can be "suspended" (i.e. you can switch back to the orignal window)
tselectfiles.vim 0.2 2007-07-17 7.0 Tom Link - Require tlib 0.9
- "Delete file" will ask whether to delete a corresponding buffer too.
tselectfiles.vim 0.1 2007-04-18 7.0 Tom Link 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.
Vim at Github