How to disable zsh URL substitution / autocomplete and backslash

I use zshwith oh-my-zshin Ubuntu: 14.04.

Shell autocompletes backslash escape character when pasting a URL.

For example, with environment variables:

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

How to disable this feature?

+7
source share
3 answers

update 2019-05-12:

new version (> 486fa10) oh-my-zsh has a configuration for this, add DISABLE_MAGIC_FUNCTIONS=truebefore 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 version).

bracketed-paste-magic zsh-.

:

bracketed-paste-magic.

oh-my-zsh ~/.oh-my-zsh/lib/misc.zsh :

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

+20

URL- , , zsh ( url-quote-magic). , URL-:

$ wget '

URL- :

$ wget 'http://{DEFAULT_IP}/index.html'

url-quote-magic:

zstyle ':urlglobber' url-other-schema

EDIT: 5.1, zsh , url-quote-magic (bracketed-paste-magic ).

+8

show my version of zsh

echo $ZSH_VERSION
5.3

open misc.zsh

vim ~/.oh-my-zsh/lib/misc.zsh

You will see the following:

autoload -Uz is-at-least

# *-magic is known buggy in some versions; disable if so
if [[ $DISABLE_MAGIC_FUNCTIONS != true ]]; 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

## jobs
setopt long_list_jobs

env_default 'PAGER' 'less'
env_default 'LESS' '-R'

## super user alias
alias _='sudo'

## more intelligent acking for ubuntu users
if which ack-grep &> /dev/null; then
  alias afind='ack-grep -il'
else
  alias afind='ack -il'
fi

# only define LC_CTYPE if undefined
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
    export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
fi

# recognize comments
setopt interactivecomments

add the following line at the top of the file

DISABLE_MAGIC_FUNCTIONS=true
0
source

All Articles