Tmux 启动时提示中出现一些乱码

问题描述 投票:0回答:1

由于某种原因,每次启动 tmux 时,提示符前后都会出现以下随机字符/命令:

^[[?61;6;7;22;23;24;28;32;42c用户@桌面:~/文件夹$ 61;6;7;22;23;24;28;32;42c

我不知道它是什么或如何摆脱它。 谁能告诉我这是什么,它是如何引起的,以及如何消除它?

问题是,之前运行得很好。我从未接触或编辑过任何一个配置文件。

下面是我的 .bashrc 文件和 .tmux.conf 文件。

这是我的 .bashrc 文件:

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u@\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

# My changes
alias winhome='cd /mnt/c/Users/'
alias cls=clear
alias python=python3
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
alias nmap='"/mnt/c/Program Files (x86)/Nmap/nmap.exe"'
alias arp='arp.exe'

#encrypt
alias rot13-e="tr 'A-Z' 'X-ZA-W'"

#Default editor
export EDITOR=vi
export VISUAL=vi                #VISUAL defines the user's preferred utility for editing files

# LS_COLORS env:
# If I want to set my own colours for files and directories I would do something like this:
#               LS_COLORS="di=35:ex=4;31:*.mp3=1;32;41"
#               This sets dirs to purple, executables to red underlined, .mp3 to bold, green on red background

# some foreground colours:
# Black 30, Blue 34, Cyan 36, Green 32, Purple 35, Red 31, White 37, Yellow 33
# some background colours:
# Black 40, Blue 44, Cyan 46, Green 42, Purple 45, Red 41, White 47, Yellow 43
# some text types:
# Normal 0, Bold 01, Dim 02, Underlined 04, Blinking 05, Reversed 07 (black text on white background vice versa), Hidden 08.

这是我的 .tmux.conf 文件:

# CHANGES THE PS1 PROMPT COLOUR TO ORIGINAL BASH:
set -g default-terminal "xterm-256color"

# CHANGES C-b TO C-a: (-g STANDS FOR GLOBAL)
set -g prefix C-a
unbind C-b
bind C-a send-prefix

# CHANGES 0-9 TO 1-9 WHEN TARGETING BETWEEN PANES:
set -g base-index 1

# CHANGE HISTORY LIMIT:
set -g history-limit 2000

# DISABLE AUTO-RENAME:
#set -g allow-rename off

# SWITCHING BETWEEN PANES:
#set h select-pane -L
#set j select-pane -D
#set k select-pane -U
#set l select-pane -R

# ADD OR REMOVE THE STATUS BAR:
#set status off

# CHANGING THE COLOURS OF THE STATUS BAR:
#set -g status-style bg=default
set -g status-style fg=white,bg=blue
#(colours: black, red, green, blue, yellow, magenta, cyan, white. Add 'bright' in front for brightcolours. Alternative, use colour0 - colour255, or default)

# CHANGING THE COLOR AND SIZE OF STATUS LINE:
#set -g status-left-length 20
#set -g status-right-length 100

# RENUMBERS WINDOWS IN ORDER IF CLOSED:
set -g renumber-windows on


# Sources the .bashrc file so that 'python' (and the other alias') work inside tmux
#set -g default-command "/bin/bash"

# This below enables a quick route to 'source' the tmux.conf file (because it wouldn't do it when I tried the normal way)
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"

# LIST OF PLUGINS:
#(press prefix + 'I' to install/fetch the plugin)
#(press prefix + alt + 'u' to remove it. Or just remove it from ~/.tmux/plugins)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
#set -g @plugin 'github_username/plugin_name'

# THEMES:
source-file "${HOME}/.tmux-themepack/powerline/double/cyan.tmuxtheme"


# INITIALISE TMUX PLUGIN MANAGER (KEEP THIS AT THE VERY BOTTOM OF YOUR .tmux.conf FILE)
run '~/.tmux/plugins/tpm/tpm'
tmux
1个回答
0
投票

我也有同样的问题。完全相同的胡言乱语,数字对数字(这让我认为这是任何配置文件外部的东西)。

我的配置中没有像你一样的任何“运行”命令。

我也在WSL2。但是当我将Windows 11更新到23H2后,我的问题出现了。同时我在 WSL 中更新了 Ubuntu (20.04)(即

apt upgrade
)。

现在我在启动 tmux 后的第一个提示中就得到了这些东西。

当我有机会时,我会检查一堆东西,并可能升级 tmux(现在使用 3.0a)。

© www.soinside.com 2019 - 2024. All rights reserved.