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

Re: Adding a prefix to certain filename completions



On Jul 7, 12:58pm, Nikolai Weibull wrote:
} 
} I don't want to push it back at you, but perhaps your mail client is
} being fooled by the mime-type of the second attachment (which was
} us-ascii).

Not much point in discussing this further ... my mail client normally
won't display a body part at all if it doesn't recognize the character
set.  And other messages from you have been just fine ... so I'm not
sure what's going on there.  I've already deleted it, so I can't check
it now.

} Done.  I modified the function a bit to handle files named +<n> a bit
} better:

I'm not sure this is better.  Previously you should have seen the
explanation of 'line number' on the first tab, and then been able to
complete the file name on the second tab.  With your change, you'll
never see the 'line number' message, it'll always complete the file.

But if that's the behavior you wanted, this would be a better way:

    _vim_files () {
      case $PREFIX in
        (+*) _files -P './' $* && return 0 ;;
        (*) _files $* ;;
      esac
      case $PREFIX in
        (+) _message -e 'start at given line (default: end of file)' ;;
        (+<->) _message -e 'line number' ;;
      esac
    }

Oh, one other thing ... having _vim_files embedded in the file named _vim
in that way, causes _vim_files to be redefined as a function every time
the _vim function is *called*.  I should have noticed that before.  See
something like _cvs for an example of defining multiple functions in the
same file.



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