我在我的zshrc中有一个定制的别名为`ls -als“ la”,并且它被``ls -lah''的东西所覆盖。这是从哪里来的?

发布于 2025-01-24 16:33:25 字数 198 浏览 4 评论 0原文

我在.zshrc < / code>中有以下内容,

alias la="ls -als"

并且被覆盖了

▶︎ which la
la: aliased to ls -lAh

为什么会发生这种情况 /它可能来自哪里?

I have the following in my .zshrc

alias la="ls -als"

And it's being overwritten

▶︎ which la
la: aliased to ls -lAh

Why is this happening / where might it be coming from?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白芷 2025-01-31 16:33:25

在很大程度上帮助了 https://stackoverflow.com/a/26742455/413254 〜/.oh-my-zsh/lib/directories.zsh中,有一些内置目录别名内置的别名。

▶︎ cat directories.zsh
# Changing/making/removing directory
...
# List directory contents
alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'

您可以通过几种方式解决此问题:

  • 将我的la别名更改为其他
  • 修改以上.oh-my-zsh文件,
  • 请确保我在以后定义我的别名我的.zshrc中的来源$ zsh/oh-my-zsh.sh.sh源$ zsh/oh-my-zsh.sh.sh.sh源基本上所有内容

Helped largely by https://stackoverflow.com/a/26742455/413254, it turns out that oh-my-zsh has some built in directory aliases in ~/.oh-my-zsh/lib/directories.zsh one of which overwrote my custom one!

▶︎ cat directories.zsh
# Changing/making/removing directory
...
# List directory contents
alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'

You could resolve this in a few ways:

  • Change my la alias to something else
  • Modify the above .oh-my-zsh file
  • Make sure that I'm defining my alias AFTER source $ZSH/oh-my-zsh.sh in my .zshrc. That source $ZSH/oh-my-zsh.sh sources basically everything in .oh-my-zsh/lib

I went with the last option.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文