Emacs shell 模式问题

Gok*_*mir 1 shell emacs

当我运行时 emacs shell 模式

ls
Run Code Online (Sandbox Code Playgroud)

我得到关注

   [0m[01;32mmanage.py[0m     [01;34mtemplates[0m
Run Code Online (Sandbox Code Playgroud)

这些必须是 manage.py 和模板。为什么会这样,如何解决?

Dar*_*all 5

这些是用于彩色显示的 vt100 代码(通常在当今大多数 Linux 发行版上默认启用)。Emacs shell 不处理 vt100 转义码。

查明您的ls命令是否有别名。

which ls
Run Code Online (Sandbox Code Playgroud)

它看起来像以下或类似的东西吗?

ls: alias to ls --color=tty
Run Code Online (Sandbox Code Playgroud)

如果是这样,您需要找到此别名的设置位置并取消别名或更改其调用方式。

如果 EMACS 环境设置设置为t. 您可以执行以下操作来设置备用功能。我使用 zsh,所以它包含一些特定于该 shell 的项目。

## for emacs
if [[ $EMACS = "t" ]] then
   PROMPT="%# "  # make the prompt simple
   unsetopt zle  # turn off advanced line editting

   ls_pager=( cat ) # ls is simple piped to cat
   ls_flags=( -A )  # default ls flags
fi
Run Code Online (Sandbox Code Playgroud)

对于 bash 你可以只是别名 ls

alias ls='ls -A'
Run Code Online (Sandbox Code Playgroud)