tmux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tmux [2021/03/12 18:37] – [Resources] hc9 | tmux [2022/02/24 06:11] – [Reset Lost Sessions] hc9 | ||
---|---|---|---|
Line 83: | Line 83: | ||
'' | '' | ||
+ | |||
+ | ===== Emulating Emacs-like registers ===== | ||
+ | |||
+ | If you have a need for multiple clipboard-like buffers for storing and retrieving text (akin to registers in Emacs or Vim), Tmux already supports that, although this functionality is not well exposed by default. Below is a sample piece of configuration that makes available 26 registers designated by single lower-case letters //a-z//. | ||
+ | |||
+ | < | ||
+ | |||
+ | # Initialize alphanumerical registers to avoid the problem with ' | ||
+ | run "tmux set-buffer -b a \" | ||
+ | run "tmux set-buffer -b b \" | ||
+ | run "tmux set-buffer -b c \" | ||
+ | run "tmux set-buffer -b d \" | ||
+ | run "tmux set-buffer -b e \" | ||
+ | run "tmux set-buffer -b f \" | ||
+ | run "tmux set-buffer -b g \" | ||
+ | run "tmux set-buffer -b h \" | ||
+ | run "tmux set-buffer -b i \" | ||
+ | run "tmux set-buffer -b j \" | ||
+ | run "tmux set-buffer -b k \" | ||
+ | run "tmux set-buffer -b l \" | ||
+ | run "tmux set-buffer -b m \" | ||
+ | run "tmux set-buffer -b n \" | ||
+ | run "tmux set-buffer -b o \" | ||
+ | run "tmux set-buffer -b p \" | ||
+ | run "tmux set-buffer -b q \" | ||
+ | run "tmux set-buffer -b r \" | ||
+ | run "tmux set-buffer -b s \" | ||
+ | run "tmux set-buffer -b t \" | ||
+ | run "tmux set-buffer -b u \" | ||
+ | run "tmux set-buffer -b v \" | ||
+ | run "tmux set-buffer -b w \" | ||
+ | run "tmux set-buffer -b x \" | ||
+ | run "tmux set-buffer -b y \" | ||
+ | run "tmux set-buffer -b z \" | ||
+ | | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | # Copy to user-selected register | ||
+ | bind -T copy-mode r command-prompt -1 -p ' | ||
+ | # Paste from user-selected register | ||
+ | bind -T prefix C-] command-prompt -1 -p ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The way it works is this: when in // | ||
===== Resources ===== | ===== Resources ===== |
tmux.txt · Last modified: 2022/12/05 06:18 by hc9