martanne / vis

A vi-like editor based on Plan 9's structural regular expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

S behaves like C when repeated with dot command

climech opened this issue · comments

Given file contents:

xxxxAxxxx
xxxxBxxxx

(1) In normal mode, place the cursor at A and do S-<Esc>.

This gives us:

-
xxxxBxxxx

(2) In normal mode, place the cursor at B and use the dot command.

Expected result:

-
-

Observed result:

-
xxxx-

Vis version: v0.7 +curses +lua +tre +acl

The implementation of S is

	{ "S",                  ALIAS("^c$")                                },

Since the dot repeat remembers only the last operator, the ^ motion before it is not repeated.

Just found that the alias was originally to "cc" (which can be properly dot-repeated), but was changed - cddf179,
probably so that it preserves indentation.
(In Vim, both S and cc preserve indentation. In fact, help S says that it is a synonym for "cc".)

On a similar note, I find a lot of this aliasing problematic. Take for example O and o, which I ran into problems with while trying to make smarter indentation when pressing those respective keys. This aliasing makes remapping and adding more functionality much more difficult. In addition, the fact that vis always recursively evaluates keymaps makes many features downright impossible. Are there any plans on making nonrecursive keymaps?, because the combination of recursive keymaps + internal aliasing is an problem where there are no workarounds (at least that I know of).