vim 对 :next

问题描述 投票:0回答:1

当使用 vim 的

:next
命令编辑文件列表时,如果任何文件具有
.log
扩展名,它们将被放置在参数列表的末尾。 我以前从未注意到这一点,使用 vi/vim 已有 35 年了。 我尝试了一些其他扩展,但似乎只有
.log
受到影响。

:n a.log b c.txt d e
:args
[b]   c.txt d     e     a.log

如果我在命令行上指定文件,则不会发生这种情况;仅当我使用

:n
:args xxx
时。

有趣的是,这让某处的神经元发痒。 我想我记得有过这样的情况:我正在查看大量文件并希望日志文件最后出现。但我在我的环境或 .vimrc 中找不到任何可以做到这一点的东西。

为什么 vim 对文件重新排序? 我怎样才能让它停止这样做?

vim
1个回答
0
投票

显然,

vim
根据
:next
设置对
:args
suffixes
传递的文件进行重新排序。

:help suffixes
For file name completion you can use the 'suffixes' option to set a priority
between files with almost the same name.  If there are multiple matches,
those files with an extension that is in the 'suffixes' option are ignored.
The default is ".bak,~,.o,.h,.info,.swp,.obj", which means that files ending
in ".bak", "~", ".o", ".h", ".info", ".swp" and ".obj" are sometimes ignored.

这并不能解释重新排序,特别是在基本名称不匹配且未使用模式的情况下,但更改

suffixes
的值以省略
.log
解决了我的问题。

默认情况并非如此;要查看可能已设置的位置,请在

$VIMRUNTIME
中搜索,从
vim
:

:!grep -R suffixes $VIMRUNTIME
© www.soinside.com 2019 - 2024. All rights reserved.