diff options
33 files changed, 880 insertions, 207 deletions
diff --git a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml index b5b7687bf8..0ed163c9be 100644 --- a/.github/ISSUE_TEMPLATE/lsp_bug_report.yml +++ b/.github/ISSUE_TEMPLATE/lsp_bug_report.yml @@ -29,13 +29,6 @@ body: - type: textarea attributes: - label: ':checkhealth' - description: | - Paste the results from `nvim -c ":checkhealth nvim lspconfig"` - render: markdown - - - type: textarea - attributes: label: 'Steps to reproduce using "nvim -u minimal_init.lua"' description: | - Download the minimal config with `curl -LO https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/test/minimal_init.lua` and modify it to include any specific commands or servers pertaining to your issues. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d906b949c..b650c5dd85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,7 +171,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Setup commom environment variables + - name: Setup common environment variables run: ./.github/workflows/env.sh ${{ matrix.flavor }} - name: Install apt packages diff --git a/.luacheckrc b/.luacheckrc index 487f5ab552..9bbd323e84 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -26,6 +26,10 @@ read_globals = { "vim", } +globals = { + "vim.g", +} + exclude_files = { 'test/functional/fixtures/lua/syntax_error.lua', } diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index e73634c632..0daca0de53 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -45,7 +45,7 @@ start with a TCP/IP socket instead, use |--listen| with a TCP-style address: > More endpoints can be started with |serverstart()|. Note that localhost TCP sockets are generally less secure than named pipes, -and can lead to vunerabilities like remote code execution. +and can lead to vulnerabilities like remote code execution. Connecting to the socket is the easiest way a programmer can test the API, which can be done through any msgpack-rpc client library or full-featured @@ -198,7 +198,7 @@ any of these approaches: 2. Start Nvim with |--api-info|. Useful for statically-compiled clients. Example (requires Python "pyyaml" and "msgpack-python" modules): > - nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' + nvim --api-info | python -c 'import msgpack, sys, yaml; yaml.dump(msgpack.unpackb(sys.stdin.buffer.read()), sys.stdout)' < 3. Use the |api_info()| Vimscript function. > :lua print(vim.inspect(vim.fn.api_info())) @@ -468,7 +468,7 @@ extmark position and enter some text, the extmark migrates forward. > f o o z|b a r line (| = cursor) 4 extmark (after typing "z") -If an extmark is on the last index of a line and you inputsa newline at that +If an extmark is on the last index of a line and you inputs a newline at that point, the extmark will accordingly migrate to the next line: > f o o z b a r| line (| = cursor) @@ -667,14 +667,17 @@ nvim_add_user_command({name}, {command}, {*opts}) {opts} Optional command attributes. See |command-attributes| for more details. To use boolean attributes (such as |:command-bang| or - |:command-bar|) set the value to "true". When - using a Lua function for {command} you can also - provide a "desc" key that will be displayed - when listing commands. In addition to the - string options listed in |:command-complete|, - the "complete" key also accepts a Lua function - which works like the "customlist" completion - mode |:command-complete-customlist|. + |:command-bar|) set the value to "true". In + addition to the string options listed in + |:command-complete|, the "complete" key also + accepts a Lua function which works like the + "customlist" completion mode + |:command-completion-customlist|. Additional + parameters: + • desc: (string) Used for listing the command + when a Lua function is used for {command}. + • force: (boolean, default true) Override any + previous definition. nvim_call_atomic({calls}) *nvim_call_atomic()* Calls many API methods atomically. diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 3df8d5ced4..46d9a3b57a 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -840,6 +840,9 @@ RecordingLeave When a macro stops recording. register. |reg_recorded()| is only updated after this event. + Sets these |v:event| keys: + regcontents + regname *SessionLoadPost* SessionLoadPost After loading the session file created using the |:mksession| command. diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index 5f376a600e..e14427494d 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -44,7 +44,7 @@ functions like |chansend()| consume channel ids. 2. Reading and writing raw bytes *channel-bytes* Channels opened by Vimscript functions operate with raw bytes by default. For -a job channel using RPC, bytes can still be read over its stderr. Similarily, +a job channel using RPC, bytes can still be read over its stderr. Similarly, only bytes can be written to Nvim's own stderr. *channel-callback* diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 7127c74134..178b0dc62b 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -105,7 +105,7 @@ in eval.c: - eval_call_provider(name, method, arguments, discard): calls provider#{name}#Call with the method and arguments. If discard is true, any - value returned by the provider will be discarded and and empty value be + value returned by the provider will be discarded and empty value will be returned. - eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable which must be set to 2 by the provider script to indicate that it is diff --git a/runtime/doc/lsp-extension.txt b/runtime/doc/lsp-extension.txt index d13303ada6..6e9ad940c7 100644 --- a/runtime/doc/lsp-extension.txt +++ b/runtime/doc/lsp-extension.txt @@ -60,7 +60,7 @@ The example will: return nil end local dir = bufname - -- Just in case our algo is buggy, don't infinite loop. + -- Just in case our algorithm is buggy, don't infinite loop. for _ = 1, 100 do local did_change dir, did_change = dirname(dir) diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 614dd82443..bb42a87034 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -887,10 +887,10 @@ start_client({config}) *vim.lsp.start_client()* default true): Allow using incremental sync for buffer edits • debounce_text_changes (number, - default nil): Debounce didChange + default 150): Debounce didChange notifications to the server by the given number in milliseconds. No - debounce occurs if nil + debounce occurs if set to 0. • exit_timeout (number, default 500): Milliseconds to wait for server to exit cleanly after sending the diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c6bca087c8..e3b66c94ba 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -274,7 +274,7 @@ arguments separated by " " (space) instead of "\t" (tab). lua << EOF local linenr = vim.api.nvim_win_get_cursor(0)[1] local curline = vim.api.nvim_buf_get_lines( - 0, linenr, linenr + 1, false)[1] + 0, linenr - 1, linenr, false)[1] print(string.format("Current line [%d] has %d bytes", linenr, #curline)) EOF diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index 935d958729..62e13285f5 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -133,7 +133,7 @@ capabilities as if they had been in the terminfo definition. If terminfo does not (yet) have this flag, Nvim will fall back to $TERM and other environment variables. It will add constructed "setrgbf" and "setrgbb" -capabilities in the case of the the "rxvt", "linux", "st", "tmux", and "iterm" +capabilities in the case of the "rxvt", "linux", "st", "tmux", and "iterm" terminal types, or when Konsole, genuine Xterm, a libvte terminal emulator version 0.36 or later, or a terminal emulator that sets the COLORTERM environment variable to "truecolor" is detected. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 5f238fb2ff..7de6a0f890 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -210,7 +210,7 @@ Here is a list of built-in predicates : < `match?` *ts-predicate-match?* `vim-match?` *ts-predicate-vim-match?* - This will match if the provived vim regex matches the text + This will match if the provided vim regex matches the text corresponding to a node : > ((identifier) @constant (#match? @constant "^[A-Z_]+$")) < Note: the `^` and `$` anchors will respectively match the diff --git a/runtime/filetype.lua b/runtime/filetype.lua index 3177705b65..fcfc5701f0 100644 --- a/runtime/filetype.lua +++ b/runtime/filetype.lua @@ -9,7 +9,7 @@ end vim.cmd [[ augroup filetypedetect -au BufRead,BufNewFile * call v:lua.vim.filetype.match(str2nr(expand('<abuf>'))) +au BufRead,BufNewFile * call v:lua.vim.filetype.match(expand('<afile>')) " These *must* be sourced after the autocommand above is created runtime! ftdetect/*.vim @@ -20,3 +20,7 @@ let g:did_load_ftdetect = 1 augroup END ]] + +if not vim.g.ft_ignore_pat then + vim.g.ft_ignore_pat = "\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$" +end diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index f7048f3709..54b20f7391 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -19,7 +19,13 @@ local function starsetf(ft) }} end +---@private +local function getline(bufnr, lnum) + return api.nvim_buf_get_lines(bufnr, lnum-1, lnum, false)[1] +end + -- Filetypes based on file extension +-- luacheck: push no unused args local extension = { -- BEGIN EXTENSION ["8th"] = "8th", @@ -635,6 +641,13 @@ local extension = { tssop = "tssop", tutor = "tutor", twig = "twig", + ts = function(path, bufnr) + if getline(bufnr, 1):find("<%?xml") then + return "xml" + else + return "typescript" + end + end, tsx = "typescriptreact", uc = "uc", uit = "uil", @@ -774,6 +787,12 @@ local extension = { xml = function() vim.fn["dist#ft#FTxml"]() end, y = function() vim.fn["dist#ft#FTy"]() end, zsql = function() vim.fn["dist#ft#SQL"]() end, + txt = function(path, bufnr) + --helpfiles match *.txt, but should have a modeline as last line + if not getline(bufnr, -1):match("vim:.*ft=help") then + return "text" + end + end, -- END EXTENSION } @@ -1075,7 +1094,7 @@ local pattern = { [".*/etc/a2ps%.cfg"] = "a2ps", [".*/usr/share/alsa/alsa%.conf"] = "alsaconf", [".*/etc/asound%.conf"] = "alsaconf", - [".*/etc/apache2/sites-.*/.*%.com"] = "apache", + [".*/etc/apache2/sites%-.*/.*%.com"] = "apache", [".*/etc/httpd/.*%.conf"] = "apache", [".*/%.aptitude/config"] = "aptconf", ["[mM]akefile%.am"] = "automake", @@ -1096,7 +1115,7 @@ local pattern = { ["dictd.*%.conf"] = "dictdconf", [".*/etc/DIR_COLORS"] = "dircolors", [".*/etc/dnsmasq%.conf"] = "dnsmasq", - ["php%.ini-.*"] = "dosini", + ["php%.ini%-.*"] = "dosini", [".*/etc/pacman%.conf"] = "dosini", [".*/etc/yum%.conf"] = "dosini", [".*lvs"] = "dracula", @@ -1122,7 +1141,7 @@ local pattern = { [".*/boot/grub/grub%.conf"] = "grub", [".*/boot/grub/menu%.lst"] = "grub", [".*/etc/grub%.conf"] = "grub", - ["hg-editor-.*%.txt"] = "hgcommit", + ["hg%-editor%-.*%.txt"] = "hgcommit", [".*/etc/host%.conf"] = "hostconf", [".*/etc/hosts%.deny"] = "hostsaccess", [".*/etc/hosts%.allow"] = "hostsaccess", @@ -1190,7 +1209,7 @@ local pattern = { [".*/etc/serial%.conf"] = "setserial", [".*/etc/udev/cdsymlinks%.conf"] = "sh", [".*%._sst%.meta"] = "sisu", - [".*%.-sst%.meta"] = "sisu", + [".*%.%-sst%.meta"] = "sisu", [".*%.sst%.meta"] = "sisu", [".*/etc/slp%.conf"] = "slpconf", [".*/etc/slp%.reg"] = "slpreg", @@ -1199,7 +1218,7 @@ local pattern = { [".*/%.ssh/config"] = "sshconfig", [".*/etc/ssh/sshd_config%.d/.*%.conf"] = "sshdconfig", [".*/etc/sudoers"] = "sudoers", - ["svn-commit.*%.tmp"] = "svn", + ["svn%-commit.*%.tmp"] = "svn", [".*%.swift%.gyb"] = "swiftgyb", [".*/etc/sysctl%.conf"] = "sysctl", [".*/etc/sysctl%.d/.*%.conf"] = "sysctl", @@ -1253,20 +1272,20 @@ local pattern = { [".*/%.gitconfig%.d/.*"] = starsetf('gitconfig'), [".*/%.neomutt/neomuttrc.*"] = starsetf('neomuttrc'), [".*/Xresources/.*"] = starsetf('xdefaults'), - [".*/app-defaults/.*"] = starsetf('xdefaults'), + [".*/app%-defaults/.*"] = starsetf('xdefaults'), [".*/bind/db%..*"] = starsetf('bindzone'), [".*/debian/patches/.*"] = function() vim.fn["dist#ft#Dep3patch"]() end, [".*/etc/Muttrc%.d/.*"] = starsetf('muttrc'), [".*/etc/apache2/.*%.conf.*"] = starsetf('apache'), [".*/etc/apache2/conf%..*/.*"] = starsetf('apache'), - [".*/etc/apache2/mods-.*/.*"] = starsetf('apache'), - [".*/etc/apache2/sites-.*/.*"] = starsetf('apache'), + [".*/etc/apache2/mods%-.*/.*"] = starsetf('apache'), + [".*/etc/apache2/sites%-.*/.*"] = starsetf('apache'), [".*/etc/cron%.d/.*"] = starsetf('crontab'), [".*/etc/dnsmasq%.d/.*"] = starsetf('dnsmasq'), [".*/etc/httpd/conf%..*/.*"] = starsetf('apache'), [".*/etc/httpd/conf%.d/.*%.conf.*"] = starsetf('apache'), - [".*/etc/httpd/mods-.*/.*"] = starsetf('apache'), - [".*/etc/httpd/sites-.*/.*"] = starsetf('apache'), + [".*/etc/httpd/mods%-.*/.*"] = starsetf('apache'), + [".*/etc/httpd/sites%-.*/.*"] = starsetf('apache'), [".*/etc/logcheck/.*%.d.*/.*"] = starsetf('logcheck'), [".*/etc/modprobe%..*"] = starsetf('modconf'), [".*/etc/pam%.d/.*"] = starsetf('pamconf'), @@ -1276,7 +1295,7 @@ local pattern = { [".*/etc/sudoers%.d/.*"] = starsetf('sudoers'), [".*/etc/xinetd%.d/.*"] = starsetf('xinetd'), [".*/etc/yum%.repos%.d/.*"] = starsetf('dosini'), - [".*/gitolite-admin/conf/.*"] = starsetf('gitolite'), + [".*/gitolite%-admin/conf/.*"] = starsetf('gitolite'), [".*/named/db%..*"] = starsetf('bindzone'), [".*/tmp/lltmp.*"] = starsetf('gedcom'), [".*asterisk.*/.*voicemail%.conf.*"] = starsetf('asteriskvm'), @@ -1297,7 +1316,7 @@ local pattern = { ["access%.conf.*"] = starsetf('apache'), ["apache%.conf.*"] = starsetf('apache'), ["apache2%.conf.*"] = starsetf('apache'), - ["bash-fc[-%.]"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end, + ["bash%-fc[-%.]"] = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end, ["cabal%.project%..*"] = starsetf('cabalproject'), ["crontab%..*"] = starsetf('crontab'), ["drac%..*"] = starsetf('dracula'), @@ -1306,14 +1325,16 @@ local pattern = { ["lilo%.conf.*"] = starsetf('lilo'), ["neomuttrc.*"] = starsetf('neomuttrc'), ["proftpd%.conf.*"] = starsetf('apachestyle'), - ["reportbug-.*"] = starsetf('mail'), + ["reportbug%-.*"] = starsetf('mail'), ["sgml%.catalog.*"] = starsetf('catalog'), ["srm%.conf.*"] = starsetf('apache'), ["tmac%..*"] = starsetf('nroff'), ["zlog.*"] = starsetf('zsh'), ["zsh.*"] = starsetf('zsh'), + ["ae%d+%.txt"] = 'mail', -- END PATTERN } +-- luacheck: pop ---@private local function sort_by_priority(t) @@ -1336,6 +1357,11 @@ end local pattern_sorted = sort_by_priority(pattern) +---@private +local function normalize_path(path) + return (path:gsub("\\", "/")) +end + --- Add new filetype mappings. --- --- Filetype mappings can be added either by extension or by filename (either @@ -1398,11 +1424,11 @@ function M.add(filetypes) end for k, v in pairs(filetypes.filename or {}) do - filename[k] = v + filename[normalize_path(k)] = v end for k, v in pairs(filetypes.pattern or {}) do - pattern[k] = v + pattern[normalize_path(k)] = v end if filetypes.pattern then @@ -1428,15 +1454,22 @@ local function dispatch(ft, path, bufnr, ...) end ---@private -function M.match(bufnr) - local path = api.nvim_buf_get_name(bufnr) +function M.match(name, bufnr) + -- When fired from the main filetypedetect autocommand the {bufnr} argument is omitted, so we use + -- the current buffer. The {bufnr} argument is provided to allow extensibility in case callers + -- wish to perform filetype detection on buffers other than the current one. + bufnr = bufnr or api.nvim_get_current_buf() + + name = normalize_path(name) + -- First check for the simple case where the full path exists as a key + local path = vim.fn.resolve(vim.fn.fnamemodify(name, ":p")) if dispatch(filename[path], path, bufnr) then return end -- Next check against just the file name - local tail = vim.fn.fnamemodify(path, ":t") + local tail = vim.fn.fnamemodify(name, ":t") if dispatch(filename[tail], path, bufnr) then return end @@ -1447,7 +1480,15 @@ function M.match(bufnr) local ft = v[k][1] -- If the pattern contains a / match against the full path, otherwise just the tail local pat = "^" .. k .. "$" - local matches = k:find("/") and path:match(pat) or tail:match(pat) + local matches + if k:find("/") then + -- Similar to |autocmd-pattern|, if the pattern contains a '/' then check for a match against + -- both the short file name (as typed) and the full file name (after expanding to full path + -- and resolving symlinks) + matches = name:match(pat) or path:match(pat) + else + matches = tail:match(pat) + end if matches then if dispatch(ft, path, bufnr, matches) then return @@ -1456,7 +1497,7 @@ function M.match(bufnr) end -- Finally, check file extension - local ext = vim.fn.fnamemodify(path, ":e") + local ext = vim.fn.fnamemodify(name, ":e") if dispatch(extension[ext], path, bufnr) then return end diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index cfbabb12a6..7df0064b6b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -256,7 +256,7 @@ local function validate_client_config(config) (not config.flags or not config.flags.debounce_text_changes or type(config.flags.debounce_text_changes) == 'number'), - "flags.debounce_text_changes must be nil or a number with the debounce time in milliseconds" + "flags.debounce_text_changes must be a number with the debounce time in milliseconds" ) local cmd, cmd_args = lsp._cmd_parts(config.cmd) @@ -383,8 +383,8 @@ do return end local state = state_by_client[client.id] - local debounce = client.config.flags.debounce_text_changes - if not debounce then + local debounce = client.config.flags.debounce_text_changes or 150 + if debounce == 0 then local changes = state.use_incremental_sync and incremental_changes(client) or full_changes() client.notify("textDocument/didChange", { textDocument = { @@ -897,7 +897,7 @@ function lsp.start_client(config) client.initialized = true uninitialized_clients[client_id] = nil client.workspace_folders = workspace_folders - -- TODO(mjlbach): Backwards compatbility, to be removed in 0.7 + -- TODO(mjlbach): Backwards compatibility, to be removed in 0.7 client.workspaceFolders = client.workspace_folders client.server_capabilities = assert(result.capabilities, "initialize result doesn't contain capabilities") -- These are the cleaned up capabilities we use for dynamically deciding diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 8e3ed9b002..543fdb0237 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -453,7 +453,7 @@ end --- Send request to the server to resolve document highlights for the current --- text document position. This request can be triggered by a key mapping or ---- by events such as `CursorHold`, eg: +--- by events such as `CursorHold`, e.g.: --- --- <pre> --- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index a1d3b2aa94..a48302cc4b 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -439,14 +439,20 @@ for k, fn in pairs(M) do }) if err then - local client = vim.lsp.get_client_by_id(ctx.client_id) - local client_name = client and client.name or string.format("client_id=%d", ctx.client_id) -- LSP spec: -- interface ResponseError: -- code: integer; -- message: string; -- data?: string | number | boolean | array | object | null; - return err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message) + + -- Per LSP, don't show ContentModified error to the user. + if err.code ~= protocol.ErrorCodes.ContentModified then + local client = vim.lsp.get_client_by_id(ctx.client_id) + local client_name = client and client.name or string.format("client_id=%d", ctx.client_id) + + err_message(client_name .. ': ' .. tostring(err.code) .. ': ' .. err.message) + end + return end return fn(err, result, ctx, config) diff --git a/runtime/lua/vim/lsp/sync.lua b/runtime/lua/vim/lsp/sync.lua index d01f45ad8f..0f4e5b572b 100644 --- a/runtime/lua/vim/lsp/sync.lua +++ b/runtime/lua/vim/lsp/sync.lua @@ -298,7 +298,7 @@ end ---@private -- rangelength depends on the offset encoding --- bytes for utf-8 (clangd with extenion) +-- bytes for utf-8 (clangd with extension) -- codepoints for utf-16 -- codeunits for utf-32 -- Line endings count here as 2 chars for \r\n (dos), 1 char for \n (unix), and 1 char for \r (mac) diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index 594765761d..85fd5cd8e0 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -77,7 +77,7 @@ end --- Determines whether this tree is valid. --- If the tree is invalid, `parse()` must be called ---- to get the an updated tree. +--- to get the updated tree. function LanguageTree:is_valid() return self._valid end diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 4884a44cea..38a82343c3 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -1505,7 +1505,7 @@ void add_user_command(String name, Object command, Dict(user_command) *opts, int goto err; } - bool force = api_object_to_bool(opts->force, "force", false, err); + bool force = api_object_to_bool(opts->force, "force", true, err); if (ERROR_SET(err)) { goto err; } diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 693d2083e6..59db12f2c0 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -383,7 +383,7 @@ error: /// @param str String to be converted. /// @param from_part Legacy Vim parameter. Usually true. /// @param do_lt Also translate <lt>. Ignored if `special` is false. -/// @param special Replace |keycodes|, e.g. <CR> becomes a "\n" char. +/// @param special Replace |keycodes|, e.g. <CR> becomes a "\r" char. /// @see replace_termcodes /// @see cpoptions String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, Boolean special) @@ -1163,7 +1163,7 @@ static void term_close(void *data) /// Send data to channel `id`. For a job, it writes it to the /// stdin of the process. For the stdio channel |channel-stdio|, /// it writes to Nvim's stdout. For an internal terminal instance -/// (|nvim_open_term()|) it writes directly to terimal output. +/// (|nvim_open_term()|) it writes directly to terminal output. /// See |channel-bytes| for more information. /// /// This function writes raw data, not RPC messages. If the channel @@ -2394,11 +2394,12 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error * /// - mods: (string) Command modifiers, if any |<mods>| /// @param opts Optional command attributes. See |command-attributes| for more details. To use /// boolean attributes (such as |:command-bang| or |:command-bar|) set the value to -/// "true". When using a Lua function for {command} you can also provide a "desc" -/// key that will be displayed when listing commands. In addition to the string -/// options listed in |:command-complete|, the "complete" key also accepts a Lua -/// function which works like the "customlist" completion mode -/// |:command-complete-customlist|. +/// "true". In addition to the string options listed in |:command-complete|, the +/// "complete" key also accepts a Lua function which works like the "customlist" +/// completion mode |:command-completion-customlist|. Additional parameters: +/// - desc: (string) Used for listing the command when a Lua function is used for +/// {command}. +/// - force: (boolean, default true) Override any previous definition. /// @param[out] err Error details, if any. void nvim_add_user_command(String name, Object command, Dict(user_command) *opts, Error *err) FUNC_API_SINCE(9) diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 4f4da7c2a9..340fec230c 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -82,6 +82,14 @@ typedef struct { garray_T dout_ga; // used for internal diff } diffout_T; +// used for recording hunks from xdiff +typedef struct { + linenr_T lnum_orig; + long count_orig; + linenr_T lnum_new; + long count_new; +} diffhunk_T; + // two diff inputs and one result typedef struct { diffin_T dio_orig; // original file input @@ -852,7 +860,7 @@ static void diff_try_update(diffio_T *dio, int idx_orig, exarg_T *eap) } // Read the diff output and add each entry to the diff list. - diff_read(idx_orig, idx_new, &dio->dio_diff); + diff_read(idx_orig, idx_new, dio); clear_diffin(&dio->dio_new); clear_diffout(&dio->dio_diff); @@ -1078,7 +1086,7 @@ static int diff_file_internal(diffio_T *diffio) emit_cfg.ctxlen = 0; // don't need any diff_context here emit_cb.priv = &diffio->dio_diff; - emit_cb.out_line = xdiff_out; + emit_cfg.hunk_func = xdiff_out; if (xdl_diff(&diffio->dio_orig.din_mmfile, &diffio->dio_new.din_mmfile, ¶m, &emit_cfg, &emit_cb) < 0) { @@ -1519,20 +1527,20 @@ void ex_diffoff(exarg_T *eap) /// @param idx_orig idx of original file /// @param idx_new idx of new file /// @dout diff output -static void diff_read(int idx_orig, int idx_new, diffout_T *dout) +static void diff_read(int idx_orig, int idx_new, diffio_T *dio) { FILE *fd = NULL; int line_idx = 0; diff_T *dprev = NULL; diff_T *dp = curtab->tp_first_diff; diff_T *dn, *dpl; + diffout_T *dout = &dio->dio_diff; char_u linebuf[LBUFLEN]; // only need to hold the diff line char_u *line; long off; int i; - linenr_T lnum_orig, lnum_new; - long count_orig, count_new; int notset = true; // block "*dp" not set yet + diffhunk_T *hunk; enum { DIFF_ED, DIFF_UNIFIED, @@ -1549,70 +1557,79 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) } } + if (!dio->dio_internal) { + hunk = xmalloc(sizeof(*hunk)); + } + for (;;) { - if (fd == NULL) { + if (dio->dio_internal) { if (line_idx >= dout->dout_ga.ga_len) { break; // did last line } - line = ((char_u **)dout->dout_ga.ga_data)[line_idx++]; + hunk = ((diffhunk_T **)dout->dout_ga.ga_data)[line_idx++]; } else { - if (vim_fgets(linebuf, LBUFLEN, fd)) { - break; // end of file - } - line = linebuf; - } - - if (diffstyle == DIFF_NONE) { - // Determine diff style. - // ed like diff looks like this: - // {first}[,{last}]c{first}[,{last}] - // {first}a{first}[,{last}] - // {first}[,{last}]d{first} - // - // unified diff looks like this: - // --- file1 2018-03-20 13:23:35.783153140 +0100 - // +++ file2 2018-03-20 13:23:41.183156066 +0100 - // @@ -1,3 +1,5 @@ - if (isdigit(*line)) { - diffstyle = DIFF_ED; - } else if ((STRNCMP(line, "@@ ", 3) == 0)) { - diffstyle = DIFF_UNIFIED; - } else if ((STRNCMP(line, "--- ", 4) == 0) // -V501 - && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 - && (STRNCMP(line, "+++ ", 4) == 0) - && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 - && (STRNCMP(line, "@@ ", 3) == 0)) { - diffstyle = DIFF_UNIFIED; + if (fd == NULL) { + if (line_idx >= dout->dout_ga.ga_len) { + break; // did last line + } + line = ((char_u **)dout->dout_ga.ga_data)[line_idx++]; } else { - // Format not recognized yet, skip over this line. Cygwin diff - // may put a warning at the start of the file. - continue; + if (vim_fgets(linebuf, LBUFLEN, fd)) { + break; // end of file + } + line = linebuf; } - } - if (diffstyle == DIFF_ED) { - if (!isdigit(*line)) { - continue; // not the start of a diff block - } - if (parse_diff_ed(line, &lnum_orig, &count_orig, - &lnum_new, &count_new) == FAIL) { - continue; - } - } else { - assert(diffstyle == DIFF_UNIFIED); - if (STRNCMP(line, "@@ ", 3) != 0) { - continue; // not the start of a diff block + if (diffstyle == DIFF_NONE) { + // Determine diff style. + // ed like diff looks like this: + // {first}[,{last}]c{first}[,{last}] + // {first}a{first}[,{last}] + // {first}[,{last}]d{first} + // + // unified diff looks like this: + // --- file1 2018-03-20 13:23:35.783153140 +0100 + // +++ file2 2018-03-20 13:23:41.183156066 +0100 + // @@ -1,3 +1,5 @@ + if (isdigit(*line)) { + diffstyle = DIFF_ED; + } else if ((STRNCMP(line, "@@ ", 3) == 0)) { + diffstyle = DIFF_UNIFIED; + } else if ((STRNCMP(line, "--- ", 4) == 0) // -V501 + && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 + && (STRNCMP(line, "+++ ", 4) == 0) + && (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501 + && (STRNCMP(line, "@@ ", 3) == 0)) { + diffstyle = DIFF_UNIFIED; + } else { + // Format not recognized yet, skip over this line. Cygwin diff + // may put a warning at the start of the file. + continue; + } } - if (parse_diff_unified(line, &lnum_orig, &count_orig, - &lnum_new, &count_new) == FAIL) { - continue; + + if (diffstyle == DIFF_ED) { + if (!isdigit(*line)) { + continue; // not the start of a diff block + } + if (parse_diff_ed(line, hunk) == FAIL) { + continue; + } + } else { + assert(diffstyle == DIFF_UNIFIED); + if (STRNCMP(line, "@@ ", 3) != 0) { + continue; // not the start of a diff block + } + if (parse_diff_unified(line, hunk) == FAIL) { + continue; + } } } // Go over blocks before the change, for which orig and new are equal. // Copy blocks from orig to new. while (dp != NULL - && lnum_orig > dp->df_lnum[idx_orig] + dp->df_count[idx_orig]) { + && hunk->lnum_orig > dp->df_lnum[idx_orig] + dp->df_count[idx_orig]) { if (notset) { diff_copy_entry(dprev, dp, idx_orig, idx_new); } @@ -1622,19 +1639,19 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) } if ((dp != NULL) - && (lnum_orig <= dp->df_lnum[idx_orig] + dp->df_count[idx_orig]) - && (lnum_orig + count_orig >= dp->df_lnum[idx_orig])) { + && (hunk->lnum_orig <= dp->df_lnum[idx_orig] + dp->df_count[idx_orig]) + && (hunk->lnum_orig + hunk->count_orig >= dp->df_lnum[idx_orig])) { // New block overlaps with existing block(s). // First find last block that overlaps. for (dpl = dp; dpl->df_next != NULL; dpl = dpl->df_next) { - if (lnum_orig + count_orig < dpl->df_next->df_lnum[idx_orig]) { + if (hunk->lnum_orig + hunk->count_orig < dpl->df_next->df_lnum[idx_orig]) { break; } } // If the newly found block starts before the old one, set the // start back a number of lines. - off = dp->df_lnum[idx_orig] - lnum_orig; + off = dp->df_lnum[idx_orig] - hunk->lnum_orig; if (off > 0) { for (i = idx_orig; i < idx_new; ++i) { @@ -1642,15 +1659,15 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) dp->df_lnum[i] -= off; } } - dp->df_lnum[idx_new] = lnum_new; - dp->df_count[idx_new] = count_new; + dp->df_lnum[idx_new] = hunk->lnum_new; + dp->df_count[idx_new] = hunk->count_new; } else if (notset) { // new block inside existing one, adjust new block - dp->df_lnum[idx_new] = lnum_new + off; - dp->df_count[idx_new] = count_new - off; + dp->df_lnum[idx_new] = hunk->lnum_new + off; + dp->df_count[idx_new] = hunk->count_new - off; } else { // second overlap of new block with existing block - dp->df_count[idx_new] += count_new - count_orig + dp->df_count[idx_new] += hunk->count_new - hunk->count_orig + dpl->df_lnum[idx_orig] + dpl->df_count[idx_orig] - (dp->df_lnum[idx_orig] + @@ -1659,7 +1676,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) // Adjust the size of the block to include all the lines to the // end of the existing block or the new diff, whatever ends last. - off = (lnum_orig + count_orig) + off = (hunk->lnum_orig + hunk->count_orig) - (dpl->df_lnum[idx_orig] + dpl->df_count[idx_orig]); if (off < 0) { @@ -1691,10 +1708,10 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) // Allocate a new diffblock. dp = diff_alloc_new(curtab, dprev, dp); - dp->df_lnum[idx_orig] = lnum_orig; - dp->df_count[idx_orig] = count_orig; - dp->df_lnum[idx_new] = lnum_new; - dp->df_count[idx_new] = count_new; + dp->df_lnum[idx_orig] = hunk->lnum_orig; + dp->df_count[idx_orig] = hunk->count_orig; + dp->df_lnum[idx_new] = hunk->lnum_new; + dp->df_count[idx_new] = hunk->count_new; // Set values for other buffers, these must be equal to the // original buffer, otherwise there would have been a change @@ -1718,6 +1735,10 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout) notset = true; } + if (!dio->dio_internal) { + xfree(hunk); + } + if (fd != NULL) { fclose(fd); } @@ -3026,8 +3047,7 @@ linenr_T diff_lnum_win(linenr_T lnum, win_T *wp) /// Handle an ED style diff line. /// Return FAIL if the line does not contain diff info. /// -static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, - long *count_new) +static int parse_diff_ed(char_u *line, diffhunk_T *hunk) { char_u *p; long f1, l1, f2, l2; @@ -3061,18 +3081,18 @@ static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, li } if (difftype == 'a') { - *lnum_orig = f1 + 1; - *count_orig = 0; + hunk->lnum_orig = f1 + 1; + hunk->count_orig = 0; } else { - *lnum_orig = f1; - *count_orig = l1 - f1 + 1; + hunk->lnum_orig = f1; + hunk->count_orig = l1 - f1 + 1; } if (difftype == 'd') { - *lnum_new = f2 + 1; - *count_new = 0; + hunk->lnum_new = f2 + 1; + hunk->count_new = 0; } else { - *lnum_new = f2; - *count_new = l2 - f2 + 1; + hunk->lnum_new = f2; + hunk->count_new = l2 - f2 + 1; } return OK; } @@ -3081,8 +3101,7 @@ static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, li /// Parses unified diff with zero(!) context lines. /// Return FAIL if there is no diff information in "line". /// -static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_orig, - linenr_T *lnum_new, long *count_new) +static int parse_diff_unified(char_u *line, diffhunk_T *hunk) { char_u *p; long oldline, oldcount, newline, newcount; @@ -3120,10 +3139,10 @@ static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_ori newline = 1; } - *lnum_orig = oldline; - *count_orig = oldcount; - *lnum_new = newline; - *count_new = newcount; + hunk->lnum_orig = oldline; + hunk->count_orig = oldcount; + hunk->lnum_new = newline; + hunk->count_new = newcount; return OK; } @@ -3135,25 +3154,17 @@ static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_ori /// Callback function for the xdl_diff() function. /// Stores the diff output in a grow array. /// -static int xdiff_out(void *priv, mmbuffer_t *mb, int nbuf) +static int xdiff_out(long start_a, long count_a, long start_b, long count_b, + void *priv) { diffout_T *dout = (diffout_T *)priv; - char_u *p; - - // The header line always comes by itself, text lines in at least two - // parts. We drop the text part. - if (nbuf > 1) { - return 0; - } - - // sanity check - if (STRNCMP(mb[0].ptr, "@@ ", 3) != 0) { - return 0; - } + diffhunk_T *p = xmalloc(sizeof(*p)); ga_grow(&dout->dout_ga, 1); - - p = vim_strnsave((char_u *)mb[0].ptr, mb[0].size); - ((char_u **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p; + p->lnum_orig = start_a + 1; + p->count_orig = count_a; + p->lnum_new = start_b + 1; + p->count_new = count_b; + ((diffhunk_T **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p; return 0; } diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 6c2db1e9ac..013a78bdac 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -915,10 +915,29 @@ int do_record(int c) apply_autocmds(EVENT_RECORDINGENTER, NULL, NULL, false, curbuf); } } else { // stop recording + save_v_event_T save_v_event; + // Set the v:event dictionary with information about the recording. + dict_T *dict = get_v_event(&save_v_event); + + // The recorded text contents. + p = get_recorded(); + if (p != NULL) { + // Remove escaping for CSI and K_SPECIAL in multi-byte chars. + vim_unescape_csi(p); + (void)tv_dict_add_str(dict, S_LEN("regcontents"), (const char *)p); + } + + // Name of requested register, or empty string for unnamed operation. + char buf[NUMBUFLEN+2]; + buf[0] = (char)regname; + buf[1] = NUL; + (void)tv_dict_add_str(dict, S_LEN("regname"), buf); + // Get the recorded key hits. K_SPECIAL and CSI will be escaped, this // needs to be removed again to put it in a register. exec_reg then // adds the escaping back later. apply_autocmds(EVENT_RECORDINGLEAVE, NULL, NULL, false, curbuf); + restore_v_event(dict, &save_v_event); reg_recorded = reg_recording; reg_recording = 0; if (ui_has(kUIMessages)) { @@ -926,13 +945,9 @@ int do_record(int c) } else { msg(""); } - p = get_recorded(); if (p == NULL) { retval = FAIL; } else { - // Remove escaping for CSI and K_SPECIAL in multi-byte chars. - vim_unescape_csi(p); - // We don't want to change the default register here, so save and // restore the current register name. old_y_previous = y_previous; diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 28b4eb9fe2..5133fe7ac8 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -411,7 +411,7 @@ return { }, { full_name='compatible', abbreviation='cp', - short_desc=N_("No description"), + short_desc=N_("No description"), type='bool', scope={'global'}, redraw={'all_windows'}, varname='p_force_off', @@ -665,14 +665,14 @@ return { }, { full_name='edcompatible', abbreviation='ed', - short_desc=N_("No description"), + short_desc=N_("No description"), type='bool', scope={'global'}, varname='p_force_off', defaults={if_true=false} }, { full_name='emoji', abbreviation='emo', - short_desc=N_("No description"), + short_desc=N_("No description"), type='bool', scope={'global'}, redraw={'all_windows', 'ui_option'}, varname='p_emoji', @@ -1184,7 +1184,7 @@ return { }, { full_name='inccommand', abbreviation='icm', - short_desc=N_("Live preview of substitution"), + short_desc=N_("Live preview of substitution"), type='string', scope={'global'}, redraw={'all_windows'}, varname='p_icm', @@ -2499,7 +2499,7 @@ return { }, { full_name='termencoding', abbreviation='tenc', - short_desc=N_("Terminal encodig"), + short_desc=N_("Terminal encoding"), type='string', scope={'global'}, defaults={if_true=""} }, @@ -2622,7 +2622,7 @@ return { }, { full_name='ttyfast', abbreviation='tf', - short_desc=N_("No description"), + short_desc=N_("No description"), type='bool', scope={'global'}, no_mkrc=true, varname='p_force_on', diff --git a/src/nvim/viml/parser/expressions.c b/src/nvim/viml/parser/expressions.c index ba6cfab98b..8a14710351 100644 --- a/src/nvim/viml/parser/expressions.c +++ b/src/nvim/viml/parser/expressions.c @@ -1536,7 +1536,7 @@ static inline void east_set_error(const ParserState *const pstate, ExprASTError /* TODO(ZyX-I): Extend syntax to allow ${expr}. This is needed to */ \ /* handle environment variables like those bash uses for */ \ /* `export -f`: their names consist not only of alphanumeric */ \ - /* characetrs. */ \ + /* characters. */ \ case kExprNodeComplexIdentifier: \ case kExprNodePlainIdentifier: \ case kExprNodeCurlyBracesIdentifier: { \ diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h index fe9327b27d..9d0bc9d468 100644 --- a/src/nvim/viml/parser/expressions.h +++ b/src/nvim/viml/parser/expressions.h @@ -57,7 +57,7 @@ typedef enum { } LexExprTokenType; typedef enum { - kExprCmpEqual, ///< Equality, unequality. + kExprCmpEqual, ///< Equality, inequality. kExprCmpMatches, ///< Matches regex, not matches regex. kExprCmpGreater, ///< `>` or `<=` kExprCmpGreaterOrEqual, ///< `>=` or `<`. diff --git a/test/functional/autocmd/recording_spec.lua b/test/functional/autocmd/recording_spec.lua index 81152758de..b9aec774f1 100644 --- a/test/functional/autocmd/recording_spec.lua +++ b/test/functional/autocmd/recording_spec.lua @@ -11,7 +11,7 @@ describe('RecordingEnter', function() source_vim [[ let g:recorded = 0 autocmd RecordingEnter * let g:recorded += 1 - execute "normal! qqyyq" + call feedkeys("qqyyq", 'xt') ]] eq(1, eval('g:recorded')) end) @@ -20,7 +20,7 @@ describe('RecordingEnter', function() source_vim [[ let g:recording = '' autocmd RecordingEnter * let g:recording = reg_recording() - execute "normal! qqyyq" + call feedkeys("qqyyq", 'xt') ]] eq('q', eval('g:recording')) end) @@ -32,7 +32,7 @@ describe('RecordingLeave', function() source_vim [[ let g:recorded = 0 autocmd RecordingLeave * let g:recorded += 1 - execute "normal! qqyyq" + call feedkeys("qqyyq", 'xt') ]] eq(1, eval('g:recorded')) end) @@ -43,10 +43,30 @@ describe('RecordingLeave', function() let g:recording = '' autocmd RecordingLeave * let g:recording = reg_recording() autocmd RecordingLeave * let g:recorded = reg_recorded() - execute "normal! qqyyq" + call feedkeys("qqyyq", 'xt') ]] eq('q', eval 'g:recording') eq('', eval 'g:recorded') eq('q', eval 'reg_recorded()') end) + + it('populates v:event', function() + source_vim [[ + let g:regname = '' + let g:regcontents = '' + autocmd RecordingLeave * let g:regname = v:event.regname + autocmd RecordingLeave * let g:regcontents = v:event.regcontents + call feedkeys("qqyyq", 'xt') + ]] + eq('q', eval 'g:regname') + eq('yy', eval 'g:regcontents') + end) + + it('resets v:event', function() + source_vim [[ + autocmd RecordingLeave * let g:event = v:event + call feedkeys("qqyyq", 'xt') + ]] + eq(0, eval 'len(v:event)') + end) end) diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua index 90035d7ecb..756591571e 100644 --- a/test/functional/lua/filetype_spec.lua +++ b/test/functional/lua/filetype_spec.lua @@ -2,6 +2,12 @@ local helpers = require('test.functional.helpers')(after_each) local exec_lua = helpers.exec_lua local eq = helpers.eq local clear = helpers.clear +local pathroot = helpers.pathroot +local meths = helpers.meths +local curbufmeths = helpers.curbufmeths +local funcs = helpers.funcs + +local root = pathroot() describe('vim.filetype', function() before_each(function() @@ -10,7 +16,6 @@ describe('vim.filetype', function() exec_lua [[ local bufnr = vim.api.nvim_create_buf(true, false) vim.api.nvim_set_current_buf(bufnr) - ]] end) @@ -21,8 +26,7 @@ describe('vim.filetype', function() rs = 'radicalscript', }, }) - vim.api.nvim_buf_set_name(0, '/home/user/src/main.rs') - vim.filetype.match(0) + vim.filetype.match('main.rs') return vim.bo.filetype ]]) end) @@ -37,8 +41,7 @@ describe('vim.filetype', function() ['main.rs'] = 'somethingelse', }, }) - vim.api.nvim_buf_set_name(0, '/home/usr/src/main.rs') - vim.filetype.match(0) + vim.filetype.match('main.rs') return vim.bo.filetype ]]) end) @@ -50,35 +53,34 @@ describe('vim.filetype', function() ['s_O_m_e_F_i_l_e'] = 'nim', }, }) - vim.api.nvim_buf_set_name(0, '/home/user/src/s_O_m_e_F_i_l_e') - vim.filetype.match(0) + vim.filetype.match('s_O_m_e_F_i_l_e') return vim.bo.filetype ]]) - eq('dosini', exec_lua [[ + eq('dosini', exec_lua([[ + local root = ... vim.filetype.add({ filename = { ['config'] = 'toml', - ['~/.config/fun/config'] = 'dosini', + [root .. '/.config/fun/config'] = 'dosini', }, }) - vim.api.nvim_buf_set_name(0, '~/.config/fun/config') - vim.filetype.match(0) + vim.filetype.match(root .. '/.config/fun/config') return vim.bo.filetype - ]]) + ]], root)) end) it('works with patterns', function() - eq('markdown', exec_lua [[ + eq('markdown', exec_lua([[ + local root = ... vim.filetype.add({ pattern = { - ['~/blog/.*%.txt'] = 'markdown', + [root .. '/blog/.*%.txt'] = 'markdown', } }) - vim.api.nvim_buf_set_name(0, '~/blog/why_neovim_is_awesome.txt') - vim.filetype.match(0) + vim.filetype.match(root .. '/blog/why_neovim_is_awesome.txt') return vim.bo.filetype - ]]) + ]], root)) end) it('works with functions', function() @@ -92,9 +94,576 @@ describe('vim.filetype', function() end, } }) - vim.api.nvim_buf_set_name(0, 'relevant_to_me') - vim.filetype.match(0) + vim.filetype.match('relevant_to_me') return vim.bo.filetype ]]) end) + + it('correctly detects filetypes from test_filetype', function() + -- Checks copied from test_filetype.vim + local filename_checks = { + ['8th'] = {'file.8th'}, + ['a2ps'] = {'/etc/a2ps.cfg', '/etc/a2ps/file.cfg', 'a2psrc', '.a2psrc', 'any/etc/a2ps.cfg', 'any/etc/a2ps/file.cfg'}, + ['a65'] = {'file.a65'}, + ['aap'] = {'file.aap'}, + ['abap'] = {'file.abap'}, + ['abc'] = {'file.abc'}, + ['abel'] = {'file.abl'}, + ['acedb'] = {'file.wrm'}, + ['ada'] = {'file.adb', 'file.ads', 'file.ada', 'file.gpr'}, + ['ahdl'] = {'file.tdf'}, + ['aidl'] = {'file.aidl'}, + ['alsaconf'] = {'.asoundrc', '/usr/share/alsa/alsa.conf', '/etc/asound.conf', 'any/etc/asound.conf', 'any/usr/share/alsa/alsa.conf'}, + ['aml'] = {'file.aml'}, + ['ampl'] = {'file.run'}, + ['ant'] = {'build.xml'}, + ['apache'] = {'.htaccess', '/etc/httpd/file.conf', '/etc/apache2/sites-2/file.com', '/etc/apache2/some.config', '/etc/apache2/conf.file/conf', '/etc/apache2/mods-some/file', '/etc/apache2/sites-some/file', '/etc/httpd/conf.d/file.config', '/etc/apache2/conf.file/file', '/etc/apache2/file.conf', '/etc/apache2/file.conf-file', '/etc/apache2/mods-file/file', '/etc/apache2/sites-file/file', '/etc/apache2/sites-file/file.com', '/etc/httpd/conf.d/file.conf', '/etc/httpd/conf.d/file.conf-file', 'access.conf', 'access.conf-file', 'any/etc/apache2/conf.file/file', 'any/etc/apache2/file.conf', 'any/etc/apache2/file.conf-file', 'any/etc/apache2/mods-file/file', 'any/etc/apache2/sites-file/file', 'any/etc/apache2/sites-file/file.com', 'any/etc/httpd/conf.d/file.conf', 'any/etc/httpd/conf.d/file.conf-file', 'any/etc/httpd/file.conf', 'apache.conf', 'apache.conf-file', 'apache2.conf', 'apache2.conf-file', 'httpd.conf', 'httpd.conf-file', 'srm.conf', 'srm.conf-file', '/etc/httpd/mods-some/file', '/etc/httpd/sites-some/file', '/etc/httpd/conf.file/conf'}, + ['apachestyle'] = {'/etc/proftpd/file.config,/etc/proftpd/conf.file/file', '/etc/proftpd/conf.file/file', '/etc/proftpd/file.conf', '/etc/proftpd/file.conf-file', 'any/etc/proftpd/conf.file/file', 'any/etc/proftpd/file.conf', 'any/etc/proftpd/file.conf-file', 'proftpd.conf', 'proftpd.conf-file'}, + ['applescript'] = {'file.scpt'}, + ['aptconf'] = {'apt.conf', '/.aptitude/config', 'any/.aptitude/config'}, + ['arch'] = {'.arch-inventory', '=tagging-method'}, + ['arduino'] = {'file.ino', 'file.pde'}, + ['art'] = {'file.art'}, + ['asciidoc'] = {'file.asciidoc', 'file.adoc'}, + ['asn'] = {'file.asn', 'file.asn1'}, + ['asterisk'] = {'asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'}, + ['atlas'] = {'file.atl', 'file.as'}, + ['autohotkey'] = {'file.ahk'}, + ['autoit'] = {'file.au3'}, + ['automake'] = {'GNUmakefile.am', 'makefile.am', 'Makefile.am'}, + ['ave'] = {'file.ave'}, + ['awk'] = {'file.awk', 'file.gawk'}, + ['b'] = {'file.mch', 'file.ref', 'file.imp'}, + ['bzl'] = {'file.bazel', 'file.bzl', 'WORKSPACE'}, + ['bc'] = {'file.bc'}, + ['bdf'] = {'file.bdf'}, + ['bib'] = {'file.bib'}, + ['beancount'] = {'file.beancount'}, + ['bindzone'] = {'named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'}, + ['blank'] = {'file.bl'}, + ['bsdl'] = {'file.bsd', 'file.bsdl', 'bsd', 'some-bsd'}, + ['bst'] = {'file.bst'}, + ['bzr'] = {'bzr_log.any', 'bzr_log.file'}, + ['c'] = {'enlightenment/file.cfg', 'file.qc', 'file.c', 'some-enlightenment/file.cfg'}, + ['cabal'] = {'file.cabal'}, + ['cabalconfig'] = {'cabal.config'}, + ['cabalproject'] = {'cabal.project', 'cabal.project.local'}, + ['calendar'] = {'calendar', '/.calendar/file', '/share/calendar/any/calendar.file', '/share/calendar/calendar.file', 'any/share/calendar/any/calendar.file', 'any/share/calendar/calendar.file'}, + ['catalog'] = {'catalog', 'sgml.catalogfile', 'sgml.catalog', 'sgml.catalog-file'}, + ['cdl'] = {'file.cdl'}, + ['cdrdaoconf'] = {'/etc/cdrdao.conf', '/etc/defaults/cdrdao', '/etc/default/cdrdao', '.cdrdao', 'any/etc/cdrdao.conf', 'any/etc/default/cdrdao', 'any/etc/defaults/cdrdao'}, + ['cdrtoc'] = {'file.toc'}, + ['cf'] = {'file.cfm', 'file.cfi', 'file.cfc'}, + ['cfengine'] = {'cfengine.conf'}, + ['cfg'] = {'file.cfg', 'file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'}, + ['ch'] = {'file.chf'}, + ['chaiscript'] = {'file.chai'}, + ['chaskell'] = {'file.chs'}, + ['chill'] = {'file..ch'}, + ['chordpro'] = {'file.chopro', 'file.crd', 'file.cho', 'file.crdpro', 'file.chordpro'}, + ['cl'] = {'file.eni'}, + ['clean'] = {'file.dcl', 'file.icl'}, + ['clojure'] = {'file.clj', 'file.cljs', 'file.cljx', 'file.cljc'}, + ['cmake'] = {'CMakeLists.txt', 'file.cmake', 'file.cmake.in'}, + ['cmusrc'] = {'any/.cmus/autosave', 'any/.cmus/rc', 'any/.cmus/command-history', 'any/.cmus/file.theme', 'any/cmus/rc', 'any/cmus/file.theme', '/.cmus/autosave', '/.cmus/command-history', '/.cmus/file.theme', '/.cmus/rc', '/cmus/file.theme', '/cmus/rc'}, + ['cobol'] = {'file.cbl', 'file.cob', 'file.lib'}, + ['coco'] = {'file.atg'}, + ['conaryrecipe'] = {'file.recipe'}, + ['conf'] = {'auto.master'}, + ['config'] = {'configure.in', 'configure.ac', '/etc/hostname.file'}, + ['context'] = {'tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'}, + ['cpp'] = {'file.cxx', 'file.c++', 'file.hh', 'file.hxx', 'file.hpp', 'file.ipp', 'file.moc', 'file.tcc', 'file.inl', 'file.tlh'}, + ['crm'] = {'file.crm'}, + ['crontab'] = {'crontab', 'crontab.file', '/etc/cron.d/file', 'any/etc/cron.d/file'}, + ['cs'] = {'file.cs', 'file.csx'}, + ['csc'] = {'file.csc'}, + ['csdl'] = {'file.csdl'}, + ['csp'] = {'file.csp', 'file.fdr'}, + ['css'] = {'file.css'}, + ['cterm'] = {'file.con'}, + ['cucumber'] = {'file.feature'}, + ['cuda'] = {'file.cu', 'file.cuh'}, + ['cupl'] = {'file.pld'}, + ['cuplsim'] = {'file.si'}, + ['cvs'] = {'cvs123'}, + ['cvsrc'] = {'.cvsrc'}, + ['cynpp'] = {'file.cyn'}, + ['dart'] = {'file.dart', 'file.drt'}, + ['datascript'] = {'file.ds'}, + ['dcd'] = {'file.dcd'}, + ['debchangelog'] = {'changelog.Debian', 'changelog.dch', 'NEWS.Debian', 'NEWS.dch', '/debian/changelog'}, + ['debcontrol'] = {'/debian/control', 'any/debian/control'}, + ['debcopyright'] = {'/debian/copyright', 'any/debian/copyright'}, + ['debsources'] = {'/etc/apt/sources.list', '/etc/apt/sources.list.d/file.list', 'any/etc/apt/sources.list', 'any/etc/apt/sources.list.d/file.list'}, + ['def'] = {'file.def'}, + ['denyhosts'] = {'denyhosts.conf'}, + ['desc'] = {'file.desc'}, + ['desktop'] = {'file.desktop', '.directory', 'file.directory'}, + ['dictconf'] = {'dict.conf', '.dictrc'}, + ['dictdconf'] = {'dictd.conf', 'dictdfile.conf', 'dictd-file.conf'}, + ['diff'] = {'file.diff', 'file.rej'}, + ['dircolors'] = {'.dir_colors', '.dircolors', '/etc/DIR_COLORS', 'any/etc/DIR_COLORS'}, + ['dnsmasq'] = {'/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'}, + ['dockerfile'] = {'Containerfile', 'Dockerfile', 'file.Dockerfile', 'Dockerfile.debian', 'Containerfile.something'}, + ['dosbatch'] = {'file.bat', 'file.sys'}, + ['dosini'] = {'.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'}, + ['dot'] = {'file.dot', 'file.gv'}, + ['dracula'] = {'file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'}, + ['dtd'] = {'file.dtd'}, + ['dts'] = {'file.dts', 'file.dtsi'}, + ['dune'] = {'jbuild', 'dune', 'dune-project', 'dune-workspace'}, + ['dylan'] = {'file.dylan'}, + ['dylanintr'] = {'file.intr'}, + ['dylanlid'] = {'file.lid'}, + ['ecd'] = {'file.ecd'}, + ['edif'] = {'file.edf', 'file.edif', 'file.edo'}, + ['elinks'] = {'elinks.conf'}, + ['elixir'] = {'file.ex', 'file.exs', 'mix.lock'}, + ['eelixir'] = {'file.eex', 'file.leex'}, + ['elm'] = {'file.elm'}, + ['elmfilt'] = {'filter-rules'}, + ['epuppet'] = {'file.epp'}, + ['erlang'] = {'file.erl', 'file.hrl', 'file.yaws'}, + ['eruby'] = {'file.erb', 'file.rhtml'}, + ['esmtprc'] = {'anyesmtprc', 'esmtprc', 'some-esmtprc'}, + ['esqlc'] = {'file.ec', 'file.EC'}, + ['esterel'] = {'file.strl'}, + ['eterm'] = {'anyEterm/file.cfg', 'Eterm/file.cfg', 'some-Eterm/file.cfg'}, + ['exim'] = {'exim.conf'}, + ['expect'] = {'file.exp'}, + ['exports'] = {'exports'}, + ['factor'] = {'file.factor'}, + ['falcon'] = {'file.fal'}, + ['fan'] = {'file.fan', 'file.fwt'}, + ['fennel'] = {'file.fnl'}, + ['fetchmail'] = {'.fetchmailrc'}, + ['fgl'] = {'file.4gl', 'file.4gh', 'file.m4gl'}, + ['fish'] = {'file.fish'}, + ['focexec'] = {'file.fex', 'file.focexec'}, + ['forth'] = {'file.ft', 'file.fth'}, + ['fortran'] = {'file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'}, + ['fpcmake'] = {'file.fpc'}, + ['framescript'] = {'file.fsl'}, + ['freebasic'] = {'file.fb', 'file.bi'}, + ['fsharp'] = {'file.fs', 'file.fsi', 'file.fsx'}, + ['fstab'] = {'fstab', 'mtab'}, + ['fvwm'] = {'/.fvwm/file', 'any/.fvwm/file'}, + ['gdb'] = {'.gdbinit', 'gdbinit'}, + ['gdmo'] = {'file.mo', 'file.gdmo'}, + ['gedcom'] = {'file.ged', 'lltxxxxx.txt', '/tmp/lltmp', '/tmp/lltmp-file', 'any/tmp/lltmp', 'any/tmp/lltmp-file'}, + ['gemtext'] = {'file.gmi', 'file.gemini'}, + ['gift'] = {'file.gift'}, + ['gitcommit'] = {'COMMIT_EDITMSG', 'MERGE_MSG', 'TAG_EDITMSG'}, + ['gitconfig'] = {'file.git/config', '.gitconfig', '.gitmodules', 'file.git/modules//config', '/.config/git/config', '/etc/gitconfig', '/etc/gitconfig.d/file', '/.gitconfig.d/file', 'any/.config/git/config', 'any/.gitconfig.d/file', 'some.git/config', 'some.git/modules/any/config'}, + ['gitolite'] = {'gitolite.conf', '/gitolite-admin/conf/file', 'any/gitolite-admin/conf/file'}, + ['gitrebase'] = {'git-rebase-todo'}, + ['gitsendemail'] = {'.gitsendemail.msg.xxxxxx'}, + ['gkrellmrc'] = {'gkrellmrc', 'gkrellmrc_x'}, + ['gnash'] = {'gnashrc', '.gnashrc', 'gnashpluginrc', '.gnashpluginrc'}, + ['gnuplot'] = {'file.gpi'}, + ['go'] = {'file.go'}, + ['gomod'] = {'go.mod'}, + ['gp'] = {'file.gp', '.gprc'}, + ['gpg'] = {'/.gnupg/options', '/.gnupg/gpg.conf', '/usr/any/gnupg/options.skel', 'any/.gnupg/gpg.conf', 'any/.gnupg/options', 'any/usr/any/gnupg/options.skel'}, + ['grads'] = {'file.gs'}, + ['gretl'] = {'file.gretl'}, + ['groovy'] = {'file.gradle', 'file.groovy'}, + ['group'] = {'any/etc/group', 'any/etc/group-', 'any/etc/group.edit', 'any/etc/gshadow', 'any/etc/gshadow-', 'any/etc/gshadow.edit', 'any/var/backups/group.bak', 'any/var/backups/gshadow.bak', '/etc/group', '/etc/group-', '/etc/group.edit', '/etc/gshadow', '/etc/gshadow-', '/etc/gshadow.edit', '/var/backups/group.bak', '/var/backups/gshadow.bak'}, + ['grub'] = {'/boot/grub/menu.lst', '/boot/grub/grub.conf', '/etc/grub.conf', 'any/boot/grub/grub.conf', 'any/boot/grub/menu.lst', 'any/etc/grub.conf'}, + ['gsp'] = {'file.gsp'}, + ['gtkrc'] = {'.gtkrc', 'gtkrc', '.gtkrc-file', 'gtkrc-file'}, + ['haml'] = {'file.haml'}, + ['hamster'] = {'file.hsm'}, + ['haskell'] = {'file.hs', 'file.hsc', 'file.hs-boot', 'file.hsig'}, + ['haste'] = {'file.ht'}, + ['hastepreproc'] = {'file.htpp'}, + ['hb'] = {'file.hb'}, + ['hercules'] = {'file.vc', 'file.ev', 'file.sum', 'file.errsum'}, + ['hex'] = {'file.hex', 'file.h32'}, + ['hgcommit'] = {'hg-editor-file.txt'}, + ['hog'] = {'file.hog', 'snort.conf', 'vision.conf'}, + ['hollywood'] = {'file.hws'}, + ['hostconf'] = {'/etc/host.conf', 'any/etc/host.conf'}, + ['hostsaccess'] = {'/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'}, + ['i3config'] = {'/home/user/.i3/config', '/home/user/.config/i3/config', '/etc/i3/config', '/etc/xdg/i3/config'}, + ['logcheck'] = {'/etc/logcheck/file.d-some/file', '/etc/logcheck/file.d/file', 'any/etc/logcheck/file.d-some/file', 'any/etc/logcheck/file.d/file'}, + ['modula3'] = {'file.m3', 'file.mg', 'file.i3', 'file.ig'}, + ['natural'] = {'file.NSA', 'file.NSC', 'file.NSG', 'file.NSL', 'file.NSM', 'file.NSN', 'file.NSP', 'file.NSS'}, + ['neomuttrc'] = {'Neomuttrc', '.neomuttrc', '.neomuttrc-file', '/.neomutt/neomuttrc', '/.neomutt/neomuttrc-file', 'Neomuttrc', 'Neomuttrc-file', 'any/.neomutt/neomuttrc', 'any/.neomutt/neomuttrc-file', 'neomuttrc', 'neomuttrc-file'}, + ['opl'] = {'file.OPL', 'file.OPl', 'file.OpL', 'file.Opl', 'file.oPL', 'file.oPl', 'file.opL', 'file.opl'}, + ['pcmk'] = {'file.pcmk'}, + ['r'] = {'file.r'}, + ['rhelp'] = {'file.rd'}, + ['rmd'] = {'file.rmd', 'file.smd'}, + ['rnoweb'] = {'file.rnw', 'file.snw'}, + ['rrst'] = {'file.rrst', 'file.srst'}, + ['template'] = {'file.tmpl'}, + ['htmlm4'] = {'file.html.m4'}, + ['httest'] = {'file.htt', 'file.htb'}, + ['ibasic'] = {'file.iba', 'file.ibi'}, + ['icemenu'] = {'/.icewm/menu', 'any/.icewm/menu'}, + ['icon'] = {'file.icn'}, + ['indent'] = {'.indent.pro', 'indentrc'}, + ['inform'] = {'file.inf', 'file.INF'}, + ['initng'] = {'/etc/initng/any/file.i', 'file.ii', 'any/etc/initng/any/file.i'}, + ['inittab'] = {'inittab'}, + ['ipfilter'] = {'ipf.conf', 'ipf6.conf', 'ipf.rules'}, + ['iss'] = {'file.iss'}, + ['ist'] = {'file.ist', 'file.mst'}, + ['j'] = {'file.ijs'}, + ['jal'] = {'file.jal', 'file.JAL'}, + ['jam'] = {'file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'}, + ['java'] = {'file.java', 'file.jav'}, + ['javacc'] = {'file.jj', 'file.jjt'}, + ['javascript'] = {'file.js', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'}, + ['javascriptreact'] = {'file.jsx'}, + ['jess'] = {'file.clp'}, + ['jgraph'] = {'file.jgr'}, + ['jovial'] = {'file.jov', 'file.j73', 'file.jovial'}, + ['jproperties'] = {'file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file'}, + ['json'] = {'file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', '.babelrc', '.eslintrc', '.prettierrc', '.firebaserc', 'file.slnf'}, + ['jsonc'] = {'file.jsonc'}, + ['jsp'] = {'file.jsp'}, + ['julia'] = {'file.jl'}, + ['kconfig'] = {'Kconfig', 'Kconfig.debug', 'Kconfig.file'}, + ['kivy'] = {'file.kv'}, + ['kix'] = {'file.kix'}, + ['kotlin'] = {'file.kt', 'file.ktm', 'file.kts'}, + ['kscript'] = {'file.ks'}, + ['kwt'] = {'file.k'}, + ['lace'] = {'file.ace', 'file.ACE'}, + ['latte'] = {'file.latte', 'file.lte'}, + ['ld'] = {'file.ld'}, + ['ldif'] = {'file.ldif'}, + ['less'] = {'file.less'}, + ['lex'] = {'file.lex', 'file.l', 'file.lxx', 'file.l++'}, + ['lftp'] = {'lftp.conf', '.lftprc', 'anylftp/rc', 'lftp/rc', 'some-lftp/rc'}, + ['lhaskell'] = {'file.lhs'}, + ['libao'] = {'/etc/libao.conf', '/.libao', 'any/.libao', 'any/etc/libao.conf'}, + ['lifelines'] = {'file.ll'}, + ['lilo'] = {'lilo.conf', 'lilo.conf-file'}, + ['limits'] = {'/etc/limits', '/etc/anylimits.conf', '/etc/anylimits.d/file.conf', '/etc/limits.conf', '/etc/limits.d/file.conf', '/etc/some-limits.conf', '/etc/some-limits.d/file.conf', 'any/etc/limits', 'any/etc/limits.conf', 'any/etc/limits.d/file.conf', 'any/etc/some-limits.conf', 'any/etc/some-limits.d/file.conf'}, + ['liquid'] = {'file.liquid'}, + ['lisp'] = {'file.lsp', 'file.lisp', 'file.asd', 'file.el', 'file.cl', '.emacs', '.sawfishrc', 'sbclrc', '.sbclrc'}, + ['lite'] = {'file.lite', 'file.lt'}, + ['litestep'] = {'/LiteStep/any/file.rc', 'any/LiteStep/any/file.rc'}, + ['loginaccess'] = {'/etc/login.access', 'any/etc/login.access'}, + ['logindefs'] = {'/etc/login.defs', 'any/etc/login.defs'}, + ['logtalk'] = {'file.lgt'}, + ['lotos'] = {'file.lot', 'file.lotos'}, + ['lout'] = {'file.lou', 'file.lout'}, + ['lprolog'] = {'file.sig'}, + ['lsl'] = {'file.lsl'}, + ['lss'] = {'file.lss'}, + ['lua'] = {'file.lua', 'file.rockspec', 'file.nse'}, + ['lynx'] = {'lynx.cfg'}, + ['matlab'] = {'file.m'}, + ['m3build'] = {'m3makefile', 'm3overrides'}, + ['m3quake'] = {'file.quake', 'cm3.cfg'}, + ['m4'] = {'file.at'}, + ['mail'] = {'snd.123', '.letter', '.letter.123', '.followup', '.article', '.article.123', 'pico.123', 'mutt-xx-xxx', 'muttng-xx-xxx', 'ae123.txt', 'file.eml', 'reportbug-file'}, + ['mailaliases'] = {'/etc/mail/aliases', '/etc/aliases', 'any/etc/aliases', 'any/etc/mail/aliases'}, + ['mailcap'] = {'.mailcap', 'mailcap'}, + ['make'] = {'file.mk', 'file.mak', 'file.dsp', 'makefile', 'Makefile', 'makefile-file', 'Makefile-file', 'some-makefile', 'some-Makefile'}, + ['mallard'] = {'file.page'}, + ['manconf'] = {'/etc/man.conf', 'man.config', 'any/etc/man.conf'}, + ['map'] = {'file.map'}, + ['maple'] = {'file.mv', 'file.mpl', 'file.mws'}, + ['markdown'] = {'file.markdown', 'file.mdown', 'file.mkd', 'file.mkdn', 'file.mdwn', 'file.md'}, + ['mason'] = {'file.mason', 'file.mhtml', 'file.comp'}, + ['master'] = {'file.mas', 'file.master'}, + ['mel'] = {'file.mel'}, + ['meson'] = {'meson.build', 'meson_options.txt'}, + ['messages'] = {'/log/auth', '/log/cron', '/log/daemon', '/log/debug', '/log/kern', '/log/lpr', '/log/mail', '/log/messages', '/log/news/news', '/log/syslog', '/log/user', + '/log/auth.log', '/log/cron.log', '/log/daemon.log', '/log/debug.log', '/log/kern.log', '/log/lpr.log', '/log/mail.log', '/log/messages.log', '/log/news/news.log', '/log/syslog.log', '/log/user.log', + '/log/auth.err', '/log/cron.err', '/log/daemon.err', '/log/debug.err', '/log/kern.err', '/log/lpr.err', '/log/mail.err', '/log/messages.err', '/log/news/news.err', '/log/syslog.err', '/log/user.err', + '/log/auth.info', '/log/cron.info', '/log/daemon.info', '/log/debug.info', '/log/kern.info', '/log/lpr.info', '/log/mail.info', '/log/messages.info', '/log/news/news.info', '/log/syslog.info', '/log/user.info', + '/log/auth.warn', '/log/cron.warn', '/log/daemon.warn', '/log/debug.warn', '/log/kern.warn', '/log/lpr.warn', '/log/mail.warn', '/log/messages.warn', '/log/news/news.warn', '/log/syslog.warn', '/log/user.warn', + '/log/auth.crit', '/log/cron.crit', '/log/daemon.crit', '/log/debug.crit', '/log/kern.crit', '/log/lpr.crit', '/log/mail.crit', '/log/messages.crit', '/log/news/news.crit', '/log/syslog.crit', '/log/user.crit', + '/log/auth.notice', '/log/cron.notice', '/log/daemon.notice', '/log/debug.notice', '/log/kern.notice', '/log/lpr.notice', '/log/mail.notice', '/log/messages.notice', '/log/news/news.notice', '/log/syslog.notice', '/log/user.notice'}, + ['mf'] = {'file.mf'}, + ['mgl'] = {'file.mgl'}, + ['mgp'] = {'file.mgp'}, + ['mib'] = {'file.mib', 'file.my'}, + ['mix'] = {'file.mix', 'file.mixal'}, + ['mma'] = {'file.nb'}, + ['mmp'] = {'file.mmp'}, + ['modconf'] = {'/etc/modules.conf', '/etc/modules', '/etc/conf.modules', '/etc/modprobe.file', 'any/etc/conf.modules', 'any/etc/modprobe.file', 'any/etc/modules', 'any/etc/modules.conf'}, + ['modula2'] = {'file.m2', 'file.mi'}, + ['monk'] = {'file.isc', 'file.monk', 'file.ssc', 'file.tsc'}, + ['moo'] = {'file.moo'}, + ['mp'] = {'file.mp'}, + ['mplayerconf'] = {'mplayer.conf', '/.mplayer/config', 'any/.mplayer/config'}, + ['mrxvtrc'] = {'mrxvtrc', '.mrxvtrc'}, + ['msidl'] = {'file.odl', 'file.mof'}, + ['msql'] = {'file.msql'}, + ['mupad'] = {'file.mu'}, + ['mush'] = {'file.mush'}, + ['muttrc'] = {'Muttngrc', 'Muttrc', '.muttngrc', '.muttngrc-file', '.muttrc', '.muttrc-file', '/.mutt/muttngrc', '/.mutt/muttngrc-file', '/.mutt/muttrc', '/.mutt/muttrc-file', '/.muttng/muttngrc', '/.muttng/muttngrc-file', '/.muttng/muttrc', '/.muttng/muttrc-file', '/etc/Muttrc.d/file', '/etc/Muttrc.d/file.rc', 'Muttngrc-file', 'Muttrc-file', 'any/.mutt/muttngrc', 'any/.mutt/muttngrc-file', 'any/.mutt/muttrc', 'any/.mutt/muttrc-file', 'any/.muttng/muttngrc', 'any/.muttng/muttngrc-file', 'any/.muttng/muttrc', 'any/.muttng/muttrc-file', 'any/etc/Muttrc.d/file', 'muttngrc', 'muttngrc-file', 'muttrc', 'muttrc-file'}, + ['mysql'] = {'file.mysql'}, + ['n1ql'] = {'file.n1ql', 'file.nql'}, + ['named'] = {'namedfile.conf', 'rndcfile.conf', 'named-file.conf', 'named.conf', 'rndc-file.conf', 'rndc-file.key', 'rndc.conf', 'rndc.key'}, + ['nanorc'] = {'/etc/nanorc', 'file.nanorc', 'any/etc/nanorc'}, + ['ncf'] = {'file.ncf'}, + ['netrc'] = {'.netrc'}, + ['nginx'] = {'file.nginx', 'nginxfile.conf', 'filenginx.conf', 'any/etc/nginx/file', 'any/usr/local/nginx/conf/file', 'any/nginx/file.conf'}, + ['ninja'] = {'file.ninja'}, + ['nqc'] = {'file.nqc'}, + ['nroff'] = {'file.tr', 'file.nr', 'file.roff', 'file.tmac', 'file.mom', 'tmac.file'}, + ['nsis'] = {'file.nsi', 'file.nsh'}, + ['obj'] = {'file.obj'}, + ['ocaml'] = {'file.ml', 'file.mli', 'file.mll', 'file.mly', '.ocamlinit', 'file.mlt', 'file.mlp', 'file.mlip', 'file.mli.cppo', 'file.ml.cppo'}, + ['occam'] = {'file.occ'}, + ['octave'] = {'octaverc', '.octaverc', 'octave.conf'}, + ['omnimark'] = {'file.xom', 'file.xin'}, + ['opam'] = {'opam', 'file.opam', 'file.opam.template'}, + ['openroad'] = {'file.or'}, + ['ora'] = {'file.ora'}, + ['pamconf'] = {'/etc/pam.conf', '/etc/pam.d/file', 'any/etc/pam.conf', 'any/etc/pam.d/file'}, + ['pamenv'] = {'/etc/security/pam_env.conf', '/home/user/.pam_environment', '.pam_environment', 'pam_env.conf'}, + ['papp'] = {'file.papp', 'file.pxml', 'file.pxsl'}, + ['pascal'] = {'file.pas', 'file.dpr', 'file.lpr'}, + ['passwd'] = {'any/etc/passwd', 'any/etc/passwd-', 'any/etc/passwd.edit', 'any/etc/shadow', 'any/etc/shadow-', 'any/etc/shadow.edit', 'any/var/backups/passwd.bak', 'any/var/backups/shadow.bak', '/etc/passwd', '/etc/passwd-', '/etc/passwd.edit', '/etc/shadow', '/etc/shadow-', '/etc/shadow.edit', '/var/backups/passwd.bak', '/var/backups/shadow.bak'}, + ['pbtxt'] = {'file.pbtxt'}, + ['pccts'] = {'file.g'}, + ['pdf'] = {'file.pdf'}, + ['perl'] = {'file.plx', 'file.al', 'file.psgi', 'gitolite.rc', '.gitolite.rc', 'example.gitolite.rc'}, + ['pf'] = {'pf.conf'}, + ['pfmain'] = {'main.cf'}, + ['php'] = {'file.php', 'file.php9', 'file.phtml', 'file.ctp'}, + ['lpc'] = {'file.lpc', 'file.ulpc'}, + ['pike'] = {'file.pike', 'file.pmod'}, + ['cmod'] = {'file.cmod'}, + ['pilrc'] = {'file.rcp'}, + ['pine'] = {'.pinerc', 'pinerc', '.pinercex', 'pinercex'}, + ['pinfo'] = {'/etc/pinforc', '/.pinforc', 'any/.pinforc', 'any/etc/pinforc'}, + ['pli'] = {'file.pli', 'file.pl1'}, + ['plm'] = {'file.plm', 'file.p36', 'file.pac'}, + ['plp'] = {'file.plp'}, + ['plsql'] = {'file.pls', 'file.plsql'}, + ['po'] = {'file.po', 'file.pot'}, + ['pod'] = {'file.pod'}, + ['poke'] = {'file.pk'}, + ['postscr'] = {'file.ps', 'file.pfa', 'file.afm', 'file.eps', 'file.epsf', 'file.epsi', 'file.ai'}, + ['pov'] = {'file.pov'}, + ['povini'] = {'.povrayrc'}, + ['ppd'] = {'file.ppd'}, + ['ppwiz'] = {'file.it', 'file.ih'}, + ['privoxy'] = {'file.action'}, + ['proc'] = {'file.pc'}, + ['procmail'] = {'.procmail', '.procmailrc'}, + ['prolog'] = {'file.pdb'}, + ['promela'] = {'file.pml'}, + ['proto'] = {'file.proto'}, + ['protocols'] = {'/etc/protocols', 'any/etc/protocols'}, + ['ps1'] = {'file.ps1', 'file.psd1', 'file.psm1', 'file.pssc'}, + ['ps1xml'] = {'file.ps1xml'}, + ['psf'] = {'file.psf'}, + ['psl'] = {'file.psl'}, + ['puppet'] = {'file.pp'}, + ['pyret'] = {'file.arr'}, + ['pyrex'] = {'file.pyx', 'file.pxd'}, + ['python'] = {'file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'}, + ['quake'] = {'anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'}, + ['radiance'] = {'file.rad', 'file.mat'}, + ['raku'] = {'file.pm6', 'file.p6', 'file.t6', 'file.pod6', 'file.raku', 'file.rakumod', 'file.rakudoc', 'file.rakutest'}, + ['ratpoison'] = {'.ratpoisonrc', 'ratpoisonrc'}, + ['rbs'] = {'file.rbs'}, + ['rc'] = {'file.rc', 'file.rch'}, + ['rcs'] = {'file,v'}, + ['readline'] = {'.inputrc', 'inputrc'}, + ['remind'] = {'.reminders', 'file.remind', 'file.rem', '.reminders-file'}, + ['rego'] = {'file.rego'}, + ['resolv'] = {'resolv.conf'}, + ['reva'] = {'file.frt'}, + ['rexx'] = {'file.rex', 'file.orx', 'file.rxo', 'file.rxj', 'file.jrexx', 'file.rexxj', 'file.rexx', 'file.testGroup', 'file.testUnit'}, + ['rib'] = {'file.rib'}, + ['rnc'] = {'file.rnc'}, + ['rng'] = {'file.rng'}, + ['robots'] = {'robots.txt'}, + ['routeros'] = {'file.rsc'}, + ['rpcgen'] = {'file.x'}, + ['rpl'] = {'file.rpl'}, + ['rst'] = {'file.rst'}, + ['rtf'] = {'file.rtf'}, + ['ruby'] = {'.irbrc', 'irbrc', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile'}, + ['rust'] = {'file.rs'}, + ['samba'] = {'smb.conf'}, + ['sas'] = {'file.sas'}, + ['sass'] = {'file.sass'}, + ['sather'] = {'file.sa'}, + ['sbt'] = {'file.sbt'}, + ['scala'] = {'file.scala', 'file.sc'}, + ['scheme'] = {'file.scm', 'file.ss', 'file.sld', 'file.rkt', 'file.rktd', 'file.rktl'}, + ['scilab'] = {'file.sci', 'file.sce'}, + ['screen'] = {'.screenrc', 'screenrc'}, + ['sexplib'] = {'file.sexp'}, + ['scdoc'] = {'file.scd'}, + ['scss'] = {'file.scss'}, + ['sd'] = {'file.sd'}, + ['sdc'] = {'file.sdc'}, + ['sdl'] = {'file.sdl', 'file.pr'}, + ['sed'] = {'file.sed'}, + ['sensors'] = {'/etc/sensors.conf', '/etc/sensors3.conf', 'any/etc/sensors.conf', 'any/etc/sensors3.conf'}, + ['services'] = {'/etc/services', 'any/etc/services'}, + ['setserial'] = {'/etc/serial.conf', 'any/etc/serial.conf'}, + ['sh'] = {'.bashrc', 'file.bash', '/usr/share/doc/bash-completion/filter.sh','/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf'}, + ['sieve'] = {'file.siv', 'file.sieve'}, + ['simula'] = {'file.sim'}, + ['sinda'] = {'file.sin', 'file.s85'}, + ['sisu'] = {'file.sst', 'file.ssm', 'file.ssi', 'file.-sst', 'file._sst', 'file.sst.meta', 'file.-sst.meta', 'file._sst.meta'}, + ['skill'] = {'file.il', 'file.ils', 'file.cdf'}, + ['slang'] = {'file.sl'}, + ['slice'] = {'file.ice'}, + ['solution'] = {'file.sln'}, + ['slpconf'] = {'/etc/slp.conf', 'any/etc/slp.conf'}, + ['slpreg'] = {'/etc/slp.reg', 'any/etc/slp.reg'}, + ['slpspi'] = {'/etc/slp.spi', 'any/etc/slp.spi'}, + ['slrnrc'] = {'.slrnrc'}, + ['slrnsc'] = {'file.score'}, + ['sm'] = {'sendmail.cf'}, + ['svelte'] = {'file.svelte'}, + ['smarty'] = {'file.tpl'}, + ['smcl'] = {'file.hlp', 'file.ihlp', 'file.smcl'}, + ['smith'] = {'file.smt', 'file.smith'}, + ['sml'] = {'file.sml'}, + ['snobol4'] = {'file.sno', 'file.spt'}, + ['sparql'] = {'file.rq', 'file.sparql'}, + ['spec'] = {'file.spec'}, + ['spice'] = {'file.sp', 'file.spice'}, + ['spup'] = {'file.speedup', 'file.spdata', 'file.spd'}, + ['spyce'] = {'file.spy', 'file.spi'}, + ['sql'] = {'file.tyb', 'file.typ', 'file.tyc', 'file.pkb', 'file.pks'}, + ['sqlj'] = {'file.sqlj'}, + ['sqr'] = {'file.sqr', 'file.sqi'}, + ['squid'] = {'squid.conf'}, + ['squirrel'] = {'file.nut'}, + ['srec'] = {'file.s19', 'file.s28', 'file.s37', 'file.mot', 'file.srec'}, + ['sshconfig'] = {'ssh_config', '/.ssh/config', '/etc/ssh/ssh_config.d/file.conf', 'any/etc/ssh/ssh_config.d/file.conf', 'any/.ssh/config', 'any/.ssh/file.conf'}, + ['sshdconfig'] = {'sshd_config', '/etc/ssh/sshd_config.d/file.conf', 'any/etc/ssh/sshd_config.d/file.conf'}, + ['st'] = {'file.st'}, + ['stata'] = {'file.ado', 'file.do', 'file.imata', 'file.mata'}, + ['stp'] = {'file.stp'}, + ['sudoers'] = {'any/etc/sudoers', 'sudoers.tmp', '/etc/sudoers', 'any/etc/sudoers.d/file'}, + ['svg'] = {'file.svg'}, + ['svn'] = {'svn-commitfile.tmp', 'svn-commit-file.tmp', 'svn-commit.tmp'}, + ['swift'] = {'file.swift'}, + ['swiftgyb'] = {'file.swift.gyb'}, + ['sil'] = {'file.sil'}, + ['sysctl'] = {'/etc/sysctl.conf', '/etc/sysctl.d/file.conf', 'any/etc/sysctl.conf', 'any/etc/sysctl.d/file.conf'}, + ['systemd'] = {'any/systemd/file.automount', 'any/systemd/file.dnssd', 'any/systemd/file.link', 'any/systemd/file.mount', 'any/systemd/file.netdev', 'any/systemd/file.network', 'any/systemd/file.nspawn', 'any/systemd/file.path', 'any/systemd/file.service', 'any/systemd/file.slice', 'any/systemd/file.socket', 'any/systemd/file.swap', 'any/systemd/file.target', 'any/systemd/file.timer', '/etc/systemd/some.conf.d/file.conf', '/etc/systemd/system/some.d/file.conf', '/etc/systemd/system/some.d/.#file', '/etc/systemd/system/.#otherfile', '/home/user/.config/systemd/user/some.d/mine.conf', '/home/user/.config/systemd/user/some.d/.#file', '/home/user/.config/systemd/user/.#otherfile', '/.config/systemd/user/.#', '/.config/systemd/user/.#-file', '/.config/systemd/user/file.d/.#', '/.config/systemd/user/file.d/.#-file', '/.config/systemd/user/file.d/file.conf', '/etc/systemd/file.conf.d/file.conf', '/etc/systemd/system/.#', '/etc/systemd/system/.#-file', '/etc/systemd/system/file.d/.#', '/etc/systemd/system/file.d/.#-file', '/etc/systemd/system/file.d/file.conf', '/systemd/file.automount', '/systemd/file.dnssd', '/systemd/file.link', '/systemd/file.mount', '/systemd/file.netdev', '/systemd/file.network', '/systemd/file.nspawn', '/systemd/file.path', '/systemd/file.service', '/systemd/file.slice', '/systemd/file.socket', '/systemd/file.swap', '/systemd/file.target', '/systemd/file.timer', 'any/.config/systemd/user/.#', 'any/.config/systemd/user/.#-file', 'any/.config/systemd/user/file.d/.#', 'any/.config/systemd/user/file.d/.#-file', 'any/.config/systemd/user/file.d/file.conf', 'any/etc/systemd/file.conf.d/file.conf', 'any/etc/systemd/system/.#', 'any/etc/systemd/system/.#-file', 'any/etc/systemd/system/file.d/.#', 'any/etc/systemd/system/file.d/.#-file', 'any/etc/systemd/system/file.d/file.conf'}, + ['systemverilog'] = {'file.sv', 'file.svh'}, + ['tags'] = {'tags'}, + ['tak'] = {'file.tak'}, + ['taskdata'] = {'pending.data', 'completed.data', 'undo.data'}, + ['taskedit'] = {'file.task'}, + ['tcl'] = {'file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc'}, + ['teraterm'] = {'file.ttl'}, + ['terminfo'] = {'file.ti'}, + ['tex'] = {'file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'}, + ['texinfo'] = {'file.texinfo', 'file.texi', 'file.txi'}, + ['texmf'] = {'texmf.cnf'}, + ['text'] = {'file.text', 'file.txt', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'}, + ['tf'] = {'file.tf', '.tfrc', 'tfrc'}, + ['tidy'] = {'.tidyrc', 'tidyrc', 'tidy.conf'}, + ['tilde'] = {'file.t.html'}, + ['tli'] = {'file.tli'}, + ['tmux'] = {'tmuxfile.conf', '.tmuxfile.conf', '.tmux-file.conf', '.tmux.conf', 'tmux-file.conf', 'tmux.conf', 'tmux.conf.local'}, + ['toml'] = {'file.toml', 'Gopkg.lock', 'Pipfile', '/home/user/.cargo/config'}, + ['tpp'] = {'file.tpp'}, + ['treetop'] = {'file.treetop'}, + ['trustees'] = {'trustees.conf'}, + ['tsalt'] = {'file.slt'}, + ['tsscl'] = {'file.tsscl'}, + ['tssgm'] = {'file.tssgm'}, + ['tssop'] = {'file.tssop'}, + ['twig'] = {'file.twig'}, + ['typescriptreact'] = {'file.tsx'}, + ['uc'] = {'file.uc'}, + ['udevconf'] = {'/etc/udev/udev.conf', 'any/etc/udev/udev.conf'}, + ['udevperm'] = {'/etc/udev/permissions.d/file.permissions', 'any/etc/udev/permissions.d/file.permissions'}, + ['udevrules'] = {'/etc/udev/rules.d/file.rules', '/usr/lib/udev/rules.d/file.rules', '/lib/udev/rules.d/file.rules'}, + ['uil'] = {'file.uit', 'file.uil'}, + ['updatedb'] = {'/etc/updatedb.conf', 'any/etc/updatedb.conf'}, + ['upstart'] = {'/usr/share/upstart/file.conf', '/usr/share/upstart/file.override', '/etc/init/file.conf', '/etc/init/file.override', '/.init/file.conf', '/.init/file.override', '/.config/upstart/file.conf', '/.config/upstart/file.override', 'any/.config/upstart/file.conf', 'any/.config/upstart/file.override', 'any/.init/file.conf', 'any/.init/file.override', 'any/etc/init/file.conf', 'any/etc/init/file.override', 'any/usr/share/upstart/file.conf', 'any/usr/share/upstart/file.override'}, + ['upstreamdat'] = {'upstream.dat', 'UPSTREAM.DAT', 'upstream.file.dat', 'UPSTREAM.FILE.DAT', 'file.upstream.dat', 'FILE.UPSTREAM.DAT'}, + ['upstreaminstalllog'] = {'upstreaminstall.log', 'UPSTREAMINSTALL.LOG', 'upstreaminstall.file.log', 'UPSTREAMINSTALL.FILE.LOG', 'file.upstreaminstall.log', 'FILE.UPSTREAMINSTALL.LOG'}, + ['upstreamlog'] = {'fdrupstream.log', 'upstream.log', 'UPSTREAM.LOG', 'upstream.file.log', 'UPSTREAM.FILE.LOG', 'file.upstream.log', 'FILE.UPSTREAM.LOG', 'UPSTREAM-file.log', 'UPSTREAM-FILE.LOG'}, + ['usserverlog'] = {'usserver.log', 'USSERVER.LOG', 'usserver.file.log', 'USSERVER.FILE.LOG', 'file.usserver.log', 'FILE.USSERVER.LOG'}, + ['usw2kagtlog'] = {'usw2kagt.log', 'USW2KAGT.LOG', 'usw2kagt.file.log', 'USW2KAGT.FILE.LOG', 'file.usw2kagt.log', 'FILE.USW2KAGT.LOG'}, + ['vb'] = {'file.sba', 'file.vb', 'file.vbs', 'file.dsm', 'file.ctl'}, + ['vera'] = {'file.vr', 'file.vri', 'file.vrh'}, + ['verilog'] = {'file.v'}, + ['verilogams'] = {'file.va', 'file.vams'}, + ['vgrindefs'] = {'vgrindefs'}, + ['vhdl'] = {'file.hdl', 'file.vhd', 'file.vhdl', 'file.vbe', 'file.vst', 'file.vhdl_123', 'file.vho', 'some.vhdl_1', 'some.vhdl_1-file'}, + ['vim'] = {'file.vim', 'file.vba', '.exrc', '_exrc', 'some-vimrc', 'some-vimrc-file', 'vimrc', 'vimrc-file'}, + ['viminfo'] = {'.viminfo', '_viminfo'}, + ['vmasm'] = {'file.mar'}, + ['voscm'] = {'file.cm'}, + ['vrml'] = {'file.wrl'}, + ['vroom'] = {'file.vroom'}, + ['vue'] = {'file.vue'}, + ['wast'] = {'file.wast', 'file.wat'}, + ['webmacro'] = {'file.wm'}, + ['wget'] = {'.wgetrc', 'wgetrc'}, + ['winbatch'] = {'file.wbt'}, + ['wml'] = {'file.wml'}, + ['wsh'] = {'file.wsf', 'file.wsc'}, + ['wsml'] = {'file.wsml'}, + ['wvdial'] = {'wvdial.conf', '.wvdialrc'}, + ['xdefaults'] = {'.Xdefaults', '.Xpdefaults', '.Xresources', 'xdm-config', 'file.ad', '/Xresources/file', '/app-defaults/file', 'Xresources', 'Xresources-file', 'any/Xresources/file', 'any/app-defaults/file'}, + ['xhtml'] = {'file.xhtml', 'file.xht'}, + ['xinetd'] = {'/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'}, + ['xmath'] = {'file.msc', 'file.msf'}, + ['xml'] = {'/etc/blkid.tab', '/etc/blkid.tab.old', 'file.xmi', 'file.csproj', 'file.csproj.user', 'file.fsproj', 'file.fsproj.user', 'file.vbproj', 'file.vbproj.user', 'file.ui', 'file.tpm', '/etc/xdg/menus/file.menu', 'fglrxrc', 'file.xlf', 'file.xliff', 'file.xul', 'file.wsdl', 'file.wpl', 'any/etc/blkid.tab', 'any/etc/blkid.tab.old', 'any/etc/xdg/menus/file.menu', 'file.atom', 'file.rss', 'file.cdxml', 'file.psc1', 'file.mpd'}, + ['xmodmap'] = {'anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'}, + ['xf86conf'] = {'xorg.conf', 'xorg.conf-4'}, + ['xpm'] = {'file.xpm'}, + ['xpm2'] = {'file.xpm2'}, + ['xquery'] = {'file.xq', 'file.xql', 'file.xqm', 'file.xquery', 'file.xqy'}, + ['xs'] = {'file.xs'}, + ['xsd'] = {'file.xsd'}, + ['xslt'] = {'file.xsl', 'file.xslt'}, + ['yacc'] = {'file.yy', 'file.yxx', 'file.y++'}, + ['yaml'] = {'file.yaml', 'file.yml'}, + ['raml'] = {'file.raml'}, + ['z8a'] = {'file.z8a'}, + ['zig'] = {'file.zig'}, + ['zimbu'] = {'file.zu'}, + ['zimbutempl'] = {'file.zut'}, + ['zsh'] = {'.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'}, + ['help'] = {funcs.getenv('VIMRUNTIME') .. '/doc/help.txt'}, + } + + local filename_case_checks = { + ['modula2'] = {'file.DEF', 'file.MOD'}, + ['bzl'] = {'file.BUILD', 'BUILD'}, + } + + local function check_items(checks) + meths.set_option('swapfile', false) + for ft, names in pairs(checks) do + for _, name in ipairs(names) do + meths.command('new') + meths.command('edit ' .. funcs.fnameescape(name)) + if curbufmeths.get_option('filetype') == '' and curbufmeths.get_option('readonly') then -- luacheck: ignore 542 + -- File exists but not able to edit it (permission denied) + else + eq(ft, curbufmeths.get_option('filetype')) + end + meths.command('bwipe!') + end + end + meths.command('set swapfile&') + end + + meths.set_var('do_filetype_lua', 1) + meths.command('filetype on') + check_items(filename_checks) + if funcs.has('fname_case') == 1 then + check_items(filename_case_checks) + end + meths.command('filetype off') + end) end) diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 1af31c38f8..2fe7eca260 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -73,8 +73,11 @@ local function fake_lsp_server_setup(test_name, timeout_ms, options) on_init = function(client, result) TEST_RPC_CLIENT = client vim.rpcrequest(1, "init", result) - client.config.flags.allow_incremental_sync = options.allow_incremental_sync or false end; + flags = { + allow_incremental_sync = options.allow_incremental_sync or false; + debounce_text_changes = 0; + }; on_exit = function(...) vim.rpcnotify(1, "exit", ...) end; diff --git a/test/unit/charset/vim_str2nr_spec.lua b/test/unit/charset/vim_str2nr_spec.lua index 5fc3b83a13..caf330c378 100644 --- a/test/unit/charset/vim_str2nr_spec.lua +++ b/test/unit/charset/vim_str2nr_spec.lua @@ -463,7 +463,7 @@ describe('vim_str2nr()', function() test_vim_str2nr("1'2'3'4", flags, {len = 7, num = 1234, unum = 1234, pre = 0}, 0) -- counter-intuitive, but like Vim, strict=true should partially accept - -- these: (' and - are not alpha-numeric) + -- these: (' and - are not alphanumeric) test_vim_str2nr("7''331", flags, {len = 1, num = 7, unum = 7, pre = 0}, 0) test_vim_str2nr("123'x4", flags, {len = 3, num = 123, unum = 123, pre = 0}, 0) test_vim_str2nr("1337'", flags, {len = 4, num = 1337, unum = 1337, pre = 0}, 0) diff --git a/test/unit/garray_spec.lua b/test/unit/garray_spec.lua index 28df8a6e3f..5d41dd39ec 100644 --- a/test/unit/garray_spec.lua +++ b/test/unit/garray_spec.lua @@ -18,7 +18,7 @@ local growsize = 95 -- constructing a class wrapper around garray. It could for example associate -- ga_clear_strings to the underlying garray cdata if the garray is a string -- array. But for now I estimate that that kind of magic might make testing --- less "transparant" (i.e.: the interface would become quite different as to +-- less "transparent" (i.e.: the interface would become quite different as to -- how one would use it from C. -- accessors diff --git a/test/unit/os/env_spec.lua b/test/unit/os/env_spec.lua index e7cb5e5d5e..a0e02b6624 100644 --- a/test/unit/os/env_spec.lua +++ b/test/unit/os/env_spec.lua @@ -191,7 +191,7 @@ describe('env.c', function() if ffi.abi('64bit') then -- couldn't use a bigger number because it gets converted to - -- double somewere, should be big enough anyway + -- double somewhere, should be big enough anyway -- maxuint64 = ffi.new 'size_t', 18446744073709551615 local maxuint64 = ffi.new('size_t', 18446744073709000000) eq(NULL, cimp.os_getenvname_at_index(maxuint64)) diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua index 7fd71cb1ae..0bb33772cd 100644 --- a/test/unit/os/fs_spec.lua +++ b/test/unit/os/fs_spec.lua @@ -1029,7 +1029,7 @@ describe('fs.c', function() itp('returns the correct blocksize of a file', function() local path = 'unit-test-directory/test.file' -- there is a bug in luafilesystem where - -- `lfs.attributes path, 'blksize'` returns the worng value: + -- `lfs.attributes path, 'blksize'` returns the wrong value: -- https://github.com/keplerproject/luafilesystem/pull/44 -- using this workaround for now: local blksize = lfs.attributes(path).blksize @@ -1038,7 +1038,7 @@ describe('fs.c', function() if blksize then eq(blksize, fs.os_fileinfo_blocksize(info)) else - -- luafs dosn't support blksize on windows + -- luafs doesn't support blksize on windows -- libuv on windows returns a constant value as blocksize -- checking for this constant value should be enough eq(2048, fs.os_fileinfo_blocksize(info)) |