【发布时间】:2020-05-13 23:44:27
【问题描述】:
Vi 已通过键入 "[a-z] 命名缓冲区,然后键入 yank/delete/etc 命令。 tmux 的 vi 复制模式是否有命名缓冲区?我想将各种字符串复制到不同的 tmux 缓冲区中并能够单独粘贴它们
【问题讨论】:
Vi 已通过键入 "[a-z] 命名缓冲区,然后键入 yank/delete/etc 命令。 tmux 的 vi 复制模式是否有命名缓冲区?我想将各种字符串复制到不同的 tmux 缓冲区中并能够单独粘贴它们
【问题讨论】:
是的,确实如此。
man tmux/^BUFFERS或the web copy:
tmux 维护一组命名的粘贴缓冲区。每个缓冲区可以是 显式或自动命名。显式命名的缓冲区被命名 当使用 set-buffer 或 load-buffer 命令创建时,或者通过 rename- 使用 set-buffer -n 自动命名缓冲区。自动地 命名缓冲区被赋予一个名称,例如“buffer0001”、“buffer0002”和 很快。当达到缓冲区限制选项时,最旧的自动 名为缓冲区的名称被删除。显式命名的缓冲区不是子 ject 到缓冲区限制,可以使用 delete-buffer 命令删除。
可以使用复制模式或 set-buffer 和 load-buffer 添加缓冲区 命令,并使用 paste-buffer 命令粘贴到窗口中。如果 使用了缓冲区命令但未指定缓冲区,最近一次 假定添加了自动命名的缓冲区。
...
缓冲命令如下:
...
load-buffer [-b buffer-name] path (alias: loadb) Load the contents of the specified paste buffer from path. paste-buffer [-dpr] [-b buffer-name] [-s separator] [-t target-pane] (alias: pasteb) Insert the contents of a paste buffer into the specified pane. If not specified, paste into the current one. With -d, also delete the paste buffer. When output, any linefeed (LF) char‐ acters in the paste buffer are replaced with a separator, by default carriage return (CR). A custom separator may be speci‐ fied using the -s flag. The -r flag means to do no replacement (equivalent to a separator of LF). If -p is specified, paste bracket control codes are inserted around the buffer if the application has requested bracketed paste mode.
我截断了一些信息(包括其他缓冲区命令);一定要看看上面的网站(或手册页),了解如何使用这些工具。
【讨论】:
choose-buffer 只显示缓冲区的一个子集。假设您使用您喜欢的文本和常用名称前缀(如 mybuffer0、mybuffer1 等)创建了一堆预设缓冲区,您可以将键绑定到例如 choose-buffer -f '#{m:mybuffer*,#{buffer_name}}' 以仅从这些缓冲区中进行选择。或者直接绑定键粘贴pasteb -bmybuffer0.