jenrey
V2EX  ›  问与答

各位老板好~如何给 MacOS 增加 DIR_COLORS 配色方案?

  •  
  •   jenrey · Jul 8, 2021 · 810 views
    This topic created in 1802 days ago, the information mentioned may be changed or developed.

    centos 下是

    cat /etc/DIR_COLORS
    

    这种配色方案。
    想把其搞到 MacOS 下。

    目前在用:
    iterm2 + zsh + oh-my-zsh

    现在执行 ls 心很累。
    感谢各位大佬解惑。

    FurN1
        1
    FurN1  
       Jul 8, 2021
    分享一下我的配置 repo:github.com/g6ai/dotfiles 配置思路参见里面的 Wiki,希望有所帮助

    其中这几行能满足楼主的需要: https://github.com/g6ai/dotfiles/blob/f4b6ae8ba40f724afef02f6a6749a1463a52256f/shrc#L37-L51
    FurN1
        2
    FurN1  
       Jul 8, 2021
    补充一下:

    - 上面链接所处的文件 shrc 是按情况被 bashrc 或者 zshrc,抑或 shell profile 等 source 的,这个文件里放的是共有的配置。这么做是因为我的配置文件尽量跨 OS,跨 shell 适配

    - export LSCOLORS=GxFxCxDxBxegedabagaced 可能是我从某个 Debian 版本粘贴的,如果楼主想换颜色就从这个环境变量入手

    - macOS 作为一个 BSD 的分支 Darwin,系统自带的工具是 BSD 那套,其中 ls -G 能实现彩色输出。我把它注释掉了,因为我用 Homebrew 安装了 coreutils,其结果是 ls 命令使用了 GNU/Linux 的,所以用 ls --color 实现彩色输出。

    我在这个 wiki 页面 https://github.com/g6ai/dotfiles/wiki/Deploy-on-macOS 记录了更多 macOS 下使用命令行会遇到的基础问题和解决办法。这些问题其实大部分都是 Darwin 和 Linux 的区别所致。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   842 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:52 · PVG 04:52 · LAX 13:52 · JFK 16:52
    ♥ Do have faith in what you're doing.