如何在运行 vim 实例的不同 tmux 窗格之间复制和粘贴 [英] How to copy and paste between different tmux panes running vim instances

查看:55
本文介绍了如何在运行 vim 实例的不同 tmux 窗格之间复制和粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例:在一个 tmux 窗格中复制(通过 vim),然后切换到另一个窗格(运行另一个 vim 实例)并使用 vim paste 命令粘贴.我知道这可以通过 tmux(使用前缀+])来完成,但如果我可以使用 vim 绑定复制和粘贴它会非常方便,因为我只是在运行 vim 的不同窗格之间切换.

有什么想法吗?

解决方案

抱歉,我想说服您使用 vim 内置功能.<​​/p><小时>

为了使复制/粘贴变得容易,您可以在另一个标签页中打开文件:

:tabe/path/to/another/file

使用 gtgT 切换标签页.

<小时>

或者拆分窗口编辑另一个文件:

:sp/path/to/another/file

使用 Ctrl-ww 切换 Windows.
要垂直拆分窗口,请使用 :vsp file

<小时>

更新:

这是我的 .tmux.conf 文件:

# vimsetw -g 模式键 vi绑定 [ 复制模式bind -t vi-copy v 开始选择bind -t vi-copy y 复制选择bind -t vi-copy V 矩形切换绑定 ] 粘贴缓冲区# 缓冲绑定空间选择缓冲区

我只在需要复制终端输出时使用它们.

Example: copy in one tmux pane (via vim), then switch to another pane (running another vim instance) and paste using the vim paste command. I know this can be done via tmux (using prefix+]) but it would be really handy if I can copy and paste using vim bindings since i'm just switching between different panes running vim.

Any ideas?

解决方案

Sorry, I'm trying to convince you to use vim built-in features.


To make the copy/paste easy, you can open files in another Tabpages:

:tabe /path/to/another/file

Use gt or gT to switch Tabpages.


Or split the window to edit another file:

:sp /path/to/another/file

Use Ctrl-ww to switch Windows.
To split the window vertically, please use :vsp file


Update:

This is my .tmux.conf file:

# vim
setw -g mode-keys vi
bind [ copy-mode
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy V rectangle-toggle
bind ] paste-buffer

# buffer
bind Space choose-buffer

I only use them when I need to copy terminal output.

这篇关于如何在运行 vim 实例的不同 tmux 窗格之间复制和粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆