To toggle mouse reporting, press ? - R in Terminal.app.
(要切换鼠标报告,请在Terminal.app中按? - R 。)
I would like to share my Terminal.app + tmux + vim workflow as it relates to copy-paste, to suggest an alternative.
(我想分享我的Terminal.app + tmux + vim工作流程,因为它与复制粘贴有关,提出了一种替代方案。)
Vim to system (Vim到系统)
With vim from homebrew or +clipboard
support, I make use of the "*
register for yanks and puts. This interfaces well with the rest of the system.
(借助来自自制软件或+clipboard
vim,我利用了"*
寄存器来存储扬子和看跌期权。这与系统的其余部分很好地结合在一起。)
You can always :r !pbpaste
or :w !pbcopy
too (described below).
(您也可以始终:r !pbpaste
或:w !pbcopy
(如下所述)。)
Shell to system (壳到系统)
macOS provides pbcopy(1)
and pbpaste(1)
.
(macOS提供了pbcopy(1)
和pbpaste(1)
。)
By default they use the system clipboard. (默认情况下,它们使用系统剪贴板。)
pbcopy
is a sink that reads from stdin, while pbpaste
is source that writes to stdout. (pbcopy
是从stdin读取的接收器,而pbpaste
是写入stdout的源。)
I use these regularly for command-line clipboard interactivity.
(我经常使用这些命令进行命令行剪贴板交互。)
Tmux copy & paste (Tmux复制和粘贴)
Enter copy-mode with the tmux copy-mode
command ( Prefix - [ by default).
(使用tmux copy-mode
命令输入复制模式( 前缀 - [默认情况下为[ ]。)
Navigate with a series of keybindings.
(浏览一系列的键绑定。)
Depending on EDITOR
or VISUAL
containing vi
, tmux uses copy-mode
with emacs-style bindings or copy-mode-vi
with vi-like bindings—you can change the default in your .tmux.conf
with the status-keys
and mode-keys
options.
(根据EDITOR
或VISUAL
含vi
,TMUX使用copy-mode
与emacs风格绑定或copy-mode-vi
与VI类绑定,您可以更改默认在您的.tmux.conf
与status-keys
和mode-keys
选项。)
See man tmux
for more details. (有关更多详细信息,请参见man tmux
。)
The default vi-like bindings are a bit lacking, in my opinion, so I opted to put the following in my .tmux.conf
:
(我认为默认的类似于vi的绑定有点缺乏,所以我选择将以下内容放入.tmux.conf
:)
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
Once I've made a selection, I can put it anywhere in tmux with Prefix - ] .
(选择之后,可以使用Prefix- ]将其放在tmux中的任何位置。)
There are buffers to choose from as well. (也有可供选择的缓冲区。)
Tmux & vim (Tmux和Vim)
I can paste in vim via :set paste
, o
, and my tmux paste key.
(我可以通过:set paste
, o
和我的tmux粘贴键粘贴到vim中。)
I use unimpaired, so paste toggling becomes ]op
. (我使用的是无障碍的,因此粘贴切换变为]op
。)
With Tim Pope's tbone from github, I can also use :Tput
and :Tyank
in vim. (使用来自github的Tim Pope的tbone,我还可以在vim中使用:Tput
和:Tyank
。)
Tmux and system (Tmux和系统)
This is the hardest piece: I usually do the following at a shell:
(这是最难的部分:我通常在shell上执行以下操作:)
# pbcopy <<<'{TMUX PASTE}'
It's not perfect: if I paste anything with single quotes, I usually have to go through and do some editing work.
(这不是完美的:如果我在单引号上粘贴任何内容,则通常必须经过一些编辑工作。)
In bash with readline in vi-mode, this as simple as <Esc>kv
and then I can edit in vim until I'm satisfied. (在vi模式下的带有readline的bash中,这非常简单,如<Esc>kv
,然后我就可以在vim中进行编辑,直到满意为止。)
A simpler and less error-prone alternative is often
(通常更简单,更不易出错)
# pbcopy
{TMUX PASTE}
<C-d> # send End-of-file