1

Background: I'm just setting up an install of Arcolinux. I have a keyboard shortcut SUPER+Enter to launch alacritty.

What I want is to have alacritty automatically create and start in a new tmux session if there are none that havent been attached to. Or attach to an existing tmux session if nothing is attached to it.

I got this working by adding the following into alacritty.yml:

shell:
  program: /usr/bin/bash
  args: 
    - -l
    - -c
    - "tmux ls | grep -v attached && tmux attach || tmux"

This all works exactly as I would like apart from one thing, the colors in nvim are messed up using this method (darker so visual mode has the same highlight color as the background - annoying).

I found several related issues and have tried solutions from there: e.g I have the following in my tmux config (as well as some other variants including a 2 liner):

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

I've made sure the TERM variable is set to xterm-256color and I also tried setting background to "dark" in nvim.

None of this seems to help when I launch nvim from a tmux session connected to using the above configuration in alacritty.

However if I remove the alactritty configuration and run the command to connect to tmux manually everything works fine and nvim looks as expected:

/usr/bin/bash -l -c "tmux ls | grep -v attached && tmux attach || tmux"

Any ideas why im getting different results launching from the alacritty config.

FYI part of the reason I am doing it this way is because I have no idea where the binding for SUPER+Enter is set, cant find it in any config files or settings (is there a better way to chase it down) so thoughts on that might be useful too.

1 Answer 1

1

I hope this helps someone:

I solved this but I'm still a little confused. When I ran :checkhealth from nvim it was confirmed that there was an issue with the TERM variable. It reported that TERM was set to tmux-256color and gave this warning:

WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.

The confusing part is that you can set a term in alacritty but the docs say:

# This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used.

and when I ran echo $TERM it returned xterm-256color so I left it, however it turns out the solution was to explicitly set TERM in alacritty config to xterm-256color:

env:
  TERM: "xterm-256color"

this also needs to be set in your tmux config (but I had that already):

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .