问题描述
限时送ChatGPT账号..我是 tmux 的新手,我正在尝试弄清楚如何编辑配置,以便打开 vim 的窗口不会以 #:vim
的形式显示在任务栏中,而是以任何名称显示在 vim 中打开的文件是(即#:filename.php")
.看起来这应该是一件很常见的事情,但我的搜索 - foo 失败了.
I'm new to tmux and am trying to figure out how to edit the configuration so that windows with vim open show up in the taskbar not as #:vim
but as whatever the name of the file open in vim is
(ie "#:filename.php")
. Seems like it should be a common thing, but my search - foo is failing.
推荐答案
这是部分答案.它可以改进,但我现在没有时间解决它.
Here's a partial answer. It can be improved, but I don't have time to work it out right now.
将以下内容放入您的 .vimrc
:
Put the following in your .vimrc
:
autocmd BufReadPost,FileReadPost,BufNewFile * call system("tmux rename-window " . expand("%"))
还有其他事件(参见 Vim 中的 :help autocmd-events
)可用于处理以及.我还没有想出的一件事是如何更改窗口名称,如果你在两个窗格中的每一个中打开一个 vim
实例,然后从一个窗格切换到另一个.vim
不知道 tmux
中的活动,所以没有触发 vim
事件.
There are other events (see :help autocmd-events
in Vim) that may be used to handle
as well. One thing I haven't figured out is how to change the window name if you
have an instance of vim
open in each of two panes, and you switch from one pane
to the other. vim
is unaware of the activity in tmux
, so no vim
events are triggered.
这篇关于带有在vim中打开的文件名的tmux选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论