codemirror-vim icon indicating copy to clipboard operation
codemirror-vim copied to clipboard

update change linewise behavior to more closely match vim

Open nicholasbulka opened this issue 3 years ago • 2 comments

When operating linewise with "change" commands, cc, S, cip etc, whitespace at the beginning of the line is preserved in vim. This implements that.

nicholasbulka avatar Jan 08 '22 02:01 nicholasbulka

The main version of this file is still the one in cm5 so we should try to make all changes there.

But there is one bigger problem here: this changes the behavior of c to ignore auto indentation, but does not remove the complex code invoking it. Do you know if this new behavior is the preferred behavior that we should apply in cm5 too, or is this merely a temporary workaround for the cm6 bug?

nightwing avatar Jan 10 '22 22:01 nightwing

This commit definitely more closely resembles actual vim behavior, and is not meant to be a substitute for cm5 auto indentation.

The CodeMirror.commands.newlineAndIndent(cm); call seems necessary to keep anyway in order to reprint the line after the call to cm.replaceRange ... , is that what you meant by the complex indentation code? If there is another function that does what newlineAndIndent does, with the Indent part, that sounds reasonable.

nicholasbulka avatar Jan 13 '22 03:01 nicholasbulka

closing in favor of https://github.com/replit/codemirror-vim/pull/116

nightwing avatar Apr 24 '23 13:04 nightwing