问题描述
选中内容后自动复制并出现提示 zellij text copied to system clipboard,有时会出 bug,即使用 ctrl+shift+v 无法粘贴选中的内容。
或者想要把一部分终端的内容拿到其他地方粘贴,比如浏览器的地址栏。发现这个复制只在 zellij 的会话内生效,就是这个内容无法粘贴到除终端外的其他地方。
解决方法
- 更改配置文件 (网上都这么说,可是怎么改呢?)
- 使用标志位,关闭鼠标模式
如下
zellij options disable-mouse-mode
- 按住 shift 再使用鼠标拖动,这样可以用终端的高亮选中。对选中的内容右键,然后选择 copy selection 即可完成复制(就像普通的 linux 终端那样)
如果在 attach zellij 会话时弃用鼠标模式呢?
如果想要 attach 一个会话同时弃用鼠标模式,就这样
zellij attach ... options disable-mouse-mode
(为什么是先 attach 后 options ,而反过来不行呢? 似乎是 SUBCOMMANDS 的选项 a 在 o 前面?)
参考
https://github.com/zellij-org/zellij/issues/671
(老哥说 zellij 的复制和粘贴是真的乱,乐了😀)
但是话又说回来
弃用鼠标模式只能是间接的解决 zellij 的复制粘贴问题。如果使用鼠标单击 pane 窗格是无法切换光标所在的 pane 窗格的。如果终端输出内容滚了好几屏,鼠标选中的内容无法向上选中上一屏的内容。
还好,搜来搜去找到了解决方法。就是 使用 Alacritty 或 Xterm
。
Zellij User Guide 原话如下
Some terminals don’t support the the OSC 52 signal, which is the method Zellij uses by default to copy text to the clipboard. To get around this, you can either switch to a supported terminal (eg. Alacritty or xterm) or configure Zellij to use an external utility when copy pasting (eg. xclip, wl-copy or pbcopy).
来自
https://zellij.dev/documentation/faq.html?highlight=copy#copy–paste-isnt-working-how-can-i-fix-this
啊对对对,用 Alacritty 就完事了。如果使用 Alacrity ,在 kali linux 使用 zellij 时 backspace 和 ctrl + h 的 bug 也能解决