Thanks for the code! Works great! In this particular file I had recorded several separate macros that moved various comments around to indicated my progress on the files listed within the file itself. So with those present, I was having to remember which registers were still free.
Plus, there are those 3 extra keystrokes---now saved for later. Thanks again! Scott On Feb 12, 11:53 am, ZyX <[email protected]> wrote: > Reply to message «"q" macro-like action executed immediately and without > specifying a register», > sent 19:01:33 12 February 2011, Saturday > by Scott Steele: > > > 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. > > There is not, but you can of course write it by yourself: > > let s:lastcount=0 > function s:NewMacro() > if !s:lastcount > let s:lastcount=v:count1 > return 'qv' > else > try > return 'q'.(((s:lastcount-1)>0)?((s:lastcount-1).'@v'):('')) > finally > let s:lastcount=0 > endtry > endif > endfunction > nnoremap <expr> Q <SID>NewMacro() > > > 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. > > Why do you have problems with remembering which registers are in use? You > don't > have to: unless you write a recursive macro this does not matter. I just use > register @a every time I want to write a macro. If I want to write a recursive > one, I can do «qaq» in normal mode to make it empty. > > Original message: > > > > > 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 > > > > signature.asc > < 1KViewDownload- Hide quoted text - > > - Show quoted text - -- 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
