我正在设置一个新环境,似乎遇到了SBT或Linux上的shell的问题,点击向上箭头而不是显示我以前运行的命令,它显示:
没有这样的小部件"以前的历史记录">
我使用ZSH作为外壳,但我在其他任何地方都没有看到这个问题,包括sbt console
。我以为是配置了bindkey导致了这种情况,但我似乎找不到任何设置。这种情况也发生在Bash中。
这是我从zsh --sourcetrace
:看到的输出
+/etc/zshenv:1> <sourcetrace>
+/etc/zshrc:1> <sourcetrace>
+/home/mhicks/.zshrc:1> <sourcetrace>
+/home/mhicks/.cache/p10k-instant-prompt-mhicks.zsh:1> <sourcetrace>
[WARNING]: Console output during zsh initialization detected.
When using Powerlevel10k with instant prompt, console output during zsh
initialization may indicate issues.
You can:
- Recommended: Change ~/.zshrc so that it does not perform console I/O
after the instant prompt preamble. See the link below for details.
* You will not see this error message again.
* Zsh will start quickly and prompt will update smoothly.
- Suppress this warning either by running p10k configure or by manually
defining the following parameter:
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
* You will not see this error message again.
* Zsh will start quickly but prompt will jump down after initialization.
- Disable instant prompt either by running p10k configure or by manually
defining the following parameter:
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
* You will not see this error message again.
* Zsh will start slowly.
- Do nothing.
* You will see this error message every time you start zsh.
* Zsh will start quickly but prompt will jump down after initialization.
For details, see:
https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt
-- console output produced during zsh initialization follows --
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/gitstatus/gitstatus.plugin.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/oh-my-zsh.sh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/tools/check_for_upgrade.sh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/cache/.zsh-update:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/compfix.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/bzr.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/clipboard.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/cli.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/compfix.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/completion.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/correction.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/diagnostics.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/directories.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/functions.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/git.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/grep.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/cache/grep-alias:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/history.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/key-bindings.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/misc.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/nvm.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/prompt_info_functions.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/spectrum.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/termsupport.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/lib/theme-and-appearance.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/plugins/git/git.plugin.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/example.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/internal/p10k.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/internal/configure.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/internal/worker.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/internal/parser.zsh:1> <sourcetrace>
+/home/mhicks/.oh-my-zsh/custom/themes/powerlevel10k/internal/icons.zsh:1> <sourcetrace>
+/home/mhicks/.sdkman/bin/sdkman-init.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/etc/config:1> <sourcetrace>
+/home/mhicks/.sdkman/etc/config:1> <sourcetrace>
+/home/mhicks/.sdkman/etc/config:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-version.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-update.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-config.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-help.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-cache.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-broadcast.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-install.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-availability.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-upgrade.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-env-helpers.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-utils.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-uninstall.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-offline.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-use.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-selfupdate.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-list.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-current.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-main.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-home.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-default.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-env.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-flush.sh:1> <sourcetrace>
+/home/mhicks/.sdkman/src/sdkman-path-helpers.sh:1> <sourcetrace>
+/home/mhicks/.nvm/nvm.sh:1> <sourcetrace>
+/home/mhicks/.nvm/bash_completion:1> <sourcetrace>
+/home/mhicks/.zcompdump:1> <sourcetrace>
+/home/mhicks/.p10k.zsh:1> <sourcetrace>
编辑:已经确认,这确实发生在Bash中,所以我认为完全擦除我的用户目录并重新启动可能会修复它。唉,我所做的似乎是导致这种情况持续存在,或者是某种服务在运行。我创建了一个新的主目录,安装了ohmyzsh,配置了powerlevel10k,安装了sdkman,安装了SBT,安装了Java,然后验证了这一点。
您在Zsh中看到的输出意味着您↑键绑定到一个不存在的小部件。你可以这样做:
- 键入
bindkey '
- 按控制V
- 按↑
- 键入
'
,然后按输入
您现在应该在终端中看到以下两种情况中的一种(%
是提示(:
% bindkey '^[[A'
bindkey '^[[A' previous-history
%
% bindkey '^[OA'
bindkey '^[OA' previous-history
%
尽管有一个名为previous-history
的readline
命令,但Zsh中没有该名称的小部件。您的点文件中的某个位置显然有试图绑定的代码↑到previous-history
,但未能实际创建previous-history
小部件。也许您正在尝试在zsh
点文件中使用bash
代码?
无论是什么情况,您都可以通过在.zshrc
中添加以下片段中的一个来解决此问题
bindkey -d # Delete existing keymaps and reset to default state.
bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search
bindkey '^[OA' up-line-or-search
bindkey '^[OB' down-line-or-search