带有在vim中打开的文件名的tmux选项卡

编程入门 行业动态 更新时间:2024-10-26 05:16:39
本文介绍了带有在vim中打开的文件名的tmux选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-30 05:15:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1390228.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件名   选项卡   vim   tmux

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!