使用 xterm 在 vi​​m 中完成文件名无法按预期工作

发布于 2024-09-07 13:47:33 字数 679 浏览 16 评论 0原文

我的 vim 发生了一些有趣的事情。我通过 xterm 使用它。我希望能够自动完成我尝试打开的文件名。

例如:

# Cursor is | character
:o exam|
:o exam|<TAB>
:o examplefile.txt|

我确信 vim 支持此功能,但它对我不起作用。当我点击 时,会插入 ^I 字符而不是完成文件名:

:o exam|<TAB>
:o exam^I|
:o exam^I|<TAB>
:o exam^I^I|

但是,< /code> 在 xtermbash 中工作正常 - 它正确地完成文件名并且不会扩展为 ^I

我的终端配置不正确吗?我需要一些stty巫术吗?或者完全是另外一回事?

编辑

:e 确实对我有用 - 似乎只有 :o 不起作用...

Something funny is going on with my vim. I'm using it through xterm. I want to be able to autocomplete filenames that I try to open.

For example:

# Cursor is | character
:o exam|
:o exam|<TAB>
:o examplefile.txt|

I was sure vim supported this, but it's not working for me. When I hit <TAB> an ^I character is inserted instead of completing the filename:

:o exam|<TAB>
:o exam^I|
:o exam^I|<TAB>
:o exam^I^I|

However, <TAB> works fine in bash in xterm - it correctly completes filenames and doesn't expand to ^I.

Is my terminal configured incorrectly? Do I need some stty voodoo? Or is it something else entirely?

Edit

:e does work for me - seems like only :o doesn't...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情独悲 2024-09-14 13:47:33

vim 中并不真正支持 :o。尝试输入 :h :o,你会看到:

Vim 不支持打开模式,因为
这并不是很有用。对于那些
“:open”开始的情况
打开模式 Vim 将离开 Ex 模式,
它允许执行相同的
命令,但更新整个屏幕
而不是只有一行。

我认为你混淆了 :o 和 :e (它们不一样)。

:o is not really supported in vim. Try typing :h :o, you'll see this:

Vim does not support open mode, since
it's not really useful. For those
situations where ":open" would start
open mode Vim will leave Ex mode,
which allows executing the same
commands, but updates the whole screen
instead of only one line.

I think you're confusing :o and :e (they're not the same).

挽你眉间 2024-09-14 13:47:33

edit 对我有用:

:e exam|<TAB>

edit works for me:

:e exam|<TAB>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文