nvim-lua / kickstart.nvim

A launch point for your personal nvim configuration
MIT License
20.06k stars 24.43k forks source link

Terminal.app is stuck in the 1970s (Mac colors broken) #68

Closed Ethanol48 closed 1 year ago

Ethanol48 commented 1 year ago

I saw a youtube video recommending this directory ( https://www.youtube.com/watch?v=stqUbv-5u2s&t=240s ) and it's very cool is crazy useful the LSP and everything I used worked, but the color scheme I don't know if it was my system, I have macOS 12.5.1 but everything is blue, very different from the video, I even tried to run it in a docker container with ubuntu, it had the same result, everything blue and changing the color scheme to other sometimes wasn't totally right, text won't highlight very rare

Kuly14 commented 1 year ago

Me too on macOs 12.4. Not sure why. I installed it on my ubuntu machine yesterday and it worked like a charm.

craigmac commented 1 year ago

If you are using Terminal.app on macOS, it's because it doesn't support truecolor, try iTerm2/Alacritty/Kitty instead.

tjdevries commented 1 year ago

Sorry mac "is perfect out of the box" I didn't realize that this terminal app doesn't support modern features :wink:

I'll pin the issue so others can see this. Won't fix.

tjdevries commented 1 year ago

(PS this is me just joking -- if you know of a way to solve this, then I will fix here if reasonable haha)

craigmac commented 1 year ago

@tjdevries I believe it actually works somehow if you are using Tmux inside of Terminal.app, not sure of the details why, but yeah... otherwise agree 😆 At least we don't have to deal with issues like this: https://github.com/vim/vim/issues/11722

mutairibassam commented 1 year ago

@Ethanol48 @Kuly14 I had the same issue and solved it by commenting color properties.

-- Set colorscheme
--vim.o.termguicolors = true                       -> (will remove the green highlight)
--vim.cmd [[colorscheme onedark]]                  -> (will remove the blue background)

@craigmac; can you please confirm above changes will not affect any functionality?

craigmac commented 1 year ago

I don't know if it will or not, depends on what you install... some plugins require termguicolors on, and you can't use that in Terminal.app, so more than likely if you are trying to use a modern Neovim setup, at some point you're going to run into issues with colors when using Terminal.app.

tjdevries commented 1 year ago

Yes, you can go find a colorscheme that works without truecolors -- but that won't be included in this repo at this time. So it's an issue outside of the scope of this repository.

carlosles commented 1 year ago

Would be nice to have the README mention as a disclaimer that this kickstart template doesn't support the macOS Terminal.app and suggest a few well-known alternatives.

splooge commented 1 year ago

I don't know if this will help anyone with a mac in the future, but here goes.

The version of ncurses that ships with mac is ancient and was causing me grief between tmux and vim (I hadn't tried nvim at the time). I couldn't for the life of me get italics to work with the tmux/vim combo. Turns out the version of ncurses that ships with mac is so old it doesn't even have tmux-256color support! I was having to add ritm,sitm (italics capabilities) manually to xterm-256color just to get things partially working.

Here's the version of ncurses that comes with the mac (as of 20230112):

$ tic -V
ncurses 5.7.20081102

Notice that it's 14 years old.

I used brew to install the latest ncurses, and now:

$ /opt/homebrew/Cellar/ncurses/6.4/bin/tic -V
ncurses 6.4.20221231

My fix was to grab the latest xterm-256color and tmux-256color terminfos from the brew-installed version of ncurses and import them manually so the mac could use them. To export from the new ncurses:

$ /opt/homebrew/Cellar/ncurses/6.4/bin/infocmp -x xterm-256color > /tmp/xterm-256color.terminfo
$ /opt/homebrew/Cellar/ncurses/6.4/bin/infocmp -x tmux-256color > /tmp/tmux-256color.terminfo

Then import so the mac could use them:

$ tic -x /tmp/xterm-256color.terminfo
$ tic -x /tmp/tmux-256color.terminfo

This writes the newer terminfos to ~/.terminfo which, if anything above messed you up, you can simply remove, but I'm happy to report that I've had a 100% success rate in everything ncurses-related since I made the above changes.

craigmac commented 1 year ago

everything ncurses-related since I made the above changes.

Yes, it's somewhat better, but termguicolors will still not work even with the new terminfo (which should be installed with /usr/bin/tic by the way): https://gpanders.com/blog/the-definitive-guide-to-using-tmux-256color-on-macos/

splooge commented 1 year ago

Yes, it's somewhat better, but termguicolors will still not work even with the new terminfo

It definitely works. 24-bit color is working just fine using various scripts like the one found here. I haven't found a color I couldn't print nor have I had a colorscheme that didn't work appropriately.

which should be installed with /usr/bin/tic by the way

It is. The tic 6.4 binary that gets installed by brew isn't in the $PATH.

$ which tic
/usr/bin/tic

https://gpanders.com/blog/the-definitive-guide-to-using-tmux-256color-on-macos/

Thanks for the link. I wasn't aware of the 5.7 bug.

Also, with the

$ export TERMINFO_DIRS=$TERMINFO_DIRS:$HOME/.local/share/terminfo

I don't see how that would work since TERMINFO_DIRS isn't defined in the first place, at least not on MacOS. This wouldn't append to, it would create the variable. So unless the 14-year old version of ncurses is smart enough to look at /usr/share/terminfo first and then $TERMINFO_DIRS, this solution wouldn't work and would only limit your available terms to the ones you put in ~/.local/share/terminfo manually. But to be honest, I'm not going to test this, since I don't need to. If you do, let me know your results. Happy to be shown that I am wrong.

craigmac commented 1 year ago

It definitely works

I should have said "termguicolors" does not work outside of tmux. Yes, you can do it using tmux and the right terminfos but outside of tmux, it doesn't work.