[CentOS] Feed a list of filenames to vim

Jussi Hirvi listmember at greenspot.fi
Tue May 17 16:19:45 UTC 2011


There are some googlable ways to feed a list of filenames to vim, but I 
stumble on weird results.

With my filelist, I try to do

	cat list | xargs vim

...to edit the files listed in the file "list". Here's what happens:

[root at lasso2 tempdir]# ls -l
total 8
-rw-r--r--  1 root root  0 May 17 18:28 a
-rw-r--r--  1 root root  0 May 17 18:28 b
-rw-r--r--  1 root root  3 May 17 18:31 c
-rw-r--r--  1 root root 12 May 17 18:43 list
[root at lasso2 tempdir]# cat list
./a
./b
./c
[root at lasso2 tempdir]# cat list | xargs vim
3 files to edit
Vim: Warning: Input is not from a terminal

Ok, so far, so good. And after this, the file a opens, as expected. 
However, the contents show as all uppercase. And everything I write is 
uppercase too. I can move to the next file (:n) even though the command 
shows as uppercase (:N). I cannot quit vim, however. When I do ":q", I 
get blank screen, and I have to close the terminal window.

If I do instead
	cat list | xargs less
...it works as expected.

And with
	cat list | xargs vi
...(in a fresh terminal window), the editing goes just perfect, but when 
I quit vi, the terminal will not show the commands I write, and the 
display gets garbled (no newlines etc.).

What is happening?

- Jussi



More information about the CentOS mailing list