Setting SHIFT+arrow keys to select text in emacs prelude
Asked Answered
S

1

6

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?

Shingly answered 13/7, 2014 at 7:49 Comment(0)
B
4

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.

Basilicata answered 13/7, 2014 at 14:14 Comment(4)
Mmmmm... I'll take a look to the tutorial then ;). Thanks a lot both for the answer and the adviceShingly
@Jordon: How do I reset the windomove to other keys instead of disabling it ? I know the general method, but is there any thing different as far as prelude setup is concerned ?Octaviaoctavian
@Kayuntey: this is described on this site: emacswiki.org/emacs/WindMove, see "Terminals"Discontinue
"You are doing a great disservice to yourself by using arrow keys to select text" The real use case here is <a convenient modifier key> + <any navigation keys> doing any navigation move + updating the selection. <Shift> + <arrows> is just the least important subset of the (optimal) special case of Shift being the mod. key. Then, the other key concept is consistency, to reduce cognitive burden. Dismissing this very effective usage model (engraved as a ubiquitous, basic reflex into the entire non-emacs world -- half the target audience of Prelude! :) ) sounds pretty darn dogmatic.Hallucinate

© 2022 - 2024 — McMap. All rights reserved.