Last active
February 19, 2018 23:52
-
-
Save wpcarro/7d478e9a7f8ebe8832f2612a36ea3739 to your computer and use it in GitHub Desktop.
Similar to vim-tmux-navigator but for Emacs & Tmux.
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
(defun wpcarro/tmux-emacs-windmove (dir) | |
"Move windows in a Tmux-friendly way." | |
(let* ((dir->opts '((left . ("-L" . windmove-left)) | |
(right . ("-R" . windmove-right)) | |
(above . ("-U" . windmove-up)) | |
(below . ("-D" . windmove-down)))) | |
(opts (alist-get dir dir->opts)) | |
(tmux-opt (car opts)) | |
(emacs-fn (cdr opts))) | |
(if (window-in-direction dir) | |
(funcall emacs-fn) | |
(shell-command (format "tmux select-pane %s" tmux-opt))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See vim-tmux-navigator for an example of the precedent.