0

So I have made about 10/12 substitutions in my current file using %s/longpatternN//g. Unfortunately I have to apply these same substitutions in 10 or more of my files. I can access my last commands via up arrow. So I am trying to copy my last command pattern, build a sed command and put them in a shell script to automate this boring stuff. But it looks like my Git Bash not letting me select and copy these substitution command texts via my mouse in vim. So where can I access all history of my all recent vim commands? Can we access any files may be vim storing these commands into?

Hotschke
  • 4,740
  • 26
  • 37

1 Answers1

1

You have a couple of options here. I thing Vim inside Git Bash can access the windows clipboard, so you can try the following: q: to enter to history 'edit' mode, then k many times as needed or search for your pattern with ?, and then 0v$ "+y Here + is the register for the clipboard. After the previos commands you can paste on the bash prompt without problem

And the other option is (on command prompt): cat $HOME/.viminfo | grep ':s'

Since $HOME/.viminfo contains information about your vim sessions, including commands.

But I also recommend to take a look on :h :bufdo and :h :argdo

rbernabe
  • 801
  • 4
  • 6