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

Tmux messing with highlighting #3099

Closed
ElSargo opened this issue Jul 18, 2022 · 10 comments
Closed

Tmux messing with highlighting #3099

ElSargo opened this issue Jul 18, 2022 · 10 comments
Labels
C-bug Category: This is a bug

Comments

@ElSargo
Copy link

ElSargo commented Jul 18, 2022

Summary

When I run helix inside a tmux session all my comments get highlighted grey.
image
Then outside a tumx session the issue is gone...
image

Reproduction Steps

Install tmux using: sudo apt get tmux
Install helix with :
brew tap helix-editor/helix
brew install helix

open a supported file and make a comment
(this also happens in .toml files ect)

I have tried uninstalling both helix and tmux and removing all config files but I can't seem to find the cause of the issue

Helix log

log is empty

Platform

Linux ubuntu

Terminal Emulator

gnome40 terminal

Helix Version

helix 22.05 (27609f5)

@ElSargo ElSargo added the C-bug Category: This is a bug label Jul 18, 2022
@sudormrfbin
Copy link
Member

It might be caused by your terminal not supporting italics (or tmux not picking up support for it from your terminal) since the comments are italicized. Could you try two other themes with and without italics and see what happens?

@christianfosli
Copy link

See https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round

It works for me with

set -g default-terminal "tmux-256color"

in my tmux.conf

@ElSargo
Copy link
Author

ElSargo commented Jul 20, 2022

That fixed it, thanks!

@ElSargo ElSargo closed this as completed Jul 20, 2022
@hackaugusto
Copy link

hackaugusto commented Oct 14, 2022

Dropping a comment for Mac users arriving here through google:

  • As of Monterey 12.6:
    • Mac is distributed with:
> ncurses5.4-config --version
5.7.20081102
  • this version does not have tmux in its terminfo db:
> infocmp tmux
infocmp: couldn't open terminfo file (null).
  • Since tmux 2.2 it supports italics, but the $TERM must be set to a variant matching the glob tmux* ref
    • This is the default as of 3.3a ref, which breaks everything on mac, so one must either generate the db by hand or set the term back to a variant of screen*
  • The above means that tmux on macos does not support italics out-of-the-box, and can be tested with the following command:
> echo -e "\e[3mitalic\e[0m"

On iterm2 or alacritty this will render:

Screenshot 2022-10-14 at 20 08 12

but in tmux, inside any of these virtual terminals:

Screenshot 2022-10-14 at 20 09 02

this means that helix wont look right, like the screenshots on from OP or this:

inside tmux:

Screenshot 2022-10-14 at 17 44 04

with only alacritty:

Screenshot 2022-10-12 at 18 30 04

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

@Swoorup
Copy link

Swoorup commented Oct 17, 2022

Dropping a comment for Mac users arriving here through google:

  • As of Monterey 12.6:

    • Mac is distributed with:
> ncurses5.4-config --version
5.7.20081102
  • this version does not have tmux in its terminfo db:
> infocmp tmux
infocmp: couldn't open terminfo file (null).

set -g default-terminal "tmux" fixed it for me,

@jerinjoy
Copy link

jerinjoy commented Apr 8, 2023

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

to set up the terminfo for tmux:

❯ exa -lh --git --sort=newest /Users/joy/.local/share/terminfo/74/tmux-256color
Permissions Size User Date Modified Name
.rw-r--r--@ 3.3k joy   7 Apr 22:29  /Users/joy/.local/share/terminfo/74/tmux-256color

and set "tmux" as my terminal. hx displays the colors correctly but I still get errors running some applications:

❯ git diff
WARNING: terminal is not fully functional
Press RETURN to continue

@Sackbuoy
Copy link

Sackbuoy commented May 7, 2023

See https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round

It works for me with

set -g default-terminal "tmux-256color"

in my tmux.conf

Setting this caused Backspace Bad Behavior for me,
So I recommend setting

set -g default-terminal "xterm-256color"

instead

@muminoff
Copy link

This one worked for me.

Replace set -g default-terminal "xterm-256color" with following:

set-option -sa terminal-overrides ",xterm*:Tc"

Restart tmux.

@nmlt
Copy link

nmlt commented Jun 14, 2023

So I have this problem again, because I want to use tmux's control mode (tmux -CC). It's for integration with iTerm2 on Mac. Not using control mode it works and comments aren't highlighted, but as soon as iTerm2 manages the tmux session, italics seem to be broken again.

Anybody have an idea how to fix this?

@webdev23
Copy link

webdev23 commented Jan 2, 2024

I had trouble loading Helix custom themes inside tmux/byobu, and the fix for me was to add exactly the following in ~/.byobu/tmux.conf:

set -g default-terminal "screen-256color"
set -ag terminal-overrides ",xterm-256color:RGB"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

10 participants