Created
June 28, 2016 19:53
-
-
Save JohnLunzer/2a61627e5b1997742d76aadca34380a7 to your computer and use it in GitHub Desktop.
This snippet (which should go into your emacs config file) will update your tmux window name with the title of the buffer you're currently in which is usually the filename of the file you're editing.
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
(require 'deferred) | |
(defun rename-tmux-window() | |
(deferred:$ | |
(deferred:process "tmux" "display-message" "-p" "'#I'") | |
(deferred:nextc it | |
(lambda (x) | |
(setq x (replace-regexp-in-string "\'" "" | |
(replace-regexp-in-string "\n\\'" "" x))) | |
(setq w | |
(replace-regexp-in-string "\*" "" | |
(car (mapcar | |
(function buffer-name) | |
(buffer-list))))) | |
(deferred:process "tmux" "rename-window" "-t" x w))))) | |
(add-hook 'change-major-mode-hook 'rename-tmux-window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment