Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

macos - OSX Terminal.app中的tmux的替代/重新映射fn键(Alternative/Remap `fn` key in OSX Terminal.app for `tmux`)

I use tmux within macOS Sierra Terminal.app .

(我在macOS Sierra Terminal.app使用tmux 。)

When I want to disable Allow mouse reporting temporarily to copy/paste and clicking I need to press the fn key which is far away in my long apple keyboard.

(当我要禁用“允许临时报告鼠标复制/粘贴并单击”时,我需要按一下我的长苹果键盘上不远的fn键。)

Is there a way to change this fn key to a closer key like ctrl, alt, option ?

(有没有办法将此fn键更改为更接近的键,例如ctrl, alt, option ?)

I could not seem to find how after googling for a while.

(谷歌搜索了一段时间后,我似乎找不到方法。)

Thanks!

(谢谢!)

  ask by Gabriel Borges Oliveira translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

(根据EDITORVISUALvi ,TMUX使用copy-mode与emacs风格绑定或copy-mode-vi与VI类绑定,您可以更改默认在您的.tmux.confstatus-keysmode-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 pasteo和我的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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...