0

I want to write a hook in tmux to show a message that reports the config has been reloaded. Here is my code:

#binding a button to reload this config file bind r source-file ~/.tmux.conf #set hook to notify user when config file has been reloaded set-hook -g after-source-file 'display-message "Config reloaded"' 

I know that the hook does run because originally I wrote "echo 'Config reloaded'" and an error came up in the status bar about it being an unknown command.

Also I have included an example hook from here:

set-hook -g client-attached 'display-message "hello world"' 

Which displays the message on client attachment no problem, so I am confused why the source-file hook is an exception

1 Answer 1

1

source-file does not have an after hook. I don't know why it worked for you with a different command, which tmux version are you using?

You could just do this instead: bind r source-file ~/.tmux.conf \; display-message "Config reloaded".

2
  • tmux version 2.9a, your solution worked fine though - I am not sure I understand why it works because it looks like you feed the interpreter two separate sequential commands and it somehow knows to store them together and execute both when the first line is called - but understanding the interpreter is waay beyond the scope of my question anyway Commented Jun 6, 2019 at 21:18
  • It is a command sequence, look at the COMMANDS section in the tmux manual. Commented Jun 7, 2019 at 8:42

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.