Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
436 views
in Technique[技术] by (71.8m points)

zshrc - How to disable zsh substitution/autocomplete with URL and backslashes

I am using zsh with oh-my-zsh on Ubuntu:14.04.

The shell autocompletes escape character with backslash when I paste a URL.

For example with environment variables:

$ wget http://{DEFAULT_IP}/index.html
It will become:
$ wget http://{DEFAULT_IP}/index.html

How can I disable this function?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

update 2019-05-12:

new version(> 486fa10) oh-my-zsh have a configuration for this, add DISABLE_MAGIC_FUNCTIONS=true before source $ZSH/oh-my-zsh.sh:

DISABLE_MAGIC_FUNCTIONS=true
source $ZSH/oh-my-zsh.sh

via: https://github.com/robbyrussell/oh-my-zsh/commit/486fa1010df847bfd8823b4492623afc7c935709


Original answer:

This is a bug in zsh 5.1.1 ~ 5.2(current).

The plugin bracketed-paste-magic did not works in the zsh versions.

The issue is here:

I suggest you disable bracketed-paste-magic.

Comment these code from oh-my-zsh's ~/.oh-my-zsh/lib/misc.zsh solve the problem:

if [[ $ZSH_VERSION != 5.1.1 ]]; then
  for d in $fpath; do
    if [[ -e "$d/url-quote-magic" ]]; then
      if is-at-least 5.1; then
        autoload -Uz bracketed-paste-magic
        zle -N bracketed-paste bracketed-paste-magic
      fi
      autoload -Uz url-quote-magic
      zle -N self-insert url-quote-magic
      break
    fi
  done
fi

via


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...