Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
VikingofRock
Aug 24, 2008




Hughmoris posted:

I'm running Windows 7. Is there a way to have Vim launch " :! " commands in powershell, instead of the command prompt? For instance, if I executed
code:
:! perl testScript.pl
I'd like that to launch in a powershell window because it makes copy/pasting/scrolling a lot easier.

According to this site the relevant commands are
code:
set shell=powershell
set shellcmdflag=-command
I don't have access to my windows box at the moment to test that out, but hopefully it works for you!

Adbot
ADBOT LOVES YOU

VikingofRock
Aug 24, 2008




Hughmoris posted:

Is there a simple way to copy all regex matches in a file, and paste it into a new buffer? If not, maybe highlight all matches and delete anything that is not a match?

For the first:
:g/regex/y A will yank all matching lines into register a. Then you switch to your new buffer and hit :p"a to paste them. If you mess this up, hit qaq to clear register a before trying again.

For the second:
:v/regex/d will delete all non-matching lines.

VikingofRock
Aug 24, 2008




Found an answer on stack exchange. Apparently what we want is this:

code:
:%s/regex/\=setreg('A', submatch(0), 'V')/gn
That yanks all the matches (and only the matches), separated by newlines, into buffer 'a'. You can then paste this as above.

VikingofRock
Aug 24, 2008




Hughmoris posted:

Thanks for the ideas. Yeah, I was hoping to grab just the captures and delete everything else. So, the starting text would be:
code:
adsfkjla"ORDER=PIZZA"djiasdf
nznjvzzajdf"ORDER=COKE"jaidjfa
nzxncvjzx"ORDER=CAKE"jadsmfa
and the ideal result would be the current buffer, or new buffer, containing
code:
PIZZA
COKE
CAKE

Gotcha. This worked for me:

code:
:%s/"ORDER=\([^"]\+\)/\=setreg('A', submatch(1), 'V')/gn #to copy matches into buffer a
"ap                                                      #to put from buffer a

  • Locked thread