Textadept
- Home |
- Download |
- Lua API |
- Source |
- Language Modules |
- Stats |
- Wiki |
- Mailing List
_M.textadept.snapopen
Snapopen for the textadept module.
Examples
local snapopen = _M.textadept.snapopen.open
-- Show all files in PATHS.
snapopen()
-- Show all files in the current file's directory.
snapopen(buffer.filename:match('^(.+)[/\\]'), nil, true)
-- Show all Lua files in PATHS.
snapopen(nil, '!%.lua$')
-- Ignore the project's 'images' folder and HTML pages.
snapopen('/path/to/project', {
folders = { 'images' },
extensions = { 'html' }
}, true)
Fields
DEFAULT_DEPTH
(number)
Maximum directory depth to search. The default value is 4
.
MAX
(number)
Maximum number of files to list. The default value is 1000
.
Functions
open
(utf8_paths, filter, exclude_PATHS, exclude_FILTER, depth)
Quickly open a file in set of directories.
Parameters:
utf8_paths
: A UTF-8 string directory path or table of UTF-8 directory paths to search.filter
: A filter for files and folders to exclude. The filter may be a string or table. Each filter is a Lua pattern. Any files matching a filter are excluded. Prefix a pattern with!
to exclude any files that do not match the filter. File extensions can be more efficiently excluded by adding the extension text to a table assigned to anextensions
key in the filter table instead of using individual filters. Directories can be excluded by adding filters to a table assigned to afolders
key in the filter table. All strings should be UTF-8 encoded.exclude_PATHS
: Flag indicating whether or not to excludePATHS
in the search. The default value isfalse
.exclude_FILTER
: Flag indicating whether or not to excludeFILTER
fromfilter
in the search. If false, addsFILTER
to the givenfilter
. The default value isfalse
.depth
: Number of directories to recurse into for finding files. The default value isDEFAULT_DEPTH
.
Usage:
_M.textadept.snapopen.open()
_M.textadept.snapopen.open(buffer.filename:match('^.+/'), nil, true)
_M.textadept.snapopen.open(nil, '!%.lua$')
_M.textadept.snapopen.open(nil, { folders = { '%.hg' } })
Tables
FILTER
Default file and directory filters.
PATHS
Table of default UTF-8 paths to search.