Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Adding a prefix to certain filename completions



Hi Nikolai:

This expands on my previous reply:


#!/bin/zsh -f
#  newvim

inputfilearray=( "$@" )

LIMIT=$#
for ((i = 1; i <= $LIMIT; i++ )) do
        eval file="\$$i"
        if [[ -f $inputfilearray[i] &&
                   $inputfilearray[i] == "$(basename $inputfilearray[i])" ]]
        then
             inputfilearray[i]="./$inputfilearray[i]"
        else
             :
        fi
done

command vim "$inputfilearray"




There is probably an easier way, but it works.

Bill





On Tue, 5 Jul 2005, Nikolai Weibull wrote

> William Scott wrote:
>
> > If I am understanding the question correctly, I think you need
> > something like
> >
> > compadd -P "./"
> >
> > but I don't know if that will cure the problem with the + signs.
>
> Adding the ./ prefix certainly helps, as Vim won't see the + signs as
> special any more.  However, the solution I was looking for would
> automatically add the ./ prefix when completing a filename beginning
> with a + (perhaps only if vim is the command in command position).  So
> I need even more basic information than the compadd command-line.  I was
> hoping it could be done using zstyles.
>
> > Born in Chicago, IL USA; currently residing in Santa Crud, CA
>
> :-),
>         nikolai
>
> --
> Nikolai Weibull: now available free of charge at http://bitwi.se/!
> Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
> main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
>



Messages sorted by: Reverse Date, Date, Thread, Author