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

Re: Absolute path tab completion on Windows



On Sat, Nov 9, 2024 at 7:40 AM Ram Rachum <ram@xxxxxxxxxx> wrote:
>
> Here's the output for /c/Windows/Sys which fails: https://gist.github.com/cool-RR/ad525df593f60ab11024fcb33fbed127

Aha.  Let's try it this way.  I threw in an "always" block to make
sure the "cd" gets undone even on interrupt or something.

_normal () {
  case $PREFIX in
    (/?/*/*) _normal@original "$@";;
    (/?/*)
      local opwd=$PWD ret=1
      compset -P /?/    # Must succeed if /?/* matched
      {
        cd $IPREFIX
        if [[ -o autocd && $compstate[context] = command ]]
        then
          _cd "$@"
        else
          _normal@original "$@"
        fi
        ret=$?
      } always {
        cd $opwd
      }
      return ret
      ;;
    (*) _normal@original "$@";;
  esac
}

If that still doesn't work, something else fishy is going on.




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