cannot bind evil-next-visual-line for selection mode
Hello, I'm trying to configure evil to use `evil-next-visual-line' by default when I hit the 's' key. It works well in normal mode, but I cannot get it to work in visual mode. This is what I have in my configuration: #+begin_src emacs-lisp (define-key evil-motion-state-map "s" 'evil-next-visual-line) (define-key evil-normal-state-map "s" 'evil-next-visual-line) #+end_src To reproduce, take a file with a long line, enter visual-line-mode, go into visual mode and hit 's': the selection extends to the next line instead of the next visual line. I tried adding #+begin_src emacs-lisp (define-key evil-visual-state-map "s" 'evil-next-visual-line) #+end_src but it still does not work. Am I doing something wrong? Thanks, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7
Am 13.01.2015 um 09:57 schrieb Alan Schmitt:
Hello,
I'm trying to configure evil to use `evil-next-visual-line' by default when I hit the 's' key. It works well in normal mode, but I cannot get it to work in visual mode.
This is what I have in my configuration:
#+begin_src emacs-lisp (define-key evil-motion-state-map "s" 'evil-next-visual-line) (define-key evil-normal-state-map "s" 'evil-next-visual-line) #+end_src
To reproduce, take a file with a long line, enter visual-line-mode, go into visual mode and hit 's': the selection extends to the next line instead of the next visual line.
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. Frank
You could try to make do with C-v (visual block mode) g$ and gj/gk, albeit with more keystrokes. On 1/14/15, Frank Fischer <[email protected]> wrote:
Am 13.01.2015 um 09:57 schrieb Alan Schmitt:
Hello,
I'm trying to configure evil to use `evil-next-visual-line' by default when I hit the 's' key. It works well in normal mode, but I cannot get it to work in visual mode.
This is what I have in my configuration:
#+begin_src emacs-lisp (define-key evil-motion-state-map "s" 'evil-next-visual-line) (define-key evil-normal-state-map "s" 'evil-next-visual-line) #+end_src
To reproduce, take a file with a long line, enter visual-line-mode, go into visual mode and hit 's': the selection extends to the next line instead of the next visual line.
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.
Frank
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
Am 15.01.2015 um 01:15 schrieb Gordon Gustafson:
You could try to make do with C-v (visual block mode) g$ and gj/gk, albeit with more keystrokes.
Visual block mode definitely does not work with visual lines, because it only selects one range in each *real* line (in fact, making visual block mode work with visual lines is even harder).
On 1/14/15, Frank Fischer <[email protected]> wrote:
Am 13.01.2015 um 09:57 schrieb Alan Schmitt:
Hello,
I'm trying to configure evil to use `evil-next-visual-line' by default when I hit the 's' key. It works well in normal mode, but I cannot get it to work in visual mode.
This is what I have in my configuration:
#+begin_src emacs-lisp (define-key evil-motion-state-map "s" 'evil-next-visual-line) (define-key evil-normal-state-map "s" 'evil-next-visual-line) #+end_src
To reproduce, take a file with a long line, enter visual-line-mode, go into visual mode and hit 's': the selection extends to the next line instead of the next visual line.
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.
Frank
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
On 2015-01-14 22:35, Frank Fischer <[email protected]> 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? Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7
Am 16.01.2015 um 16:20 schrieb Alan Schmitt:
On 2015-01-14 22:35, Frank Fischer <[email protected]> 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
On 2015-01-17 21:13, Frank Fischer <[email protected]> writes:
Am 16.01.2015 um 16:20 schrieb Alan Schmitt:
On 2015-01-14 22:35, Frank Fischer <[email protected]> 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.
I'm sorry, this was not intentionally. In fact I don't understand what this second thing is.
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).
This was it: I have evil-surround installed and I had to rebind 's' in the evil-surround-mode-map. Everything works as expected now. Thanks a lot, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7
participants (3)
-
Alan Schmitt -
Frank Fischer -
Gordon Gustafson