Re: Numbered registers and kill rings

In the hope that it is Christmas:

I miss the emacs kill ring. To enable it in a smooth fashion, I would need the following functionality:

1. Every yank and delete that does not go into the black hole, is put in the "1 register. Whatever was in the "1 register goes to the "2 register, and so on. The 9" register falls off the edge and dies.

2. The dot command, if it finds a "number register, increments the number by one.

A few nifty remaps then clinches the deal:

nnoremap p "1p
nnoremap P   p    ; to retain ability to use registers
nnoremap b   u.   ; cycle through kill ring
nnoremap x "_x    ; So that x's do not disturb the kill ring

I can now delete and yank for a while, then paste with p. If I do not like what's there, I cycle back in history with b. This obviates the need for plugins like yankring.

This may be heresy, because 1) is not exactly the way vim works. Vim only saves deletes to the numbered registers, and only multi-line ones. I never found this behaviour to be very useful. I have modified the source of vim to do this, something that was fairly trivial to do. 2) is as per vim specs.

What does everyone else think?


Re: Numbered registers and kill rings

It's not Christmas yet, but I'm trying to catch up on pending / minor issues for the upcoming 2.2 release.

The fact is that this is a pretty likely candidate for the scenarios I will be trying to address with ViEmu 3's scripting ability. I want to allow quite high-level configuring of ViEmu's behavior. The idea is to provide hooks in all important places, such that command parsing, commands, and VS integration can be configured. The point is that it's impossible for me to address all requests, while it should be simple for anyone to alter ViEmu's operation to each one's taste.

I'm pretty set on finally using my own scripting language, mostly a Javascript subset, rather than using VS's scripting or integrating Python, which I both considered at some point. Having my own implementation will allow me to use it in all of the ViEmus, and also to address language-porting issues in a better way than integrating a 3rd party language will allow me to.

A tentative schedule for 3.0 is late this year, so this won't be a quick way to address this.

Also, to tell the truth, I am not too keen on implementing core commands in a different way than vi or vim do. I've been burnt with that in the past, I did something in a different way that looked better, just to have someone call me on that and declare it basically a heresy. Some ViEmu users have used vi/vom for over 20 years, and it's tough on them to try to change anything. I guess it's fair enough.

Let me know what you think.




Re: Numbered registers and kill rings

That sounds like a good solution. Your approach sounds good too: Hooks are what makes emacs so extensible. If I could pick one guideline: Try if you can to make it so that different plugins compose. Vim plugins have a tendency to conflict with one another because of the way the scripting environment works.



Re: Numbered registers and kill rings

Thanks Tom. Indeed, proper composing is the "holy grail" for component-based development. Even Aspect-Oriented Programming finds this as a big issue. Hopefully, I will be able to do something at least workable.


  - Jon