粘贴到终端游侠时出现的奇怪字符:[200〜和[201〜

当我使用 Ctrl + Shift + V 将某些内容粘贴到ranger中时,我得到了奇怪的字符。在这里,我将单词“ paste”粘贴到了护林员中:

粘贴到终端游侠时出现的奇怪字符:[200〜和[201〜

一开始我有[200~,最后有[201~。我不知道可能是什么问题(游侠,鱼壳,终端或某些配置文件?)。 如何在粘贴时消除不需要的字符?

更多信息: 我用鱼壳。仅当我使用键盘快捷键 Ctrl + O 启动Ranger时,问题仍然存在。当我通过手动输入命令rangerranger_cd或仅将文本直接粘贴到鱼壳中(根本没有启动护林员)来启动护林员时,它会很好地工作。 Ctrl + O 快捷方式定义为:

function fish_user_key_bindings
    bind \co ranger_cd
end

我的ranger_cd是功能:

function ranger_cd
    set -l tempfile '/tmp/chosendir'

    ranger --choosedir $tempfile (pwd)
    if [ -f "$tempfile" ]; and [ (cat -- $tempfile) != (echo -n (pwd)) ]
        cd (cat $tempfile)
    end
    rm -f -- $tempfile
end

(其目的是保存在Ranger中选择的最后一个目录,并在退出Ranger之后将其cd保存到其中)

我还注意到 Ctrl + V 在Ranger中不起作用(它仅粘贴^V),但可以直接在鱼壳中正常工作(它粘贴了我先前复制的内容,就像 Ctrl + Shift + V )。

任何想法可能有什么问题吗?先感谢您。我使用:

  • Linux Manjaro 19.0.2 XFCE
  • Xfce4终端0.8.9.1
  • 鱼3.1.0
  • 游侠1.9.2(使用python 3.6.9)
mm6yuz 回答:粘贴到终端游侠时出现的奇怪字符:[200〜和[201〜

那确实是bracketed paste mode

Fish主要使它不立即执行多行粘贴。当您通过命令行执行命令时,它将禁用它;当您再次获得控制权时,它将重新启用它。

通过绑定启动交互事物并不常见,因此fish不会在其中禁用它。

要手动禁用它,请使用__fish_disable_bracketed_paste__fish_enable_bracketed_paste

function ranger_cd
    set -l tempfile '/tmp/chosendir'

    __fish_disable_bracketed_paste
    ranger --choosedir $tempfile (pwd)
    __fish_enable_bracketed_paste
    if [ -f "$tempfile" ]; and [ (cat -- $tempfile) != (echo -n (pwd)) ]
        cd (cat $tempfile)
    end
    rm -f -- $tempfile
end
本文链接:https://www.f2er.com/2627041.html

大家都在问