At various times it is useful to launch vim with a file list that has been
generated by a command so that buffers and macros written on the fly are
able to be used on a number of files. A trivial, though questionably useful,
example that normally works might be:

  $ vim $(find . -iname "readme.txt")

The above command fails when spaces occur in path and file names, and the
following variation has been found to work in the BASH shell.

  $ eval $(echo vi $(find . -iname "readme.txt" | sed -e "s/^/\"/" -e
"s/$/\"/"))

This seems clunky, especially since it seems that the eval $(echo $())
indirection should not be necessary Perhaps there is a better way that does
not rely on those shell commands?

Tip 1212 <http://www.vim.org/tips/tip.php?tip_id=1212> seemed like it might
apply (using isfname), but initial attempts to use vim --cmd did not seem to
work.  Variations like the following all seemed to fail, and may indicate
that isfname is not used to process command line arguments that are file
names, but it also could mean I just don't know what I am doing ;-)

  $ vi --cmd ":set isfname+=32" $(find . -name Entries | sed -e "s/ /\\\ /")

  $ vi --cmd "set isfname+=32" $(find . -name readme.txt | sed -e "s/^/\"/"
-e "s/$/\"/")

Kevin R. Bulgrien


CONFIDENTIAL/PROPRIETARY 

Unless otherwise indicated, all information (including attachments)
contained in this e-mail communication is confidential and proprietary
information exclusively owned by the sender and/or its related or affiliated
companies and shall not, without the prior written consent of the sender, be
used, disclosed, distributed or reproduced, in whole or in part, by anyone
other than the individual or entity to whom this communication is addressed
exclusively for the purpose expressly indicated in this communication.

This e-mail communication is intended for the use of the individual or
entity to whom it is addressed.  If you are not the intended recipient of
this communication, you are hereby notified that any use, dissemination,
distribution or copying of this communication is strictly prohibited.  If
you have received this communication in error, please destroy any copies,
electronic, paper or otherwise that you may have.

Reply via email to