3

I see in tmux's list-keys:

bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window

I use tmuxinator, and will often go overboard on the Ctrl-D, where I accidentally close a window. Is there a way to add this prompt to any window/pane I close, but only for those created by tmuxinator? I don't want this for temporary or new windows, but just those that were created on my new session.

1
  • I also recommend adding a confirmation to detach, which can be quit startling if you don't intend to that and don't detach frequently! It's -T prefix d Sep 27, 2019 at 19:59

1 Answer 1

8

From the man page with a different binding.

unbind C-d                                                                                                                                                                                                                            
bind -n C-d confirm-before -p "kill-pane #P? (y/n)" kill-pane  

-n tells tmux that you don't need to enter the prefix before.

In case the command you want to trigger has more than one word like respawn-pane -k, then you need to enclose the command in double quotes.

 bind X  confirm -p "Do you want to kill the pane?" "respawn-pane -k";
1
  • Now it overrides VIM's page down shortcut which is also C-d. So can not use it
    – bora89
    Apr 15, 2023 at 17:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .