我正在 Arch 上使用 Zsh 运行 gnome 3.10.1。我面临的问题是,当我从终端窗口创建新选项卡或窗口时,它将当前目录重置为我的主目录。
我已经尝试过这个:gnome-terminal:在新选项卡中跟踪目录,但没有成功。
我认为这可能是我的.zshrc
文件中的一些配置,所以,我清理了它并只添加了以下行:
. /etc/profile.d/vte.sh
然而,它并没有按预期工作。
是的,该文件存在,以下是其内容:
# Copyright © 2006 Shaun McCance <[email protected]>
# Copyright © 2013 Peter De Wachter <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Not bash or zsh?
[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0
# Not an interactive shell?
[[ $- == *i* ]] || return 0
# Not running under vte?
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0
__vte_urlencode() (
# This is important to make sure string manipulation is handled
# byte-by-byte.
LC_ALL=C
str="$1"
while [ -n "$str" ]; do
safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}"
printf "%s" "$safe"
str="${str#"$safe"}"
if [ -n "$str" ]; then
printf "%%%02X" "'$str"
str="${str#?}"
fi
done
)
# Print a warning so that anyone who's added this manually to his PS1 can adapt.
# The function will be removed in a later version.
__vte_ps1() {
echo -n "(__vte_ps1 is obsolete)"
}
__vte_osc7 () {
printf "\033]7;file://%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")"
}
__vte_prompt_command() {
printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}" "$(__vte_osc7)"
}
case "$TERM" in
xterm*|vte*)
[ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command"
[ -n "$ZSH_VERSION" ] && chpwd_functions+=(__vte_osc7)
;;
esac
true
这实在是让我很烦恼……
有什么解决办法吗?
答案1
我不知道您是否仍然遇到这个问题,但我发现我的问题是我在终端配置文件中将 /bin/zsh 作为自定义命令运行。禁用它解决了我的问题 - 并且仍然保留 zsh 作为我的主要 shell。