Remember last command?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Remember last command?

Bill Tugger
I often have to make small edits in several files.  I need to display each file as I make the changes so automated tools don't work.

What I do is edit a file, save it, open the next file, edit, save, etc.

Search string I last used is remembered.  EG if I search for DEBUG_IT_NOW in the first file the next file I can hit "n" and I'm taken to the first instance in that file.  This works great.

I'd like to also have the repeat command (.) behave the same way.  Is there a way to do this?  

TIA

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Remember last command?

Lifepillar
On 18/07/2018 21:23, Bill Tugger wrote:
> I often have to make small edits in several files.  I need to display each file as I make the changes so automated tools don't work.
>
> What I do is edit a file, save it, open the next file, edit, save, etc.
>
> Search string I last used is remembered.  EG if I search for DEBUG_IT_NOW in the first file the next file I can hit "n" and I'm taken to the first instance in that file.  This works great.
>
> I'd like to also have the repeat command (.) behave the same way.  Is there a way to do this?

I have tried and . repeats the last change even across buffers, as
expected. Have you tried with vim --clean to rule plugin conflicts?

Life.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Remember last command?

Tim Chase
In reply to this post by Bill Tugger
On 2018-07-18 12:23, Bill Tugger wrote:
> I often have to make small edits in several files.  I need to
> display each file as I make the changes so automated tools don't
> work.

You're asking for automating something you say can't be automated.

If the actions *are* repeatable, you can record a macro and then play
it back on each file.

Or, if the edits are predictable, you can even do them all in one
fell swoop with something like

  :set hidden
  :argdo g/DEBUG_IT_NOW/s/^/#
  [review the changes and optionally write them all out with]
  :wall

to comment out each "DEBUG_IT_NOW" line with "#".

If you just want to open each file to a particular location, you can
do something like

  :autocmd BufRead ./* 0/DEBUG_IT_NOW

This will jump to the first line containing "DEBUG_IT_NOW" whenever
you open a new file matching your filespec (adjust from "./*" to
whatever you're interested in).

To be more helpful, it would be useful to know why you think that
automated tools can't do the job, as well as what the more precise
steps are that are involved (decisions you have to make, the types of
edits you're doing, etc)

-tkc

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Remember last command?

John Little-4
In reply to this post by Bill Tugger
On Thursday, July 19, 2018 at 7:35:22 AM UTC+12, Bill Tugger wrote:

I'm not sure the other responders are really addressing your question.

> I'd like to also have the repeat command (.) be remembered.

Actually, IIUC, no. See :help 'viminfo' for what can be saved.  Note that "registers" are saved, and registers are where recorded macros go,  so, one work-flow that might suit you is to record macros for the changes you make.

But, I suggest a solution would be to *not exit vim* after each file.  Naybe use the arg list, so :w then :n to the next file, and . will work nicely.  If there are several changes, :rewind the list for each change.  If the list of files can't be determined at the beginning of a session, after writing a file, :e the next, or use drag and drop in a GUI.  

I suppose you're really asking for vim to always record to, say, the "unnamed" macro, so that the viminfo mechanism could save and restore it.  I googled for "vim automatic macro record" and "vim always record macro" with no pertinent results; I thought maybe someone had done a plugin to simulate it.

Regards, John Little

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.