emacsemacs-prelude

Setting SHIFT+arrow keys to select text in emacs prelude


In emacs prelude I want SHIFT+arrow to select text. By default SHIFT+arrow is assigned to windmove. I've created a windmove.el file in my personal/preload folder with the following contents

(windmove-default-keybindings 's)

But with this both shift and command key are bound to windmove.

How can I bind only command key?


Solution

  • The bindings are set by windmoves windmove-default-keybindings function, you can undo what this function does with the following:

    (global-unset-key (vector (list 'shift 'left)))
    (global-unset-key (vector (list 'shift 'right)))
    (global-unset-key (vector (list 'shift 'up)))
    (global-unset-key (vector (list 'shift 'down)))
    

    Also, you'll need to ensure the variable shift-selection-mode is non-nil.

    (setq shift-selection-mode t)
    

    Prelude disables arrow movement by default, and for good reason. You are doing a great disservice to yourself by using arrow keys to select text. But if you really want to, this will allow you to.

    (setq prelude-guru nil)
    

    This should get shift-selection back up and running, but you'll need to find new keys to use for windmove.