On 02/12/2011 11:01 AM, Scott Steele wrote:
Looked through help files and couldn't find how this is done (or if it can be done) in vim.Example: If I want to append " # Great line!" to five consecutive lines, I know that I can do it with: q a A " # Great line!<ESC>" j q 4 @ a (i.e. I create a macro that edits a line and moves to the next line, and then I tell the macro to run 4 more times.) But if I really don't want to create a macro and have to call it, is there something like lambda for macros? I'm thinking that I'm looking for a specific key. Referring to that key as<THE-KEY>, this is how I'd like to be able to edit those 5 lines: 5<THE-KEY> A " # Great line<ESC>" j<THE-KEY> It would save 3 keystrokes, which isn't a lot; but for a short edit- movement combo like that, it'd be pretty convenient. It'd also be nice to not have to remember which registers are still free to assign a macro to and to not have to add the macro register to my working memory (brain memory not computer memory) since having to remember something short-term like that significantly reduces mental efficiency. I don't know why the special key couldn't just be q when it is preceded by [count]. (Preceding q by [count] doesn't currently have any effect in vim, does it?) Thanks! Scott
The way I deal with this is that I always record quick macros with 'qq', and I have a Q mapping that runs q macro. I find that it's so rare that I'd need to keep one quick macro and use another one, it's not worth it to set up a 2nd quick macro mapping. Another consideration is that it's easy for something to go wrong with a macro so it's usually best to try it once and then run it a few times and then more times, so a use pattern like qq....q , Q , 5Q , [many-if-needed]Q works best. -Rainyday -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
