Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

263 lines (202 sloc) 12.865 kB
*tselectfiles.txt* A simplicistic files selector/browser (sort of)
Author: Tom Link, micathom at gmail com
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. If you set |g:tlib_inputlist_match| to "fuzzy",
it behaves similar to the FuzzyFinder, command-t, or CtrlP plugins.
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.
EXAMPLE:
When opening 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".
Features:
- 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
|g:tselectfiles#part_subst|.
Rolodex: If a filename matches an entry in
|g:tselectfiles#filedescription_rx| (a dictionnary: pattern =>
function_format_string with one place-holder %s), 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.
-----------------------------------------------------------------------
Install~
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)
installed.
This script requires tlib (vimscript #1863) to be installed.
Suggested maps (to be set in ~/.vimrc): >
noremap <m-f> :TSelectFiles<cr>
========================================================================
Contents~
:TSelectFiles ................................ |:TSelectFiles|
:TSelectFilesInSubdirs ....................... |:TSelectFilesInSubdirs|
g:tselectfiles#use_cache ..................... |g:tselectfiles#use_cache|
g:tselectfiles#no_cache_rx ................... |g:tselectfiles#no_cache_rx|
g:tselectfiles#filter_rx ..................... |g:tselectfiles#filter_rx|
g:tselectfiles#part_subst .................... |g:tselectfiles#part_subst|
g:tselectfiles#part_subst_ruby ............... |g:tselectfiles#part_subst_ruby|
g:tselectfiles#limit ......................... |g:tselectfiles#limit|
g:tselectfiles#filedescription_rx ............ |g:tselectfiles#filedescription_rx|
g:tselectfiles#filter_basename ............... |g:tselectfiles#filter_basename|
g:tselectfiles#prefix ........................ |g:tselectfiles#prefix|
g:tselectfiles#use_vcs ....................... |g:tselectfiles#use_vcs|
g:tselectfiles#world ......................... |g:tselectfiles#world|
g:tselectfiles#suffixes ...................... |g:tselectfiles#suffixes|
g:tselectfiles#hidden_rx ..................... |g:tselectfiles#hidden_rx|
g:tselectfiles#show_quickfix_list ............ |g:tselectfiles#show_quickfix_list|
tselectfiles#GetFileList ..................... |tselectfiles#GetFileList()|
tselectfiles#AgentPostprocess ................ |tselectfiles#AgentPostprocess()|
tselectfiles#AgentOpenDir .................... |tselectfiles#AgentOpenDir()|
tselectfiles#AgentReset ...................... |tselectfiles#AgentReset()|
tselectfiles#AgentDeleteFile ................. |tselectfiles#AgentDeleteFile()|
tselectfiles#Grep ............................ |tselectfiles#Grep()|
tselectfiles#ViewFile ........................ |tselectfiles#ViewFile()|
tselectfiles#AgentPreviewFile ................ |tselectfiles#AgentPreviewFile()|
tselectfiles#AgentCopyFile ................... |tselectfiles#AgentCopyFile()|
tselectfiles#AgentRenameFile ................. |tselectfiles#AgentRenameFile()|
tselectfiles#AgentBatchRenameFile ............ |tselectfiles#AgentBatchRenameFile()|
tselectfiles#AgentSelectBackups .............. |tselectfiles#AgentSelectBackups()|
tselectfiles#AgentHide ....................... |tselectfiles#AgentHide()|
tselectfiles#FormatFirstLine ................. |tselectfiles#FormatFirstLine()|
tselectfiles#FormatVikiMetaDataOrFirstLine ... |tselectfiles#FormatVikiMetaDataOrFirstLine()|
tselectfiles#Highlight ....................... |tselectfiles#Highlight()|
tselectfiles#FormatEntry ..................... |tselectfiles#FormatEntry()|
tselectfiles#FormatFilter .................... |tselectfiles#FormatFilter()|
tselectfiles#SelectFiles ..................... |tselectfiles#SelectFiles()|
tselectfiles#BaseFilter ...................... |tselectfiles#BaseFilter()|
========================================================================
plugin/tselectfiles.vim~
*:TSelectFiles*
:TSelectFiles[!] [DIR]
Open/delete/rename files in the current directory.
A [!] forces the commands to rescan the directory. Otherwise a cached
value will be used if available.
You can also type <c-r> to force rescanning a directory, which could
be necessary if the file system were changed (e.g. by creating a new
file or by some external command)
*:TSelectFilesInSubdirs*
:TSelectFilesInSubdirs
Recursively show all files in the current directory and subdirectories
(don't show favourites and ".."); don't use this command when you're
at /.
A [!] forces the commands to rescan the directory. Otherwise a cached
value will be used if available.
========================================================================
autoload/tselectfiles.vim~
*g:tselectfiles#use_cache*
g:tselectfiles#use_cache (default: 1)
Whether to cache directory listings (in memory). (per buffer, global)
If 0, disable the use of cached file listings all together.
*g:tselectfiles#no_cache_rx*
g:tselectfiles#no_cache_rx (default: '')
Don't use the cache for directories matching this rx. (per buffer,
global)
*g:tselectfiles#filter_rx*
g:tselectfiles#filter_rx (default: '')
Retain only files matching this regexp. (per window, per buffer, global)
Regexp |magic| must match the setting of |g:tlib_inputlist_match|.
Check: :echo tlib#Filter_{g:tlib_inputlist_match}#New().FilterRxPrefix()
*g:tselectfiles#part_subst*
g:tselectfiles#part_subst (default: {})
In |tselectfiles#BaseFilter()|, rewrite name parts according to these
rules.
*g:tselectfiles#part_subst_ruby*
g:tselectfiles#part_subst_ruby (default: {'s$': '', '^\(controller\|test\|spec\)$': ''})
Poor man's singularize etc.
*g:tselectfiles#limit*
g:tselectfiles#limit (default: 0)
The max depth when globbing directories recursively. 0 = no limit.
*g:tselectfiles#filedescription_rx*
g:tselectfiles#filedescription_rx (default: {})
A dictionary of REGEXP => "FUNCTION(%s)" where FUNCTION is the name of
a function that is used to describe a file -- by default this is the
filename.
*g:tselectfiles#filter_basename*
g:tselectfiles#filter_basename (default: 0)
Apply filters to basename only.
*g:tselectfiles#prefix*
g:tselectfiles#prefix (default: '')
Remove prefix from filenames in list.
buffer-local, global
*g:tselectfiles#use_vcs*
g:tselectfiles#use_vcs (default: 1)
If true and the current buffer is under a VCS, use all files in that
repository.
*g:tselectfiles#world*
g:tselectfiles#world (default: {)
*g:tselectfiles#suffixes*
g:tselectfiles#suffixes (default: printf('\(%s\)\$', join(map(split(&suffixes, ','), 'v:val'), '\|')))
*g:tselectfiles#hidden_rx*
g:tselectfiles#hidden_rx (default: '\V\(/tags\$\|/CVS/\|/.attic/\|/.svn/\|/\(vimfiles\|.vim\)\(/\[^/]\+\)\{-}/cache/\|'. tlib#rx#Suffixes('V') .'\)')
Don't include files matching this regexp.
TLet g:tselectfiles#hidden_rx = '\V\(/.\|/CVS/\|/.attic/\|/.svn/\|/\(vimfiles\|.vim\)\(/\[^/]\+\)\{-}/cache/\|'. tlib#rx#Suffixes('V') .'\)'
*g:tselectfiles#show_quickfix_list*
g:tselectfiles#show_quickfix_list (default: 'TRagcw')
" TODO: cwindow doesn't currently work as expected
TLet g:tselectfiles#show_quickfix_list = exists(':TRagcw') ? 'TRagcw' : 'cwindow'
The command that is run to show the quickfix list after running grep.
*tselectfiles#GetFileList()*
tselectfiles#GetFileList(world, mode, ...)
*tselectfiles#AgentPostprocess()*
tselectfiles#AgentPostprocess(world, result)
*tselectfiles#AgentOpenDir()*
tselectfiles#AgentOpenDir(world, selected)
*tselectfiles#AgentReset()*
tselectfiles#AgentReset(world, selected)
*tselectfiles#AgentDeleteFile()*
tselectfiles#AgentDeleteFile(world, selected)
*tselectfiles#Grep()*
tselectfiles#Grep(world, selected)
*tselectfiles#ViewFile()*
tselectfiles#ViewFile(world, selected)
*tselectfiles#AgentPreviewFile()*
tselectfiles#AgentPreviewFile(world, selected)
*tselectfiles#AgentCopyFile()*
tselectfiles#AgentCopyFile(world, selected)
*tselectfiles#AgentRenameFile()*
tselectfiles#AgentRenameFile(world, selected)
*tselectfiles#AgentBatchRenameFile()*
tselectfiles#AgentBatchRenameFile(world, selected)
*tselectfiles#AgentSelectBackups()*
tselectfiles#AgentSelectBackups(world, selected)
*tselectfiles#AgentHide()*
tselectfiles#AgentHide(world, selected)
*tselectfiles#FormatFirstLine()*
tselectfiles#FormatFirstLine(filename)
*tselectfiles#FormatVikiMetaDataOrFirstLine()*
tselectfiles#FormatVikiMetaDataOrFirstLine(filename, ...)
*tselectfiles#Highlight()*
tselectfiles#Highlight(world)
*tselectfiles#FormatEntry()*
tselectfiles#FormatEntry(world, filename)
*tselectfiles#FormatFilter()*
tselectfiles#FormatFilter(world, filename)
*tselectfiles#SelectFiles()*
tselectfiles#SelectFiles(mode, ?dir='', ?pattern='')
If dir is empty or "*", the current file's directory is used.
If dir is "&", &path is used.
*tselectfiles#BaseFilter()*
tselectfiles#BaseFilter(?rx='', ?replace='')
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:
Jump to Line
Something went wrong with that request. Please try again.