Last active
July 27, 2023 19:11
-
-
Save dwlamb/85f0af9357a2fd22bab1e48c71b7dca3 to your computer and use it in GitHub Desktop.
Making tmux command-prompt more intuitive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind B command-prompt -pbuffer 'pasteb -b "%%"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this Stack Overflow article unix - tmux: Bind key to open command prompt with predefined command Nicholas Marriott provided the above syntax to add to a tmux.conf.
See the article for the Original Poster's question. Essentially, the use of this shortcut is to paste from a specific known buffer other than the most recent buffer.
Pressing
C-b B
one is presented with a prompt to enter the name of a buffer to paste from in the formbufferX
X = a number in the buffer list.The intent of the shortcut is to easily paste from a known specified buffer number other than the last item in the buffer list [
C-b ]
].Without the shortcut, the conventional tmux method is the interactive list to choose a buffer to paste from. Press
C-b =
and an interactive screen opens displaying all the buffers used in tmux so far. Type a number corresponding to the left most column. That entry is pasted to the command prompt. In total the keystrokes are 4C-b = 0
, for example.On its own, the above shortcut is inefficient for it is necessary to type
bufferX
. That is 7 keystrokes plusEnter
.My solution:
Reloading tmux.conf and pressing
C-b B
one is presented with a prompt to enter the buffer number only, plusEnter
. E.g.,C-b B 0 Enter