Home Download Buy Blog Forum Support

nRepeat: repeat anything any amount of times

nRepeat: repeat anything any amount of times

Postby BRascher on Mon Mar 10, 2014 3:05 pm

The nRepeat plugin ports the repeat functionality of the universal-argument from Emacs to SublimeText3.

You can check it out, along with a short introduction, at:

https://github.com/bfrascher/Sublime-nRepeat

EDIT It is now available directly from the Package Control!

About a year ago I tried making this plugin in SublimeText2, but I wasn't satisfied with the result. So now I tried again with some new API calls from SublimeText3 and while I am also not completely satisfied with the current result, it is a start one can build on. The main problem is still catching single character inputs from the user, as I have not found anything related to that in the new API documentation. I solve this issue in the current release by reading the last inserted character in the active view, saving it in the plugin and finally deleting it from the view again. This works quite well (even with multiple selection regions), except when there is selected text. That text will always be overwritten by the user input and I have yet to find a nice way of preventing this, while also reading in the characters.

Anyways, if you decide to try out the plugin, have fun, but be aware that you might have to rely on your 'undo' key a lot more ;)
And if you have any suggestion on improving it, or a question about it, feel free to leave me a comment or send me a message.

Thanks
Benedikt

PS
The title says 'repeat anything', but really at the time you can only repeat single characters and text commands. Window commands are currently not supported. Also I have implemented a maximum number of times anything will be repeated, as to stop SublimeText from becoming unresponsive. At the time the limit is at 1000000 repeats. If you feel this is too restrictive, let me know or fork the plugin for yourself ;)
BRascher
 
Posts: 4
Joined: Mon Feb 18, 2013 7:32 pm

Re: nRepeat: repeat anything any amount of times

Postby BRascher on Sat Mar 15, 2014 10:30 am

I just released version 0.1.2 of the plugin, in which I fixed the problems with selected text.
When a selection is active, characters are now inserted right in front of, or right behind of the selection, depending on where your text cursor is. Commands are simply executed on the region itself. This works with multiple selection regions.
BRascher
 
Posts: 4
Joined: Mon Feb 18, 2013 7:32 pm


Return to Plugin Announcements

Who is online

Users browsing this forum: TurnitinBot [Bot] and 2 guests