LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Bad vimdiff bad colours or bad terminal choices for them? (https://www.linuxquestions.org/questions/linux-software-2/bad-vimdiff-bad-colours-or-bad-terminal-choices-for-them-4175735277/)

dedec0 03-25-2024 04:08 AM

Bad vimdiff bad colours or bad terminal choices for them?
 
Hello, people. Today, I am willing to fix a fairly old issue I have seen with a fair frequency.

For the vast majority of things, I always use vim in a terminal, to create or edit whatever text file I want to play with.

And in a few times, playing with development, I use vimdiff in a terminal too. But the way it shows a few kinds of differences are very hard to be readed! I know there is a difference there, but I cannot really read the actual text in this part.

(it seems that linuxquestions attachment feature is broken, at this moment; I cannot attach my image because "a security token is missing", when I try to upload it; I have already contacted LQ about it, as the error asks us to do; while editing the post, advanced more, it should be possible to add attachments too, but the same error happened)

The terminal colours being used are the default Mate Terminal ones. But when vimdiff shows lines that are only partially changed in both files, it uses a light red background colours, and pink text in them - and this is the hardest thing to read! What I always used to "circumvent" the problem is selecting the lines I want to read, one at a time, so the colours are changed to something better to our eyes.

What do you suggest to change here? Vim settings for diffs? Or the terminal colour set? (and this second one may imply in changes that, maybe, go against what other command line programs expect from what these colours should be, which I do not know if there is something)

pan64 03-25-2024 05:00 AM

you can always change the colors in vim

dedec0 03-25-2024 09:26 AM

Yes, pan64. I can easily search and find this around. But is this issue happening due to a mistake in Vim default choices for diff colours used? I would rather choose a broader solution, if this is the case. Or I change the terminal setting, depending on what this may or may not imply. And with these ideas together, is where finding enough information is not so trivial, and so, I chose creating this thread.

allend 03-25-2024 06:36 PM

I like to default to the industry colorscheme when using vimdiff. How to set this in .vimrc and other possible tweaks are discussed here.

dedec0 03-26-2024 02:58 AM

Quote:

Originally Posted by allend (Post 6491934)
I like to default to the industry colorscheme when using vimdiff. How to set this in .vimrc and other possible tweaks are discussed here.

I suppose the reasons to make the default scheme are probably a much bigger number of what I have knowledge to make. So, I came here...

In the discussion you point, they "solve" the problem by saying the syntax eventually in use for a file will conflict with diff colours being used, and make some text invisible. So, turning the syntax off may help. The pink text, in my current case, is a bit easier to be readed with syntax highlight off, true. It is a cmake file, specifically. Do you consider this a bug in Vim? If the background will be light red, noticing the text colour is pink, and thus will hardly be read, could be something changed somehow, dynamically, that does not need to lose all benefits of syntax highlight.

Something else mentioned there is the environment variable TERM=xterm-256color, which is something I never used or have seen in use, I think. But, for my surprise, this variable is already set here. Now, I am confused. To what point the 16 colours shown in the mate-terminal setting are used? And could/should I use vim with more colours being shown/seen/used in the terminal? - and is this turned off, due my ignorance about its existence, and (apparently) it always exists today, since the value of that variable is already set (it is not in my user bashrc).

(It is not something in the main discussion of this thread, but do you know if I should receive any message about the problem to attach files here, that I contacted LQ about? I did not receive and anything, and I still cannot attach a file here. Are you able to attach files, if you want? Manage attachments > [choose a file] > click "upload" button... still same error.)

pan64 03-26-2024 04:09 AM

I think it is not a bug. The creators of vim make it configurable (I mean the colors). But they cannot make color scheme which will will be visible on every desktop. It is a problem for me too, I still need to customize the selected predefined color scheme.

allend 03-26-2024 05:37 AM

Quote:

Do you consider this a bug in Vim?
No. Have you tried adding this to your ~/.vimrc and then running vimdiff?
Code:

" Turn off syntax highlighting in vimdiff
" Use industry as the default colorscheme
if &diff
        syntax off
        colorscheme industry
endif

Feel free to experiment with other colorschemes. Your workflow, so choose what works for you.


Quote:

I cannot attach my image because "a security token is missing"
If you are using something like NoScript in your browser, check that you are allowing the datadoghq links. You need to pass the validation check on being a real user.

dedec0 03-26-2024 06:23 PM

Okay. I will not consider it a bug either.

Turning the syntax highlight off solves it for the cmake file diff, but I guess the issue may happen with other kinds of files. Specifically, I do not want to make that setting limit when using diff mode because it ads readability to it, anyway. I will use the industry colorscheme for diff mode, though (that specific setting). I experimented it now, and I can read all text. Maybe I will like another scheme more, but this is something beyond the question and discussion here.

I think I will mark this thread as solved, although I expect eventual new information, if someone has, in the future - or should not I close it, then?

- - - - -

Dear allend, I have no javascript blocked in the browser. All sites works normally here, including their dynamic parts. The human verification used works perfectly, it says I was verified, but the following page always shows the error, for some reason. Since it seems fine for you, now, I will open a thread in the appropriate forum about it. Thank you for your comment.


All times are GMT -5. The time now is 05:13 PM.