evil icon indicating copy to clipboard operation
evil copied to clipboard

'evil-respect-visual-line-mode' should also change other normal mode commands

Open zzantares opened this issue 5 years ago • 3 comments

Issue type

  • Enhancement request

Environment

Emacs version: GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.0, NS appkit-1671.40 Version 10.14.4 (Build 18E226)) of 2019-04-18 Operating System: macOS Mojave 10.14.5 Evil version: Evil version evil-git-4ac94f9 Evil installation type: straight.el Graphical/Terminal: Graphical

Reproduction steps

  • Start Emacs
  • Enable visual-line-mode.
  • Set evil-respect-visual-line-mode to non-nil value.
  • Write a very long line so that visually appears to be 2 or more lines.
  • Suppose you want to change the current line, either by doing cc, dd or insert at the beginning with I.
  • All visual lines are affected by the command.

Expected behavior

  • Only the visual line in which the command is executed should be affected.
    • dd should delete the current visual line, not all lines.
    • cc should change the current visual line, not all lines.
    • I should insert at the beginning of the current visual line, not at the beginning of paragraph (which is in fact a single "physical" line).
    • A should insert at the end of the current visual line, not at the end of paragraph ("physical" long line appears to be a paragraph).
    • V should select the current visual line, not all visual paragraph.

Actual behavior

  • All the commands affect the whole paragraph as if it were a single line, which in fact it is a single line but by setting evil-respect-visual-line-mode I would expect for evil to treat them as visual lines.
  • evil-respect-visual-line-mode only affects motion commands, it should affect I, A, cc, dd, V also.

zzantares avatar Jul 05 '19 17:07 zzantares

Looks like #1171 partially fixes this issue.

nnicandro avatar Jul 29 '19 22:07 nnicandro

Apologies for chiming in on an old issue, but I thought this was something worth noting. In native Vim, I and A cannot operate on the visual line. The sort of behaviour that evil-respect-visual-line-mode is trying to achieve is often done with swapping gj and j etc, e.g. via vim-pencil. This means that native vimmers who prefer wrapped lines with visual line movement will not be expecting I and A to append to the visual line. If the goal is to emulate vim as accurately as possible, this may be an important consideration. (Personally, I support all of this issue except changing the behaviour of I and A)

BlueDrink9 avatar Aug 26 '21 22:08 BlueDrink9

For anyone with the same problem, there is a workaroud for this using general.el

(general-evil-setup t)
(general-nmap "c" (general-key-dispatch 'evil-change
                    "c" 'my-evil-change-whole-line))
(general-vmap "c" 'evil-change))

Stefanomarton avatar Jun 14 '23 23:06 Stefanomarton