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

no colour in vim in a Docker container when using contour #1244

Closed
Yaraslaut opened this issue Oct 9, 2023 Discussed in #1240 · 7 comments
Closed

no colour in vim in a Docker container when using contour #1244

Yaraslaut opened this issue Oct 9, 2023 Discussed in #1240 · 7 comments

Comments

@Yaraslaut
Copy link
Member

Discussed in #1240

Originally posted by mufasachan October 9, 2023
I edit files in running containers using Vim, primarily for prototyping a Dockerfile. I recently installed contour, and it's fantastic. However, when I edit files in my container with Vim, the colors are missing. I suspect I may have overlooked something in the configurations (either Docker or contour).


When I execute the following commands:

docker run -it debian:stable-slim bash
>> apt update && apt install -y vim
>> vim

I don't see any colors when editing a file, for instance, .bashrc. The main screen also lacks colors. If I try to view highlight groups (:hi), the list of all highlight groups appears, but it's entirely in black and white.

Moreover, I've noticed that executing any command in the bash within the container works fine. For example:

# In container
>> ls --color
>> echo -e "\e[31mRed Text\e[0m"

I've added this post to the discussion as I don't believe the issue is related to Contour. I suspect my lack of understanding regarding terminal emulators and Docker is the cause. If you can identify or replicate this behavior and investigate why it doesn't work, I would be greatly appreciative 😁 .

I wonder why the container's bash seems to handle colors well, while Vim within the container fails to output colors.

@uspasojevic96
Copy link
Member

Check if you added contour terminfo to the docker image

@Yaraslaut
Copy link
Member Author

This is true that terminfo is not inside docker image, its just raw image with installed vim

@uspasojevic96
Copy link
Member

just set TERM to xterm-256color then, it should work

@mufasachan
Copy link

It works, Yaraslaut provided links in its answer in discussion and I set this variable to this value and it worked.

@Yaraslaut
Copy link
Member Author

This is great.
@mufasachan can you provide docker setting that fixes this issue?

@mufasachan
Copy link

Oops, sorry, sure.

docker run -it -e TERM='screen-256color' debian:stable-slim  bash
>> apt update && apt install -y vim
>> vim # Colorful this time

@Yaraslaut
Copy link
Member Author

Thanks, i am closing it then

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

No branches or pull requests

3 participants