Apologies if this has been discussed before, I'm away from my mail archive and I couldn't search.
One of the more useful features of vim (for me at least) is the ability to pass a number as a parameter to a command, most of which used that as the number of times to repeat the command (though there are more specialized commands, like n%, which positions the cursor n% of the way down from the top of the file). This is especally useful for operations like "delete the next 10 tokens" (10dw), or jump down 25 lines (25j -or- 25<down-arrow>), and I really made use of it when prototyping OCaml code with its toplevel loop, where errors in long functions are pointed out by the number of characters from the start of the input string, not its line and column numbers... So if I am told there's a problem with the code between characters 2674 and 2679, I just have to position the cursor at the top of the text I entered and enter 2674<right-arrow> and it will take me to the start of the offending code.
Now, as far as I can tell, TextMate doesn't have anything like this built in (a "repeat the next event n times" command), or am I just missing it somewhere? If it's not in there, could you consider this as a feature request for such a thing?
One more thing, might it be possible to alter the behavior of Go to Line... to also accept a negative number, -n, and go to line n from the bottom?
Would anyone else find these things useful, or am I the only odd one in the bunch?
William D. Neumann
---
"There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Think of XML as Lisp for COBOL programmers.
-- Tony-A (some guy on /.)
On 20. jan 2005, at 20:57, William D. Neumann wrote:
Now, as far as I can tell, TextMate doesn't have anything like this built in (a "repeat the next event n times" command), or am I just missing it somewhere? If it's not in there, could you consider this as a feature request for such a thing?
One more thing, might it be possible to alter the behavior of Go to Line... to also accept a negative number, -n, and go to line n from the bottom? Would anyone else find these things useful, or am I the only odd one in the bunch?
I have at least a few times used the similar feature in other editors, 'repeat next command', so I guess you're not alone :-p.
On Jan 20, 2005, at 20:57, William D. Neumann wrote:
One of the more useful features of vim (for me at least) is the ability to pass a number as a parameter to a command [...]
I do like the concept of the vim optional count argument, but I'm not sure it's very handy in a mode-less editor like TextMate and/or where you perform sort of gestures to invoke actions rather than have a single letter for each command (some with modifiers/arguments etc).
How do you envision this added to TextMate? Do you want e.g. a dialog to be triggered on a key where one could enter the count argument, and do you then want only the next action (e.g. option-forward delete) to be the single action that gets repeated? For how many “commands” do you actually think this is useful? And how many repeats would you think it takes before the time saved makes up for the time lost interacting with the extra dialog (and how many repeats do you on average do)?
Now, as far as I can tell, TextMate doesn't have anything like this built in (a "repeat the next event n times" command), or am I just missing it somewhere? If it's not in there, could you consider this as a feature request for such a thing?
Are you mainly interested in a way to move the caret “programmatically” (i.e. giving number of units to move etc.)? or do you see yourself repeating other commands?
One more thing, might it be possible to alter the behavior of Go to Line... to also accept a negative number, -n, and go to line n from the bottom?
Added to the to-do.
Hi,
Just out of the top of my head, I think it would be most natural to implement this as another way to run macros, i.e. open a dialog and specify how many times you want to run a certain macro. In that case the user can quickly use this on any number of commands that he wants to see repeated. It might be a bit overkill to do this for cursor movement, but if you really need that feature, you can record the macro and do it that way I think.
Jeroen.
On 21. jan 2005, at 16:39, Jeroen van der Ham wrote:
Just out of the top of my head, I think it would be most natural to implement this as another way to run macros, i.e. open a dialog and specify how many times you want to run a certain macro. In that case the user can quickly use this on any number of commands that he wants to see repeated. It might be a bit overkill to do this for cursor movement, but if you really need that feature, you can record the macro and do it that way I think.
Yeah, I only used it for repeating macros myself, in UltraEdit, but then I used it often for that. It just opened a dialog asking for repeat count.
On Jan 21, 2005, at 7:31 AM, Allan Odgaard wrote:
I do like the concept of the vim optional count argument, but I'm not sure it's very handy in a mode-less editor like TextMate and/or where you perform sort of gestures to invoke actions rather than have a single letter for each command (some with modifiers/arguments etc).
How do you envision this added to TextMate? Do you want e.g. a dialog to be triggered on a key where one could enter the count argument, and do you then want only the next action (e.g. option-forward delete) to be the single action that gets repeated?
That's pretty much how I envisioned it. Hit the appropriate hot-key which brings up a dialog where you type a number and hit enter, tab, the space-bar, or whatever, then you trigger an action by hitting a key or selecting a menu option. Only that action would be repeated, if you want more complex actions, you need to roll your own macro and repeat that. For some reason I picture it as being somewhat like quicksilver in operation...
For how many “commands” do you actually think this is useful? And how many repeats would you think it takes before the time saved makes up for the time lost interacting with the extra dialog (and how many repeats do you on average do)?
Well, it's obviously useful for navigation and basic editing commands (insert, delete, select, etc). I can see it being used for macro replay (and writing as well, so long as there is a hook into the repeat command available). It is definitely a simple way to workaround the single step undo that many people dislike... want to undo the last 100 characters? Cmd-Alt-1 (or whatever the hotkey would be), 100, <space>, Cmd-Z. Bam! Instant block undo. Undid a bit too much? Cmd-Alt-1, 10, <space>, Cmd-Shift-Z.
As for the break-even point, I'm guessing (depending on the contortions needed for the hotkey, system delays, etc.) it would be somewhere around 5-15. But that might be optimistic...
Are you mainly interested in a way to move the caret “programmatically” (i.e. giving number of units to move etc.)? or do you see yourself repeating other commands?
Well [thinking back to my vimming days...], my primary use is for cursor relocation, followed fairly closely by basic editing (though, as you mentioned, this might be used a bit less in a modeless editor), and then repeating macros would have been next most common.
William D. Neumann
"You've got Rita Marlowe in the palm of your hand." "Palm of my hand? You haven't seen Rita Marlowe..."
-- Will Success Spoil Rock Hunter?
On Jan 21, 2005, at 21:27, William D.Neumann wrote:
[...] my primary use is for cursor relocation, followed fairly closely by basic editing (though, as you mentioned, this might be used a bit less in a modeless editor), and then repeating macros would have been next most common.
With regard to repeating macros, I'd like to add that a macro should be able to run on the selection, I think this will for the majority of cases take care of having to manually state the number of times the macro needs to be repeated.
But I'm keeping the vim count argument on my to-do as an 'this needs to be tried, if for no other reason than proof-of-concept'-item. With my current architecture it probably won't be that timely to implement, but it will have to wait a little though.