cannot bind evil-next-visual-line for selection mode

Frank Fischer frank-fischer at shadow-soft.de
Sat Jan 17 21:13:29 CET 2015


Am 16.01.2015 um 16:20 schrieb Alan Schmitt:
> On 2015-01-14 22:35, Frank Fischer <frank-fischer at shadow-soft.de> writes:
> 
>> The selection has nothing to do with the motion. The cursor will move to
>> the next visual line, but visual line mode *always* works on real lines,
>> not visual lines. That's why the selection always extends to real lines.
>> Dealing with selection of visual lines is not easy and there are many
>> things to consider, and nobody has ever implemented this stuff, sorry.
> 
> I'm sorry but I'm confused: I can get the behavior that I want using
> 'gj' in visual mode. Why cannot I rebind this to another key?

You have been talking about two things: moving the point along visual
lines and the selection in visual line mode. The first thing can be done
correctly, the second is not supported. Of course you can rebind any
command to other keys and

  (define-key evil-motion-state-map "s" 'evil-next-visual-line)

does indeed work. However, there might be other commands in higher
priority keymaps, that's why you need at least

  (define-key evil-normal-state-map "s" nil)

This is sufficient in the default configuration and also works in visual
state because "s" is not bound (by default) in visual state. However,
some packages install bindings in visual state (e.g. evil-surround). You
can easily find out the currently installed bindings using C-h k <key>
or C-h b. (You can test a plain Emacs/Evil configuration by executing
`make emacs` in Evil's source directory).

Frank





More information about the implementations-list mailing list