# _M.textadept.snapopen

Quickly open files in a set of directories using a filtered list dialog.

- - -

## Fields

- - -

<a id="MAX"></a>
### `MAX` (number)

The maximum number of files to list.
  The default value is `1000`.

- - -


## Functions

- - -

<a id="open"></a>
### `open`(*utf8\_paths, filter, exclude\_FILTER*)

Quickly open files from the set of directories *utf8_paths* using a filtered
list dialog.
Files shown in the dialog do not match any pattern in string or table
*filter*, and, unless *exclude_FILTER* is `true`, `FILTER` as well. A filter
table contains Lua patterns that match filenames to exclude. Patterns
starting with '!' exclude files that do not match the pattern that follows.
The filter may also contain an `extensions` key whose value is a table of
file extensions to exclude. Additionally, it may contain a `folders` key
whose value is a table of folder names to exclude. Extensions and folder
names must be encoded in UTF-8. The number of files in the list is capped at
`MAX`.

Parameters:

* *`utf8_paths`*: A UTF-8 string directory path or table of UTF-8 directory
  paths to search.
* *`filter`*: Optional filter for files and folders to exclude.
* *`exclude_FILTER`*: Optional flag indicating whether or not to exclude the
  default filter `FILTER` in the search. If `false`, adds `FILTER` to
  *filter*.
  The default value is `false` to include the default filter.

Usage:

* `_M.textadept.snapopen.open(buffer.filename:match('^.+/')) -- list all
  files in the current file's directory, subject to the default filter`
* `_M.textadept.snapopen.open('/project', '!%.lua$') -- list all Lua
   files in a project directory`
* `_M.textadept.snapopen.open('/project', {folders = {'build'}}) -- list
  all source files in a project directory`

See also:

* [`gui.find.FILTER`](gui.find.html#FILTER)
* [`MAX`](#MAX)

- - -


