2014-09-02 106 views

回答

3

如果URL未被引用,則可能需要反斜槓,這就是zsh添加它們的原因(通過url-quote-magic)。如果你不喜歡他們,然後引用網址:

$ wget ' 

然後粘貼URL,然後鍵入結束報價:

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

要完全禁用url-quote-magic功能:

zstyle ':urlglobber' url-other-schema 

編輯:截至5.1版本,zsh在一些終端支持括號粘貼,在這種情況下,0不再涉及(bracketed-paste-magic將其替換爲粘貼)。

+0

如何在OH-MY-的zsh disabed這個功能呢?這對我來說有點不方便。 zsh是否有這樣的理由? – 2014-09-03 01:25:21

+0

@李明鴻我已經更新了我的答案。而zsh(實際上是oh-my-zsh)這樣做是因爲這是大多數用戶期望的,特別是由於可以在許多URL中找到的&字符,因此需要引用它。 – vinc17 2014-09-03 07:49:07

+0

此zstyle命令看起來只對登錄的用戶有效。如果其他用戶嘗試再次登錄。這是無用的。不是系統全局設置。如果我嘗試在zshrc中添加它,也沒用。 – 2014-09-04 02:18:53

9

這是zsh 5.1.1〜5.2(current)中的一個bug。

該插件bracketed-paste-magic沒有在zsh版本中工作。

問題就在這裏:

我建議你禁用bracketed-paste-magic

評論從這些代碼哦,我-的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 

via

+0

這個插件使用了'bracketed-paste-magic'這個插件嗎?爲什麼官方的ohmyzsh沒有禁用它。 – 2016-11-25 09:35:58

+0

Ubuntu 14.04沒有在2015年8月發佈的zsh 5.1(其中引入了括號粘貼),因此在提問後。 – vinc17 2017-03-04 02:16:00

+0

@ErtuğrulAltınboğa它是等待修復。 https://github.com/robbyrussell/oh-my-zsh/issues/5499 – alswl 2017-03-07 09:11:32