Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation and/or support for MacOS #7

Open
alexanderjeurissen opened this issue Dec 10, 2017 · 13 comments
Open

Documentation and/or support for MacOS #7

alexanderjeurissen opened this issue Dec 10, 2017 · 13 comments

Comments

@alexanderjeurissen
Copy link

I just tried using this package and came to the realisation that dircolors only works on GNU e.g. Linux. and that MacOs uses LS colors https://gist.github.com/smutnyleszek/c44124908a9b737e372c28aaf0048b44

I found some instructions on how to get dircolors working by installing coreutils and adding the following code snippet to either bashrc or zshrc.

  test -e ~/.dir_colors && \
     eval `gdircolors -b ~/.dir_colors`

source: http://www.conrad.id.au/2013/07/making-mac-os-x-usable-part-1-terminal.html

I can verify that this will indeed change the LS_COLORS but the directory highlighting is still the same. Am I missing something ?

I'm using Alacritty + Tmux + Zsh and have the respective Nord theme installed for all of them.

@alexanderjeurissen
Copy link
Author

Hmm it seems that the code above does something, but only the GNU shell utilities respect it.

screen shot 2017-12-10 at 22 56 01

The first output is when explicitly using the GNU ls command which is present in the coreutils homebrew package, the second output is bsd ls

@arcticicestudio
Copy link
Contributor

The screenshot looks fine, the folders are colored. The only difference is that the BSD ls seem to ignore the bold attribute for them.

@alexanderjeurissen
Copy link
Author

@arcticicestudio Not only that but it seems that the highlighting of dynamic links is also not working as expected in BSD ls

BSD ls:
screen shot 2017-12-28 at 19 51 51

Core utils (GNU) ls:
screen shot 2017-12-28 at 19 52 09

@arcticicestudio
Copy link
Contributor

From what I've found in most issue reports and tutorials about getting dircolors set up for macOS it seems that BSD ls can only be configured by setting the LSCOLORS environment variable. The syntax differs from the LS_COLORS env variable used for *nix-based OS. It's not nearly as comprehensive e.g. you can't do file-type matching.

It think the only common solution is to use GNU ls (via alias) or try to build the theme for the LSCOLORS env variable e.g. using a generator or build it manually.

@alexanderjeurissen
Copy link
Author

@arcticicestudio I think you're right from what I've found it's not possible to have such detailed contextual highlighting using lscolors. For now I've aliased ls=\gls --color=always -G

Different question how did you manage to display the symbolic link target without the prefixed detailed file info chmod, username, last access date(in the screenshot in the readme). As can be seen in my screenshot I use \gls -l but that also displays aforementioned file details.

@arcticicestudio
Copy link
Contributor

arcticicestudio commented Dec 29, 2017

That's because you specified the -l option which prints the output in a long listing format including all the details. If you run ls without any option it will print only the file/folder names in a line without any information. To one name per line add -1 (number one, not the lowercase character L 😄 ), so the full command should be \gls -1.

I'm not sure if the GNU core -utils package for macOS contains man, but you can try to run man gls to show the manpage which documents the command and all available options.

@arcticicestudio
Copy link
Contributor

Reopened to improve the documentation by clarify that the project only works for GNU ls. Refer macOS users to the LSCOLORS environment variable documentation and link to a color scheme generator.

@arcticicestudio arcticicestudio added this to the 0.2.0 milestone Jan 2, 2018
@arcticicestudio arcticicestudio removed their assignment Dec 6, 2018
@hoIIer
Copy link

hoIIer commented Mar 6, 2019

how can I use a color scheme generator to use the nord colors for osx? is there any easy way to do this sans manually configuring the colors?

@arcticicestudio arcticicestudio removed this from the 0.2.0 milestone Jun 21, 2019
@muriware
Copy link

muriware commented Jul 9, 2019

The following worked for me:

  1. Clone and create symbolic link as mentioned in the documentation.
  2. Install coreutils with homebrew
  3. Add the following in the .bash_profile or .zshrc:
PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

test -e ~/.dircolors && \ 
   eval `dircolors -b ~/.dircolors`
  1. start a new session.

Only the ignore pattern color doesn't work and the underscore when with the +t o+w permission.

EDIT 1: no alias with --color=always is being used. Plain ls.
EDIT 2: ignore patter color shows up outside tmux. Screenshoot is from inside tmux.

Screen Shot 2019-07-10 at 0 15 12

@shawnchan2014
Copy link

@jmurinello Thank you for sharing your approach. But I still have to alias ls --color=always in order to make ls show colors when I use it outside of tmux.

@pimts
Copy link

pimts commented Aug 9, 2019

@jmurinello What terminal app are you using? I followed your steps with iterm2 installed, but no coloring happens whatsoever. Any ideas?

@muriware
Copy link

My appologies for this late reply.

@shawnchan2014, I don't know if it's related but I'm using oh-my-zsh framework.

@pimts, I'm using iTerm2 build 3.2.7. Other than that, prior to use nord-dircolors I recall that my terminal didn't render italics and true color. This involves some configurations that I don't recall. Search for tmux italics and you'll find many articles on the topic.

@arcticicestudio arcticicestudio added the Hacktoberfest This repository participates in the Hacktoberfest label Oct 8, 2020
@arcticicestudio arcticicestudio removed the Hacktoberfest This repository participates in the Hacktoberfest label Nov 13, 2020
@haifengkao
Copy link

vivid has a working Nord theme
I need ls --color=auto for it to work though
https://github.com/sharkdp/vivid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants