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

How to add a 'non-escaped' tilde to the completion list



Hi *,
I have the following completion function:

  function _term_list(){
    local -a w

    for SESSION in $(pidof  zsh); do
      PA=$(readlink -n /proc/${SESSION}/cwd)
      case ${PA} in
        ${HOME}*) w+=$(echo ${PA} | sed s"|${HOME}|~|") ;;
        *) w+=${PA} ;;
      esac
    done

    compadd -a w
  }

  zle -C term_list complete-word _generic
  bindkey "^v" term_list
  zstyle ':completion:term_list:*' completer _term_list

It provides a list of paths in which other zsh sessions are in. I want
to substitute my home folder with a tilde (~). But unfortunately the
line '${HOME}*) w+=$(echo ${PA} | sed s"|${HOME}|~|") ;;' does not work
as intended. The tilde is always "escaped". So the output looks like:
  \~
  \~/folder

How can I remove the backslash.

Thank you in advance.

Cheers,
Jester





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