Combining multiple text files in Vim

I have a fairly simple question that I cannot find the answer to and cannot get it to work for me.

I need to add multiple text files (all within the same directory) to Vim. The reason I need to do this in Vim is because I am running windows and have no access to * nix utilities.

All files have a pattern in its name ( ex1.sql

, ex2.sql

, ex3.sql

).

All I have to do is graph text from them (in the order they are in the directory) and add them to a new empty file.

I made a list of arguments

:args ex*.sql

      

And I want to execute a command for all args in register a

.

:argdo gg"AyG

      

It says the lines were copied from each of the files.

When I go to insert register into a new file, however nothing prints.

:"ap

      

So, I check the case:

:reg

      

the register is a

filled with gibberish ( ^]Jyecw?

).

Is there a better way to get around this? Why does he say he is copying to case but actually putting a bunch of weird characters?

+3


source to share


1 answer


argdo

executes the command ex-mode

in each argument list file. What you want to do with gg"AyG

is done by the command normal

. Try:



:argdo normal gg"AyG

      

+5


source







All Articles