aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/compiler/vimdoc.vim19
-rw-r--r--runtime/doc/editing.txt19
-rw-r--r--runtime/ftplugin/bp.vim14
-rw-r--r--runtime/ftplugin/cgdbrc.vim21
-rw-r--r--runtime/ftplugin/vim.vim2
-rw-r--r--runtime/lua/vim/_defaults.lua1
-rw-r--r--runtime/lua/vim/filetype.lua66
-rw-r--r--runtime/lua/vim/filetype/detect.lua7
-rw-r--r--runtime/syntax/cgdbrc.vim16
-rw-r--r--src/nvim/api/win_config.c23
-rw-r--r--test/functional/editor/macro_spec.lua165
-rw-r--r--test/functional/ui/float_spec.lua8
-rw-r--r--test/old/testdir/test_filetype.vim164
13 files changed, 433 insertions, 92 deletions
diff --git a/runtime/compiler/vimdoc.vim b/runtime/compiler/vimdoc.vim
new file mode 100644
index 0000000000..d83b924177
--- /dev/null
+++ b/runtime/compiler/vimdoc.vim
@@ -0,0 +1,19 @@
+" Vim Compiler File
+" Language: vimdoc
+" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
+" Latest Revision: 2024-04-09
+"
+" you can get it by `pip install vimdoc` or the package manager of your distribution.
+
+if exists('b:current_compiler')
+ finish
+endif
+let b:current_compiler = 'vimdoc'
+
+let s:save_cpoptions = &cpoptions
+set cpoptions&vim
+
+CompilerSet makeprg=vimdoc
+
+let &cpoptions = s:save_cpoptions
+unlet s:save_cpoptions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 1a4572e94a..662d89895d 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -632,9 +632,12 @@ list of the current window.
:[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit*
Add {name}s to the argument list and edit it.
- When {name} already exists in the argument list, this
- entry is edited.
- This is like using |:argadd| and then |:edit|.
+ There is no check for duplicates, it is possible to
+ add a file to the argument list twice |:argded|.
+ This is like using |:argadd| and then |:edit| (with
+ the small exception that |:edit| does not change the
+ argument list, so the argument list pointer isn't
+ changed).
Spaces in filenames have to be escaped with "\".
[count] is used like with |:argadd|.
If the current file cannot be |abandon|ed {name}s will
@@ -653,12 +656,12 @@ list of the current window.
If the argument list is "a b c", and "b" is the
current argument, then these commands result in:
command new argument list ~
- :argadd x a b x c
- :0argadd x x a b c
- :1argadd x a x b c
- :$argadd x a b c x
+ :argadd x a [b] x c
+ :0argadd x x a [b] c
+ :1argadd x a x [b] c
+ :$argadd x a [b] c x
And after the last one:
- :+2argadd y a b c x y
+ :+2argadd y a [b] c x y
There is no check for duplicates, it is possible to
add a file to the argument list twice. You can use
|:argdedupe| to fix it afterwards: >
diff --git a/runtime/ftplugin/bp.vim b/runtime/ftplugin/bp.vim
new file mode 100644
index 0000000000..cb925cb0ec
--- /dev/null
+++ b/runtime/ftplugin/bp.vim
@@ -0,0 +1,14 @@
+" Blueprint build system filetype plugin file
+" Language: Blueprint
+" Maintainer: Bruno BELANYI <bruno.vim@belanyi.fr>
+" Latest Revision: 2024-04-10
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal comments=b:#
+setlocal commentstring=#\ %s
+
+let b:undo_ftplugin = "setlocal comments< commentstring<"
diff --git a/runtime/ftplugin/cgdbrc.vim b/runtime/ftplugin/cgdbrc.vim
new file mode 100644
index 0000000000..46cf135c5c
--- /dev/null
+++ b/runtime/ftplugin/cgdbrc.vim
@@ -0,0 +1,21 @@
+" Vim filetype plugin file
+" Language: cgdbrc
+" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
+" Documentation: https://cgdb.github.io/docs/Configuring-CGDB.html
+" Latest Revision: 2024-04-09
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:save_cpoptions = &cpoptions
+set cpoptions&vim
+
+let b:undo_ftplugin = 'setl com< cms<'
+
+setlocal commentstring=#%s
+setlocal comments=:#
+
+let &cpoptions = s:save_cpoptions
+unlet s:save_cpoptions
diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim
index f734947ac8..3f9b4139de 100644
--- a/runtime/ftplugin/vim.vim
+++ b/runtime/ftplugin/vim.vim
@@ -15,6 +15,8 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
+compiler vimdoc
+
if !exists('*VimFtpluginUndo')
func VimFtpluginUndo()
setl fo< isk< com< tw< commentstring< keywordprg<
diff --git a/runtime/lua/vim/_defaults.lua b/runtime/lua/vim/_defaults.lua
index 90d05f67a5..2f02c2b389 100644
--- a/runtime/lua/vim/_defaults.lua
+++ b/runtime/lua/vim/_defaults.lua
@@ -93,6 +93,7 @@ do
"':normal! @'.getcharstr().'<CR>'",
{ silent = true, expr = true, desc = ':help v_@-default' }
)
+
--- Map |gx| to call |vim.ui.open| on the identifier under the cursor
do
local function do_open(uri)
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index bbe1e2c89c..215be7fdc2 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -236,6 +236,7 @@ local extension = {
bbclass = 'bitbake',
bl = 'blank',
blp = 'blueprint',
+ bp = 'bp',
bsd = 'bsdl',
bsdl = 'bsdl',
bst = 'bst',
@@ -252,7 +253,7 @@ local extension = {
capnp = 'capnp',
cdc = 'cdc',
cdl = 'cdl',
- toc = 'cdrtoc',
+ toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'),
cfc = 'cf',
cfm = 'cf',
cfi = 'cf',
@@ -582,6 +583,9 @@ local extension = {
['sublime-settings'] = 'json',
['sublime-workspace'] = 'json',
['json-patch'] = 'json',
+ bd = 'json',
+ bda = 'json',
+ xci = 'json',
json5 = 'json5',
jsonc = 'jsonc',
jsonl = 'jsonl',
@@ -631,7 +635,7 @@ local extension = {
livemd = 'livebook',
lgt = 'logtalk',
lotos = 'lotos',
- lot = 'lotos',
+ lot = detect_line1('\\contentsline', 'tex', 'lotos'),
lout = 'lout',
lou = 'lout',
ulpc = 'lpc',
@@ -770,8 +774,11 @@ local extension = {
papp = 'papp',
pxml = 'papp',
pas = 'pascal',
- lpr = 'pascal',
+ lpr = detect_line1('<%?xml', 'xml', 'pascal'),
dpr = 'pascal',
+ txtpb = 'pbtxt',
+ textproto = 'pbtxt',
+ textpb = 'pbtxt',
pbtxt = 'pbtxt',
g = 'pccts',
pcmk = 'pcmk',
@@ -1035,6 +1042,27 @@ local extension = {
bbl = 'tex',
latex = 'tex',
sty = 'tex',
+ pgf = 'tex',
+ nlo = 'tex',
+ nls = 'tex',
+ out = 'tex',
+ thm = 'tex',
+ eps_tex = 'tex',
+ pygtex = 'tex',
+ pygstyle = 'tex',
+ clo = 'tex',
+ aux = 'tex',
+ brf = 'tex',
+ ind = 'tex',
+ lof = 'tex',
+ loe = 'tex',
+ nav = 'tex',
+ vrb = 'tex',
+ ins = 'tex',
+ tikz = 'tex',
+ bbx = 'tex',
+ cbx = 'tex',
+ beamer = 'tex',
cls = detect.cls,
texi = 'texinfo',
txi = 'texinfo',
@@ -1135,6 +1163,14 @@ local extension = {
csproj = 'xml',
wpl = 'xml',
xmi = 'xml',
+ xpr = 'xml',
+ xpfm = 'xml',
+ spfm = 'xml',
+ bxml = 'xml',
+ xcu = 'xml',
+ xlb = 'xml',
+ xlc = 'xml',
+ xba = 'xml',
xpm = detect_line1('XPM2', 'xpm2', 'xpm'),
xpm2 = 'xpm2',
xqy = 'xquery',
@@ -1257,7 +1293,9 @@ local filename = {
['/etc/default/cdrdao'] = 'cdrdaoconf',
['/etc/defaults/cdrdao'] = 'cdrdaoconf',
['cfengine.conf'] = 'cfengine',
+ cgdbrc = 'cgdbrc',
['CMakeLists.txt'] = 'cmake',
+ ['.cling_history'] = 'cpp',
['.alias'] = detect.csh,
['.cshrc'] = detect.csh,
['.login'] = detect.csh,
@@ -1265,6 +1303,8 @@ local filename = {
['csh.login'] = detect.csh,
['csh.logout'] = detect.csh,
['auto.master'] = 'conf',
+ ['texdoc.cnf'] = 'conf',
+ ['.x11vncrc'] = 'conf',
['configure.in'] = 'config',
['configure.ac'] = 'config',
crontab = 'crontab',
@@ -1290,9 +1330,13 @@ local filename = {
npmrc = 'dosini',
['/etc/yum.conf'] = 'dosini',
['.npmrc'] = 'dosini',
+ ['pip.conf'] = 'dosini',
['setup.cfg'] = 'dosini',
['pudb.cfg'] = 'dosini',
['.coveragerc'] = 'dosini',
+ ['psprint.conf'] = 'dosini',
+ sofficerc = 'dosini',
+ ['mimeapps.list'] = 'dosini',
['/etc/pacman.conf'] = 'confini',
['mpv.conf'] = 'confini',
dune = 'dune',
@@ -1367,6 +1411,7 @@ local filename = {
['ipf.conf'] = 'ipfilter',
['ipf6.conf'] = 'ipfilter',
['ipf.rules'] = 'ipfilter',
+ ['.node_repl_history'] = 'javascript',
['Pipfile.lock'] = 'json',
['.firebaserc'] = 'json',
['.prettierrc'] = 'json',
@@ -1397,12 +1442,14 @@ local filename = {
['.lsl'] = detect.lsl,
['.busted'] = 'lua',
['.luacheckrc'] = 'lua',
+ ['.lua_history'] = 'lua',
['config.ld'] = 'lua',
['rock_manifest'] = 'lua',
['lynx.cfg'] = 'lynx',
['m3overrides'] = 'm3build',
['m3makefile'] = 'm3build',
['cm3.cfg'] = 'm3quake',
+ ['.m4_history'] = 'm4',
['.followup'] = 'mail',
['.article'] = 'mail',
['.letter'] = 'mail',
@@ -1476,6 +1523,8 @@ local filename = {
['MANIFEST.in'] = 'pymanifest',
['.pythonstartup'] = 'python',
['.pythonrc'] = 'python',
+ ['.python_history'] = 'python',
+ ['.jline-jython.history'] = 'python',
SConstruct = 'python',
qmldir = 'qmldir',
['.Rhistory'] = 'r',
@@ -1494,6 +1543,8 @@ local filename = {
Puppetfile = 'ruby',
['.irbrc'] = 'ruby',
irbrc = 'ruby',
+ ['.irb_history'] = 'ruby',
+ irb_history = 'ruby',
Vagrantfile = 'ruby',
['smb.conf'] = 'samba',
screenrc = 'screen',
@@ -1503,6 +1554,7 @@ local filename = {
['/etc/services'] = 'services',
['/etc/serial.conf'] = 'setserial',
['/etc/udev/cdsymlinks.conf'] = 'sh',
+ ['.ash_history'] = 'sh',
['bash.bashrc'] = detect.bash,
bashrc = detect.bash,
['.bashrc'] = detect.bash,
@@ -1519,6 +1571,7 @@ local filename = {
['/etc/slp.spi'] = 'slpspi',
['.slrnrc'] = 'slrnrc',
['sendmail.cf'] = 'sm',
+ ['.sqlite_history'] = 'sql',
['squid.conf'] = 'squid',
['ssh_config'] = 'sshconfig',
['sshd_config'] = 'sshdconfig',
@@ -1531,7 +1584,10 @@ local filename = {
['undo.data'] = 'taskdata',
['.tclshrc'] = 'tcl',
['.wishrc'] = 'tcl',
+ ['.tclsh-history'] = 'tcl',
['tclsh.rc'] = 'tcl',
+ ['.xsctcmdhistory'] = 'tcl',
+ ['.xsdbcmdhistory'] = 'tcl',
['texmf.cnf'] = 'texmf',
COPYING = 'text',
README = 'text',
@@ -1549,6 +1605,7 @@ local filename = {
['/.cargo/credentials'] = 'toml',
['Cargo.lock'] = 'toml',
['trustees.conf'] = 'trustees',
+ ['.ts_node_repl_history'] = 'typescript',
['/etc/udev/udev.conf'] = 'udevconf',
['/etc/updatedb.conf'] = 'updatedb',
['fdrupstream.log'] = 'upstreamlog',
@@ -1695,6 +1752,8 @@ local pattern = {
['.*/%.aws/credentials'] = 'confini',
['.*/etc/pacman%.conf'] = 'confini',
['.*/etc/yum%.conf'] = 'dosini',
+ ['.*/lxqt/.*%.conf'] = 'dosini',
+ ['.*/screengrab/.*%.conf'] = 'dosini',
['.*lvs'] = 'dracula',
['.*lpe'] = 'dracula',
['.*/dtrace/.*%.d'] = 'dtrace',
@@ -2023,6 +2082,7 @@ local pattern = {
['.*termcap.*'] = starsetf(function(path, bufnr)
return require('vim.filetype.detect').printcap('term')
end),
+ ['.*/tex/latex/.*%.cfg'] = 'tex',
['.*%.t%.html'] = 'tilde',
['%.?tmux.*%.conf'] = 'tmux',
['%.?tmux.*%.conf.*'] = { 'tmux', { priority = -1 } },
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index ca2c53b75d..c48984d151 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -458,6 +458,9 @@ end
--- @type vim.filetype.mapfn
function M.def(_, bufnr)
+ if getline(bufnr, 1):find('%%%%') then
+ return 'tex'
+ end
if vim.g.filetype_def == 'modula2' or is_modula2(bufnr) then
return modula2(bufnr)
end
@@ -738,7 +741,9 @@ end
--- @type vim.filetype.mapfn
function M.inp(_, bufnr)
- if getline(bufnr, 1):find('^%*') then
+ if getline(bufnr, 1):find('%%%%') then
+ return 'tex'
+ elseif getline(bufnr, 1):find('^%*') then
return 'abaqus'
else
for _, line in ipairs(getlines(bufnr, 1, 500)) do
diff --git a/runtime/syntax/cgdbrc.vim b/runtime/syntax/cgdbrc.vim
new file mode 100644
index 0000000000..1ace370d8c
--- /dev/null
+++ b/runtime/syntax/cgdbrc.vim
@@ -0,0 +1,16 @@
+" Vim syntax file
+" Language: cgdbrc
+" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
+" Documentation: https://cgdb.github.io/docs/Configuring-CGDB.html
+" Latest Revision: 2024-04-09
+
+if exists('b:current_syntax')
+ finish
+endif
+let b:current_syntax = 'cgdbrc'
+
+runtime! syntax/vim.vim
+
+syn region cgdbComment start="^\s*\#" skip="\\$" end="$" contains=@Spell
+
+highlight default link cgdbComment Comment
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index f16e614c47..184efd3647 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -225,7 +225,7 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dict(win_config) *config, Err
}
WinConfig fconfig = WIN_CONFIG_INIT;
- if (!parse_float_config(config, &fconfig, false, true, err)) {
+ if (!parse_float_config(NULL, config, &fconfig, false, err)) {
return 0;
}
@@ -396,7 +396,7 @@ void nvim_win_set_config(Window window, Dict(win_config) *config, Error *err)
&& !(HAS_KEY_X(config, external) ? config->external : fconfig.external)
&& (has_split || has_vertical || was_split);
- if (!parse_float_config(config, &fconfig, !was_split || to_split, false, err)) {
+ if (!parse_float_config(win, config, &fconfig, !was_split || to_split, err)) {
return;
}
if (was_split && !to_split) {
@@ -1023,8 +1023,8 @@ static void parse_border_style(Object style, WinConfig *fconfig, Error *err)
}
}
-static bool parse_float_config(Dict(win_config) *config, WinConfig *fconfig, bool reconf,
- bool new_win, Error *err)
+static bool parse_float_config(win_T *wp, Dict(win_config) *config, WinConfig *fconfig, bool reconf,
+ Error *err)
{
#define HAS_KEY_X(d, key) HAS_KEY(d, win_config, key)
bool has_relative = false, relative_is_win = false, is_split = false;
@@ -1049,7 +1049,7 @@ static bool parse_float_config(Dict(win_config) *config, WinConfig *fconfig, boo
} else if (!config->external) {
if (HAS_KEY_X(config, vertical) || HAS_KEY_X(config, split)) {
is_split = true;
- } else if (new_win) {
+ } else if (wp == NULL) { // new win
api_set_error(err, kErrorTypeValidation,
"Must specify 'relative' or 'external' when creating a float");
return false;
@@ -1141,6 +1141,17 @@ static bool parse_float_config(Dict(win_config) *config, WinConfig *fconfig, boo
}
if (relative_is_win || is_split) {
+ if (reconf && relative_is_win) {
+ win_T *target_win = find_window_by_handle(config->win, err);
+ if (!target_win) {
+ return false;
+ }
+
+ if (target_win == wp) {
+ api_set_error(err, kErrorTypeException, "floating window cannot be relative to itself");
+ return false;
+ }
+ }
fconfig->window = curwin->handle;
if (HAS_KEY_X(config, win)) {
if (config->win > 0) {
@@ -1266,7 +1277,7 @@ static bool parse_float_config(Dict(win_config) *config, WinConfig *fconfig, boo
}
if (HAS_KEY_X(config, noautocmd)) {
- if (!new_win) {
+ if (wp) {
api_set_error(err, kErrorTypeValidation, "'noautocmd' cannot be used with existing windows");
return false;
}
diff --git a/test/functional/editor/macro_spec.lua b/test/functional/editor/macro_spec.lua
index 3ccf1ea770..a2a165ab0f 100644
--- a/test/functional/editor/macro_spec.lua
+++ b/test/functional/editor/macro_spec.lua
@@ -10,10 +10,11 @@ local fn = t.fn
local api = t.api
local insert = t.insert
-describe('macros', function()
+describe('macros with default mappings', function()
before_each(function()
clear({ args_rm = { '--cmd' } })
end)
+
it('can be recorded and replayed', function()
feed('qiahello<esc>q')
expect('hello')
@@ -22,6 +23,7 @@ describe('macros', function()
expect('hellohello')
eq('ahello', eval('@i'))
end)
+
it('applies maps', function()
command('imap x l')
command('nmap l a')
@@ -34,87 +36,184 @@ describe('macros', function()
end)
it('can be replayed with Q', function()
- insert [[hello
+ insert [[
+hello
hello
hello]]
feed [[gg]]
feed [[qqAFOO<esc>q]]
- eq({ 'helloFOO', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOO
+hello
+hello]]
feed [[Q]]
- eq({ 'helloFOOFOO', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOOFOO
+hello
+hello]]
feed [[G3Q]]
- eq({ 'helloFOOFOO', 'hello', 'helloFOOFOOFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOOFOO
+hello
+helloFOOFOOFOO]]
feed [[ggV3jQ]]
- eq(
- { 'helloFOOFOOFOO', 'helloFOO', 'helloFOOFOOFOOFOO' },
- api.nvim_buf_get_lines(0, 0, -1, false)
- )
+ expect [[
+helloFOOFOOFOO
+helloFOO
+helloFOOFOOFOOFOO]]
end)
- it('can be replayed with @', function()
- insert [[hello
+ it('can be replayed with Q and @@', function()
+ insert [[
+hello
hello
hello]]
feed [[gg]]
feed [[qqAFOO<esc>q]]
- eq({ 'helloFOO', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOO
+hello
+hello]]
feed [[Q]]
- eq({ 'helloFOOFOO', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOOFOO
+hello
+hello]]
feed [[G3@@]]
- eq({ 'helloFOOFOO', 'hello', 'helloFOOFOOFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOOFOO
+hello
+helloFOOFOOFOO]]
feed [[ggV2j@@]]
- eq(
- { 'helloFOOFOOFOO', 'helloFOO', 'helloFOOFOOFOOFOO' },
- api.nvim_buf_get_lines(0, 0, -1, false)
- )
+ expect [[
+helloFOOFOOFOO
+helloFOO
+helloFOOFOOFOOFOO]]
end)
- it('can be replayed with @q and @w', function()
- insert [[hello
+ it('can be replayed with @ in linewise Visual mode', function()
+ insert [[
+hello
hello
hello]]
feed [[gg]]
feed [[qqAFOO<esc>qu]]
- eq({ 'hello', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+hello
+hello
+hello]]
feed [[qwA123<esc>qu]]
- eq({ 'hello', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+hello
+hello
+hello]]
feed [[V3j@q]]
- eq({ 'helloFOO', 'helloFOO', 'helloFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOO
+helloFOO
+helloFOO]]
- feed [[gg]]
- feed [[Vj@w]]
- eq({ 'helloFOO123', 'helloFOO123', 'helloFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ feed [[ggVj@w]]
+ expect [[
+helloFOO123
+helloFOO123
+helloFOO]]
end)
- it('can be replayed with @q and @w visual-block', function()
- insert [[hello
+ -- XXX: does this really make sense?
+ it('can be replayed with @ in blockwise Visual mode', function()
+ insert [[
+hello
hello
hello]]
feed [[gg]]
feed [[qqAFOO<esc>qu]]
- eq({ 'hello', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+hello
+hello
+hello]]
feed [[qwA123<esc>qu]]
- eq({ 'hello', 'hello', 'hello' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+hello
+hello
+hello]]
feed [[<C-v>3j@q]]
- eq({ 'helloFOO', 'helloFOO', 'helloFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+ expect [[
+helloFOO
+helloFOO
+helloFOO]]
+ feed [[gg<C-v>j@w]]
+ expect [[
+helloFOO123
+helloFOO123
+helloFOO]]
+ end)
+end)
+
+describe('macros without default mappings', function()
+ before_each(clear)
+
+ it('can be recorded and replayed in Visual mode', function()
+ insert('foo BAR BAR foo BAR foo BAR BAR BAR foo BAR BAR')
+ feed('0vqifofRq')
+ eq({ 0, 1, 7, 0 }, fn.getpos('.'))
+ eq({ 0, 1, 1, 0 }, fn.getpos('v'))
+ feed('Q')
+ eq({ 0, 1, 19, 0 }, fn.getpos('.'))
+ eq({ 0, 1, 1, 0 }, fn.getpos('v'))
+ feed('Q')
+ eq({ 0, 1, 27, 0 }, fn.getpos('.'))
+ eq({ 0, 1, 1, 0 }, fn.getpos('v'))
+ feed('@i')
+ eq({ 0, 1, 43, 0 }, fn.getpos('.'))
+ eq({ 0, 1, 1, 0 }, fn.getpos('v'))
+ end)
+
+ it('can be replayed with @ in blockwise Visual mode', function()
+ insert [[
+hello
+hello
+hello]]
feed [[gg]]
- feed [[<C-v>j@w]]
- eq({ 'helloFOO123', 'helloFOO123', 'helloFOO' }, api.nvim_buf_get_lines(0, 0, -1, false))
+
+ feed [[qqAFOO<esc>qu]]
+ expect [[
+hello
+hello
+hello]]
+
+ feed [[qwA123<esc>qu]]
+ expect [[
+hello
+hello
+hello]]
+
+ feed [[0<C-v>3jl@q]]
+ expect [[
+heFOOllo
+heFOOllo
+heFOOllo]]
+
+ feed [[gg0<C-v>j@w]]
+ expect [[
+h123eFOOllo
+h123eFOOllo
+heFOOllo]]
end)
end)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index a328adb2ce..41b5b6ed2f 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -9227,6 +9227,14 @@ describe('float window', function()
eq(restcmd, fn.winrestcmd())
eq(config, api.nvim_win_get_config(0))
end)
+
+ it("error when relative to itself", function()
+ local buf = api.nvim_create_buf(false, true)
+ local config = { relative='win', width=5, height=2, row=3, col=3 }
+ local winid = api.nvim_open_win(buf, false, config)
+ api.nvim_set_current_win(winid)
+ eq("floating window cannot be relative to itself", pcall_err(api.nvim_win_set_config, winid, config))
+ end)
end
describe('with ext_multigrid', function()
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index a8d781fefb..17414e1d3b 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -108,7 +108,7 @@ func s:GetFilenameChecks() abort
\ 'asterisk': ['asterisk/file.conf', 'asterisk/file.conf-file', 'some-asterisk/file.conf', 'some-asterisk/file.conf-file'],
\ 'astro': ['file.astro'],
\ 'atlas': ['file.atl', 'file.as'],
- \ 'authzed': ['file.zed'],
+ \ 'authzed': ['schema.zed'],
\ 'autohotkey': ['file.ahk'],
\ 'autoit': ['file.au3'],
\ 'automake': ['GNUmakefile.am', 'makefile.am', 'Makefile.am'],
@@ -127,6 +127,7 @@ func s:GetFilenameChecks() abort
\ 'blade': ['file.blade.php'],
\ 'blank': ['file.bl'],
\ 'blueprint': ['file.blp'],
+ \ 'bp': ['Android.bp'],
\ 'bsdl': ['file.bsd', 'file.bsdl'],
\ 'bst': ['file.bst'],
\ 'bzl': ['file.bazel', 'file.bzl', 'WORKSPACE', 'WORKSPACE.bzlmod'],
@@ -145,6 +146,7 @@ func s:GetFilenameChecks() abort
\ 'cf': ['file.cfm', 'file.cfi', 'file.cfc'],
\ 'cfengine': ['cfengine.conf'],
\ 'cfg': ['file.hgrc', 'filehgrc', 'hgrc', 'some-hgrc'],
+ \ 'cgdbrc': ['cgdbrc'],
\ 'ch': ['file.chf'],
\ 'chaiscript': ['file.chai'],
\ 'chaskell': ['file.chs'],
@@ -161,7 +163,7 @@ func s:GetFilenameChecks() abort
\ 'cobol': ['file.cbl', 'file.cob', 'file.lib'],
\ 'coco': ['file.atg'],
\ 'conaryrecipe': ['file.recipe'],
- \ 'conf': ['auto.master', 'file.conf'],
+ \ 'conf': ['auto.master', 'file.conf', 'texdoc.cnf', '.x11vncrc'],
\ 'config': ['configure.in', 'configure.ac', '/etc/hostname.file', 'any/etc/hostname.file'],
\ 'confini': ['/etc/pacman.conf', 'any/etc/pacman.conf', 'mpv.conf', 'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection'],
\ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'],
@@ -211,7 +213,7 @@ func s:GetFilenameChecks() abort
\ 'dnsmasq': ['/etc/dnsmasq.conf', '/etc/dnsmasq.d/file', 'any/etc/dnsmasq.conf', 'any/etc/dnsmasq.d/file'],
\ 'dockerfile': ['Containerfile', 'Dockerfile', 'dockerfile', 'file.Dockerfile', 'file.dockerfile', 'Dockerfile.debian', 'Containerfile.something'],
\ 'dosbatch': ['file.bat'],
- \ 'dosini': ['/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap', 'file.vbp', 'ja2.ini', 'JA2.INI', 'setup.cfg', 'pudb.cfg', '.coveragerc'],
+ \ 'dosini': ['/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap', 'file.vbp', 'ja2.ini', 'JA2.INI', 'mimeapps.list', 'pip.conf', 'setup.cfg', 'pudb.cfg', '.coveragerc', 'psprint.conf', 'sofficerc', 'any/.config/lxqt/globalkeyshortcuts.conf', 'any/.config/screengrab/screengrab.conf'],
\ 'dot': ['file.dot', 'file.gv'],
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
\ 'dtd': ['file.dtd'],
@@ -344,7 +346,7 @@ func s:GetFilenameChecks() abort
\ 'janet': ['file.janet'],
\ 'java': ['file.java', 'file.jav'],
\ 'javacc': ['file.jj', 'file.jjt'],
- \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'],
+ \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs', '.node_repl_history'],
\ 'javascript.glimmer': ['file.gjs'],
\ 'javascriptreact': ['file.jsx'],
\ 'jess': ['file.clp'],
@@ -352,7 +354,7 @@ func s:GetFilenameChecks() abort
\ 'jq': ['file.jq'],
\ 'jovial': ['file.jov', 'file.j73', 'file.jovial'],
\ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file', 'org.eclipse.xyz.prefs'],
- \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace'],
+ \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.geojson', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb', 'file.jupyterlab-settings', '.prettierrc', '.firebaserc', '.stylelintrc', 'file.slnf', 'file.sublime-project', 'file.sublime-settings', 'file.sublime-workspace', 'file.bd', 'file.bda', 'file.xci'],
\ 'json5': ['file.json5'],
\ 'jsonc': ['file.jsonc', '.babelrc', '.eslintrc', '.jsfmtrc', '.jshintrc', '.hintrc', '.swrc', 'jsconfig.json', 'tsconfig.json', 'tsconfig.test.json', 'tsconfig-test.json', '.luaurc'],
\ 'jsonl': ['file.jsonl'],
@@ -398,13 +400,13 @@ func s:GetFilenameChecks() abort
\ 'lpc': ['file.lpc', 'file.ulpc'],
\ 'lsl': ['file.lsl'],
\ 'lss': ['file.lss'],
- \ 'lua': ['file.lua', 'file.tlu', 'file.rockspec', 'file.nse', '.luacheckrc', '.busted', 'rock_manifest', 'config.ld'],
+ \ 'lua': ['file.lua', 'file.tlu', 'file.rockspec', 'file.nse', '.lua_history', '.luacheckrc', '.busted', 'rock_manifest', 'config.ld'],
\ 'luau': ['file.luau'],
\ 'lynx': ['lynx.cfg'],
\ 'lyrics': ['file.lrc'],
\ 'm3build': ['m3makefile', 'm3overrides'],
\ 'm3quake': ['file.quake', 'cm3.cfg'],
- \ 'm4': ['file.at'],
+ \ 'm4': ['file.at', '.m4_history'],
\ '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'],
@@ -423,13 +425,32 @@ func s:GetFilenameChecks() abort
\ 'mel': ['file.mel'],
\ 'mermaid': ['file.mmd', 'file.mmdc', 'file.mermaid'],
\ 'meson': ['meson.build', 'meson.options', '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'],
+ \ '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'],
@@ -452,7 +473,18 @@ func s:GetFilenameChecks() abort
\ 'mupad': ['file.mu'],
\ 'mush': ['file.mush'],
\ 'mustache': ['file.mustache'],
- \ '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'],
+ \ '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', '.mysql_history'],
\ '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'],
@@ -492,7 +524,7 @@ func s:GetFilenameChecks() abort
\ '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'],
+ \ 'pbtxt': ['file.txtpb', 'file.textproto', 'file.textpb', 'file.pbtxt'],
\ 'pccts': ['file.g'],
\ 'pcmk': ['file.pcmk'],
\ 'pdf': ['file.pdf'],
@@ -536,7 +568,7 @@ func s:GetFilenameChecks() abort
\ 'pymanifest': ['MANIFEST.in'],
\ 'pyret': ['file.arr'],
\ 'pyrex': ['file.pyx', 'file.pxd'],
- \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'],
+ \ 'python': ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', '.python_history', '.jline-jython.history', 'file.ptl', 'file.pyi', 'SConstruct'],
\ 'ql': ['file.ql', 'file.qll'],
\ 'qml': ['file.qml', 'file.qbs'],
\ 'qmldir': ['qmldir'],
@@ -576,7 +608,7 @@ func s:GetFilenameChecks() abort
\ 'rrst': ['file.rrst', 'file.srst'],
\ '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', 'Vagrantfile'],
+ \ 'ruby': ['.irbrc', 'irbrc', '.irb_history', 'irb_history', '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', 'Vagrantfile'],
\ 'rust': ['file.rs'],
\ 'samba': ['smb.conf'],
\ 'sas': ['file.sas'],
@@ -596,7 +628,7 @@ func s:GetFilenameChecks() abort
\ 'services': ['/etc/services', 'any/etc/services'],
\ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'],
\ 'sexplib': ['file.sexp'],
- \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats'],
+ \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'APKBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history'],
\ 'sieve': ['file.siv', 'file.sieve'],
\ 'sil': ['file.sil'],
\ 'simula': ['file.sim'],
@@ -627,7 +659,7 @@ func s:GetFilenameChecks() abort
\ 'spice': ['file.sp', 'file.spice'],
\ 'spup': ['file.speedup', 'file.spdata', 'file.spd'],
\ 'spyce': ['file.spy', 'file.spi'],
- \ 'sql': ['file.tyb', 'file.tyc', 'file.pkb', 'file.pks'],
+ \ 'sql': ['file.tyb', 'file.tyc', 'file.pkb', 'file.pks', '.sqlite_history'],
\ 'sqlj': ['file.sqlj'],
\ 'prql': ['file.prql'],
\ 'sqr': ['file.sqr', 'file.sqi'],
@@ -653,7 +685,45 @@ func s:GetFilenameChecks() abort
\ 'swiftgyb': ['file.swift.gyb'],
\ 'swig': ['file.swg', 'file.swig'],
\ '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'],
+ \ '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'],
\ 'trace32': ['file.cmm', 'file.t32'],
\ 'tags': ['tags'],
@@ -661,14 +731,14 @@ func s:GetFilenameChecks() abort
\ 'tal': ['file.tal'],
\ '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'],
+ \ 'tcl': ['file.tcl', 'file.tm', 'file.tk', 'file.itcl', 'file.itk', 'file.jacl', '.tclshrc', 'tclsh.rc', '.wishrc', '.tclsh-history', '.xsctcmdhistory', '.xsdbcmdhistory'],
\ 'tablegen': ['file.td'],
\ 'teal': ['file.tl'],
\ 'template': ['file.tmpl'],
\ 'teraterm': ['file.ttl'],
\ 'terminfo': ['file.ti'],
\ 'terraform-vars': ['file.tfvars'],
- \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'],
+ \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.out', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer'],
\ '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'],
@@ -689,7 +759,7 @@ func s:GetFilenameChecks() abort
\ 'tssop': ['file.tssop'],
\ 'tsv': ['file.tsv'],
\ 'twig': ['file.twig'],
- \ 'typescript': ['file.mts', 'file.cts'],
+ \ 'typescript': ['file.mts', 'file.cts', '.ts_node_repl_history'],
\ 'typescript.glimmer': ['file.gts'],
\ 'typescriptreact': ['file.tsx'],
\ 'typespec': ['file.tsp'],
@@ -748,7 +818,7 @@ func s:GetFilenameChecks() abort
\ 'xinetd': ['/etc/xinetd.conf', '/etc/xinetd.d/file', 'any/etc/xinetd.conf', 'any/etc/xinetd.d/file'],
\ 'xkb': ['/usr/share/X11/xkb/compat/pc', '/usr/share/X11/xkb/geometry/pc', '/usr/share/X11/xkb/keycodes/evdev', '/usr/share/X11/xkb/symbols/pc', '/usr/share/X11/xkb/types/pc'],
\ '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', 'fonts.conf'],
+ \ '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', 'fonts.conf', 'file.xcu', 'file.xlb', 'file.xlc', 'file.xba', 'file.xpr', 'file.xpfm', 'file.spfm', 'file.bxml'],
\ 'xmodmap': ['anyXmodmap', 'Xmodmap', 'some-Xmodmap', 'some-xmodmap', 'some-xmodmap-file', 'xmodmap', 'xmodmap-file'],
\ 'xpm': ['file.xpm'],
\ 'xpm2': ['file.xpm2'],
@@ -766,15 +836,21 @@ func s:GetFilenameChecks() abort
\ 'zimbu': ['file.zu'],
\ 'zimbutempl': ['file.zut'],
\ 'zserio': ['file.zs'],
- \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', 'file.zsh-theme', 'file.zunit', '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zsh_history', '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file', 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
- \ 'help': [$VIMRUNTIME . '/doc/help.txt'],
+ \ 'zsh': ['.zprofile', '/etc/zprofile', '.zfbfmarks', 'file.zsh', 'file.zsh-theme', 'file.zunit',
+ \ '.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zsh_history',
+ \ '.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file',
+ \ 'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
+ \
+ \ 'help': [$VIMRUNTIME .. '/doc/help.txt'],
\ }
endfunc
-let s:filename_case_checks = {
+func s:GetFilenameCaseChecks() abort
+ return {
\ 'modula2': ['file.DEF'],
\ 'bzl': ['file.BUILD', 'BUILD', 'BUCK'],
\ }
+endfunc
func CheckItems(checks)
set noswapfile
@@ -809,26 +885,29 @@ func Test_filetype_detection()
filetype on
call CheckItems(s:GetFilenameChecks())
if has('fname_case')
- call CheckItems(s:filename_case_checks)
+ call CheckItems(s:GetFilenameCaseChecks())
endif
filetype off
endfunc
" Content lines that should not result in filetype detection
-let s:false_positive_checks = {
+func s:GetFalsePositiveChecks() abort
+ return {
\ '': [['test execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0']],
\ }
+endfunc
" Filetypes detected from the file contents by scripts.vim
-let s:script_checks = {
+func s:GetScriptChecks() abort
+ return {
\ 'virata': [['% Virata'],
- \ ['', '% Virata'],
- \ ['', '', '% Virata'],
- \ ['', '', '', '% Virata'],
- \ ['', '', '', '', '% Virata']],
+ \ ['', '% Virata'],
+ \ ['', '', '% Virata'],
+ \ ['', '', '', '% Virata'],
+ \ ['', '', '', '', '% Virata']],
\ 'strace': [['execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0'],
- \ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
- \ ['__libc_start_main and something']],
+ \ ['15:17:47 execve("/usr/bin/pstree", ["pstree"], ... "_=/usr/bin/strace"]) = 0'],
+ \ ['__libc_start_main and something']],
\ 'clojure': [['#!/path/clojure']],
\ 'scala': [['#!/path/scala']],
\ 'sh': [['#!/path/sh'],
@@ -892,9 +971,11 @@ let s:script_checks = {
\ 'janet': [['#!/path/janet']],
\ 'dart': [['#!/path/dart']],
\ }
+endfunc
" Various forms of "env" optional arguments.
-let s:script_env_checks = {
+func s:GetScriptEnvChecks() abort
+ return {
\ 'perl': [['#!/usr/bin/env VAR=val perl']],
\ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']],
\ 'awk': [['#!/usr/bin/env VAR=val -i awk']],
@@ -904,6 +985,7 @@ let s:script_env_checks = {
\ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']],
\ 'nix': [['#!/usr/bin/env nix-shell']],
\ }
+endfunc
func Run_script_detection(test_dict)
filetype on
@@ -919,9 +1001,9 @@ func Run_script_detection(test_dict)
endfunc
func Test_script_detection()
- call Run_script_detection(s:false_positive_checks)
- call Run_script_detection(s:script_checks)
- call Run_script_detection(s:script_env_checks)
+ call Run_script_detection(s:GetFalsePositiveChecks())
+ call Run_script_detection(s:GetScriptChecks())
+ call Run_script_detection(s:GetScriptEnvChecks())
endfunc
func Test_setfiletype_completion()