On Aug 03, 2011 at 11:25 PM -0600, LuKreme wrote:
What’s the last thing I did? Type this word? This line? This paragraph? This entire reply? where is the break between the current thing I did and the last thing I did? In an editor without a specific insert state and a specific command state it is impossible to delineate what the ‘last’ thing was and the programmers would have to make some capricious decisions as to where to stop one ‘thing’ and start the next ‘thing’.

I actually find it phenomenally useful in Vim. It's pretty straight forward to use. 'Last command' is as you think it would be. The last command you did. Remember, since Vim is a modal editor, when you enter insert mode and type text, that is considered one command, whether you entered two characters or two paragraphs.^[1]

To expand upon this example, it can be really useful when used in conjunction with the 'c' command, which lets you change text, i.e. delete text and enter insert mode in one fell swoop. Imagine you have similar lines of text with some bit in parenthesis that you want to change, like the following:

    function(some words)
    function(some other words)
    function2(some words)
    function2(a third set of words)

Let's say you want to replace the text in parenthesis on lines 1, 3, and 4 with 'new argument'. You could write some regex, which wouldn't be that hard, but would take a little bit of thought. Then you'd have to make sure to not run it on line 2. Or, in vim, you could enter the first set of parens and type 'ci(', which means change in parentheses, type in 'new argument', and finally leave insert mode. To make the same change on lines 3 and 4, all you have to do is move the cursor down to those lines, put it somewhere in the parentheses, and type '.'.

It's sort of a mini macro. It can be very useful to do some simple repeated actions that normally call for more thought in other editors. Sorry for the longish explanation on non-BBEdit things.

[1]: This can be a pain in the butt when you want to undo the last sentence of a whole paragraph, since undoing it will undo the whole paragraph. As a result, it is often easier to leave insert mode and just remove the sentence. But that's a discussion for a different day (and list).

--
You received this message because you are subscribed to the "BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to