Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tmux running rename keeps old window name - how to I clear it?

Tags:

terminal

tmux

So I use the following to rename my tmux windows:

tmux rename-window (prefix + ,) rename the current window

But when I do that command it keeps the old window name and I have to clear it to put in the new window name. Is there a way to have it cleared when I do prefix + , so I can just start typing the new window name?

like image 645
blunrib Avatar asked Mar 28 '16 19:03

blunrib


2 Answers

You can remove the default value by adding something like this to your .tmux.conf:

unbind ,
bind-key , command-prompt -p (rename-window) "rename-window '%%'"

This will:

  • clear the current bind for the , key
  • re-bind the , key to the command-prompt function
  • specifies a prompt message via -p (rename-window)
  • ends with a command specifier, which uses the input value (%%) as a parameter to the rename-window function

To emulate the existing behaviour, it would look like:

bind-key , command-prompt -I #W -p (rename-window) "rename-window '%%'"

...which tells command-prompt to use the current window name (#W, an alias for #{window_name}) as the initial, default value of the command prompt.

like image 126
atomicstack Avatar answered Oct 13 '22 11:10

atomicstack


Easiest way, after rename prefix + , just press down button and start typing.

Tmux keep history of names, so you will able to get previously used names for window. For this just press up button again and again to find required name.

like image 27
Batiaev Avatar answered Oct 13 '22 13:10

Batiaev