Open thomasheartman opened 3 years ago
Update: I found that setting evil-respect-visual-line-mode
to nil
fixes the issue with cc
. If it's set to nil it both keeps the new line and places the cursor at indentation, which is exactly what I was looking for. However, the behavior of da"
and ca"
in text-mode is still the same and still perplexing to me. So even if it's not a big deal, I'd love to hear whether this is intended or not and if it can be disabled. Cheers!
Issue type
Environment
Emacs version: GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H15)) Operating System: macOS Catalina (though I'm pretty sure this is the same on NixOS) Evil version: Evil version 1.14.0 Evil installation type: MELPA Graphical/Terminal: Graphical Tested in a
make emacs
session (see CONTRIBUTING.md): NoReproduction steps
cc
Expected behavior
When changing an entire line or changing around an quotes at the end of a line, this should not delete the newline. Changing entire lines could place cursor at indentation.
Actual behavior
Changing an entire line or around quotes (single or double) at the end of a line also deletes the following newline.
Question
Hi! Evil deletes more than I expect it to on certain motions. I suspect that this is just a setting that I have or have not set somewhere, but I haven't been able to find it in the docs. I also have not found a way to search for it online, so this might be easily explained somewhere else.
There's a few scenarios where this comes up (outlined below), but the short form is: how do I make
cc
delete the content on the current line and place the cursor at indentation; and (less-importantly) how do I makeda"
not delete newlines in text-mode?I suspect it's related to Evil's types (
exclusive
,inclusive
, etc) somehow, but I don't know much about that. It might also be worth mentioning that this behavior is different from Vim.cc
The first and most noticeable one is
cc
to change the current line. It deletes the entire line including the newline. In other words, this (with the cursor on the second indented line):becomes this (with the cursor at the start of the second line):
Ideally I'd want this to move to the first non-whitespace character and change everything from there on out (essentially act as
^ C
), especially in cases where there is a 'correct' indentation. At least I'd expect the current line to remain and the buffer to look like this (with the cursor either at the start of line 2 or at the 'correct' indentation):ca"
/da"
EDIT: Turns out this is only in text-mode and thus might not be an issue at all. Programming modes work just fine. However, it's still unexpected to me.
The second one is when a line is encased in quotes. In this case too, the newline is included in the changing/deleting action, and I end up with the third line at the end of the second. This, with the cursor inside the quoted line:
becomes
I have not gone through the reproduction steps yet, as I think this is related to a setting I'm not aware of. If this turns out to be an actual problem, I'll happily see if I can reproduce it.
Thanks!
Edit
Noticed that the issue with quotes only seems to happen in text-mode, and as such isn't much of a problem (though I'm still curious as to why it happens), so deemphasized that a bit.