Created
November 3, 2012 11:36
-
-
Save ThomasAdam/4007114 to your computer and use it in GitHub Desktop.
set-hook example for .tmux.conf
This file contains hidden or 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
| set-hook -g -n 'before-new-session' 'run "notify-send new-session..."' | |
| set-hook -g -n 'after-new-window' 'run "notify-send new-window..."' | |
| new -sfoo | |
| set-hook -tfoo -n 'after-split-window' 'display-message "I split this window!"' | |
| set-hook -tfoo -n 'before-new-window' 'splitw ; run "notify-send YES"' | |
| neww -d | |
| neww -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@kaushalmodi
The manual's list of hooks, as of 2.6, are only the specialty hooks. I had to re-read it a few times. The command hooks themselves aren't listed one-by-one.
So if there is a command, there is (most of the time) an
after-hook for it.Here is
after-new-windowin the source code: https://github.com/tmux/tmux/blob/2.6/cmd-new-window.c#L150Search the code for hook triggers: https://github.com/tmux/tmux/search?utf8=%E2%9C%93&q=hooks_insert%28&type=
Another place where hooks are added: https://github.com/tmux/tmux/blob/2.6/cmd-queue.c#L248 in
cmdq_fire_command()I also wrote an article about tmux hooks at https://devel.tech/tips/n/tMuXz2lj/the-power-of-tmux-hooks/ where i give some usage examples.