使用 bash shell 时出现不必要的粘贴问题

使用 bash shell 时出现不必要的粘贴问题

所以我将 bash shell 与 st 终端模拟器一起使用(不同的终端模拟器也会出现问题),如果我在 shell 中粘贴一串文本,我会遇到这样的问题 在此输入图像描述

但如果我使用任何其他 shell(如 zsh),它就不会出现此问题,它粘贴得很好。它实际上不会影响实际的命令,但在编辑命令时有点烦人。我也尝试过其他终端模拟器,问题仍然存在,这是粘贴命令时的 gif

在此输入图像描述

可能有帮助的规格:

OS: Arch Linux 
Shell: bash 5.1.8 
WM: dwm 
Terminal: st 
Terminal Font: Inconsolata

我的~/.bashrc文件:

# PS1
_GREEN=$(tput setaf 2)
_RESET=$(tput sgr0)
export PS1="${_GREEN}\W \$ ${_RESET}"

# Exports
export PATH=$PATH:/home/anant/.local/bin
export PATH=$PATH:/usr/bin/npm
export HISTCONTROL=ignoreboth:erasedups
export MANPAGER="nvim -c 'set ft=man' -"
export EDITOR="nvim"
export BROWSER="firefox"

# Aliases
alias ls='exa -la'
alias la='exa -a'
alias ll='exa -l'
alias update="yay -Syyu --devel --noconfirm"
alias install="yay -S --noconfirm"
alias remove="yay -Rs --noconfirm"
alias config="/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME"
alias configurl="config remote set-url origin"
alias giturl="git remote set-url origin"
alias v="nvim"
alias music="cd ~/Music;youtube-dl -x --audio-format mp3 --prefer-ffmpeg" 
alias sx="sx sh ~/.xinitrc"
alias cat="bat"
alias less="bat"
alias fm6000="fm6000 -c blue -de dwm -n"
alias mpv="devour mpv"
alias zathura="devour zathura"
alias sxiv="devour sxiv"
alias lowriter="devour lowriter"

# Personal Aliases
alias code="cd ~/git-dir/personal/codingPlayground/"
alias pythonProject="cd ~/git-dir/personal/codingPlayground/pythonProject/"
alias webProjects="cd ~/git-dir/personal/codingPlayground/webDevProject"
alias learncss="cd ~/git-dir/personal/codingPlayground/learnCSS/"

# fzf
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash

答案1

我想到了。问题的发生是因为我PS1提示。我只是搞乱了我的 PS1 提示符,删除了自定义 PS1 提示符行,然后我就完成了。那时没有问题,现在这是我的 bashrc

# Exports
export PATH=$PATH:/home/anant/.local/bin
export PATH=$PATH:/usr/bin/npm
export HISTCONTROL=ignoreboth:erasedups
export MANPAGER="nvim -c 'set ft=man' -"
export EDITOR="nvim"
export BROWSER="firefox"

# Aliases
alias ls='exa -la'
alias la='exa -a'
alias ll='exa -l'
alias update="yay -Syyu --devel --noconfirm"
alias install="yay -S --noconfirm"
alias remove="yay -Rs --noconfirm"
alias config="/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME"
alias configurl="config remote set-url origin"
alias giturl="git remote set-url origin"
alias v="nvim"
alias music="cd ~/Music;youtube-dl -x --audio-format mp3 --prefer-ffmpeg" 
alias sx="sx sh ~/.xinitrc"
alias cat="bat"
alias less="bat"
alias fm6000="fm6000 -c blue -de dwm -n"
alias mpv="devour mpv"
alias zathura="devour zathura"
alias sxiv="devour sxiv"
alias lowriter="devour lowriter"

# Personal Aliases
alias code="cd ~/git-dir/personal/codingPlayground/"
alias pythonProject="cd ~/git-dir/personal/codingPlayground/pythonProject/"
alias webProjects="cd ~/git-dir/personal/codingPlayground/webDevProject"
alias learncss="cd ~/git-dir/personal/codingPlayground/learnCSS/"

# fzf
source /usr/share/fzf/completion.bash
source /usr/share/fzf/key-bindings.bash

相关内容