I use tmux
within macOS Sierra Terminal.app
. 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. Is there a way to change this fn key to a closer key like ctrl, alt, option
? I could not seem to find how after googling for a while.
Thanks!
To toggle mouse reporting, press ⌘-R in Terminal.app.
I would like to share my Terminal.app + tmux + vim workflow as it relates to copy-paste, to suggest an alternative.
Vim to system
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.You can always
:r !pbpaste
or:w !pbcopy
too (described below).Shell to system
macOS provides
pbcopy(1)
andpbpaste(1)
. By default they use the system clipboard.pbcopy
is a sink that reads from stdin, whilepbpaste
is source that writes to stdout.I use these regularly for command-line clipboard interactivity.
Tmux copy & paste
Enter copy-mode with the tmux
copy-mode
command (Prefix-[ by default).Navigate with a series of keybindings.
Depending on
EDITOR
orVISUAL
containingvi
, tmux usescopy-mode
with emacs-style bindings orcopy-mode-vi
with vi-like bindings—you can change the default in your.tmux.conf
with thestatus-keys
andmode-keys
options. Seeman tmux
for more details.The default vi-like bindings are a bit lacking, in my opinion, so I opted to put the following in my
.tmux.conf
:Once I've made a selection, I can put it anywhere in tmux with Prefix-]. There are buffers to choose from as well.
Tmux & vim
I can paste in vim via
:set paste
,o
, and my tmux paste key. I use unimpaired, so paste toggling becomes]op
. With Tim Pope's tbone from github, I can also use:Tput
and:Tyank
in vim.Tmux and system
Update: I've recently learned that the following will do the trick!
This is the hardest piece: I usually do the following at a shell:
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.A simpler and less error-prone alternative is often