Files
.emacs.d/modules/windows
Jim Myhrberg 0810857131 feat(windows): Integrate windmove with tmux
When Emacs is launched within Tmux, and a windmove command fails (due to
it reaching the left/right/top/bottom edge of frame, instead trigger a
Tmux pane switch in that direction.

This allows a nearly seamless window/pane switching experience between
Emacs and Tmux.

It does require the following configuration in Tmux to work properly:

    # Enable smart pane switching that's Emacs aware.
    is_emacs='echo "#{pane_current_command}" | grep -iqE "(^|\/)emacs$"'

    # Use Alt-[i/k/j/l] keys without prefix key to switch panes if current pane is
    # not running Emacs. If the pane is running Emacs, let Emacs receive the
    # keybindings instead.
    bind -n M-i if-shell "$is_emacs" "send-keys M-i" "select-pane -U"
    bind -n M-k if-shell "$is_emacs" "send-keys M-k" "select-pane -D"
    bind -n M-j if-shell "$is_emacs" "send-keys M-j" "select-pane -L"
    bind -n M-l if-shell "$is_emacs" "send-keys M-l" "select-pane -R"
    bind -T copy-mode M-i if-shell "$is_emacs" "send-keys M-i" "select-pane -U"
    bind -T copy-mode M-k if-shell "$is_emacs" "send-keys M-k" "select-pane -D"
    bind -T copy-mode M-j if-shell "$is_emacs" "send-keys M-j" "select-pane -L"
    bind -T copy-mode M-l if-shell "$is_emacs" "send-keys M-l" "select-pane -R"
    bind -T copy-mode-vi M-i if-shell "$is_emacs" "send-keys M-i" "select-pane -U"
    bind -T copy-mode-vi M-k if-shell "$is_emacs" "send-keys M-k" "select-pane -D"
    bind -T copy-mode-vi M-j if-shell "$is_emacs" "send-keys M-j" "select-pane -L"
    bind -T copy-mode-vi M-l if-shell "$is_emacs" "send-keys M-l" "select-pane -R"
2020-05-30 17:01:21 +01:00
..