LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-25-2024, 04:08 AM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Unhappy 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)

Last edited by dedec0; 03-25-2024 at 04:11 AM.
 
Old 03-25-2024, 05:00 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
you can always change the colors in vim
 
Old 03-25-2024, 09:26 AM   #3
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
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.
 
Old 03-25-2024, 06:36 PM   #4
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
I like to default to the industry colorscheme when using vimdiff. How to set this in .vimrc and other possible tweaks are discussed here.
 
Old 03-26-2024, 02:58 AM   #5
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by allend View Post
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.)
 
Old 03-26-2024, 04:09 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
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.
 
Old 03-26-2024, 05:37 AM   #7
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
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.
 
Old 03-26-2024, 06:23 PM   #8
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
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.
 
  


Reply

Tags
cli, diff, terminal, vim



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Choices choices choices hsnanua Linux - Newbie 1 09-15-2011 10:45 PM
LXer: Choices Choices Choices LXer Syndicated Linux News 0 09-07-2010 01:30 PM
Choices, Choices Mephisto Slackware 30 02-01-2006 09:29 PM
RHEL 4 Installer Choices: I want to see the packages associated with these choices. tacoshell Red Hat 2 05-05-2005 04:34 PM
Choices, choices ... what shall I start with? rtuckwell Linux - Newbie 5 01-25-2003 06:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration