Skip to content

Instantly share code, notes, and snippets.

@wpcarro
Last active February 19, 2018 23:52
Show Gist options
  • Save wpcarro/7d478e9a7f8ebe8832f2612a36ea3739 to your computer and use it in GitHub Desktop.
Save wpcarro/7d478e9a7f8ebe8832f2612a36ea3739 to your computer and use it in GitHub Desktop.
Similar to vim-tmux-navigator but for Emacs & Tmux.
(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)))))
@wpcarro
Copy link
Author

wpcarro commented Feb 19, 2018

See vim-tmux-navigator for an example of the precedent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment