I am trying to use windmove with the default bindings and am unable to get the shift key bindings working correctly.

When I hit Shift-<up>, instead of selecting another window, the point moves and a region is selected.

Also, C-h k RET Shift-<up> simply shows <up>.

Using GNU Emacs 24.3.

Here is the entry from my .emacs.

(global-set-key "\e[1;2A" 'windmove-up)
(global-set-key "\e[1;2B" 'windmove-down)
(global-set-key "\e[1;2C" 'windmove-right)
(global-set-key "\e[1;2D" 'windmove-left)

I am using these entries, instead of windmove-default-keybindings since the default wasn't working when I opened a non-windowed emacs through tmux.

  • Simply shows what?
    – Malabarba
    Nov 13, 2014 at 0:36
  • @Malabarba Forgot to apply code markup. Fixed.
    – Pradhan
    Nov 13, 2014 at 0:47
  • Ok, this indicates you don't have windmove keybinds. Shift setting the mark is completely unrelated here (and it's the expected behavior). You'll need to provide a minimal example of how you're activating windmove.
    – Malabarba
    Nov 13, 2014 at 0:51
  • @Malabarba Added more info. I guess I fell into the XY problem trap by not specifying everything :) The above code snippet was what I found elsewhere as a suggested solution for the tmux-based emacs issue. You are right. With windmove-default-keybindings, it does indeed work in the windowed version. It still doesn't work in tmux. However it is beginning to look like more of an inputrc issue since C-h k isn't getting it either.
    – Pradhan
    Nov 13, 2014 at 1:04
  • After making your bindings, what does C-h w windmove-down tell you? Whatever key it says is the key that is bound to that command. Then do C-h k followed by hitting whatever keyboard key you think your keyboard uses to create the sequence ESC [ 1 ; 2 B (i.e., "\e[1;2B"). That tells you what that keyboard key (whatever it is) is really bound to, if anything.
    – Drew
    Nov 13, 2014 at 2:52

1 Answer 1


With (tty-type) being of the xterm family, \e[1;2A wasn't being mapped to S-<up>. The bindings introduced by windmove-default-keybindings work in my non-windowed emacs setup after redefining this input as follows:

(define-key input-decode-map "\e[1;2A" [S-up])

This link has a description of this issue and solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.