loading...

Turning off the syntax highlighter

huytd profile image Huy Tr. ・1 min read

Well... first of all, this is a well-known topic that widely discussed everywhere already.

So I started turning off my Vim's syntax color from May this year, it's 5 months already.

There some real benefits for it that I can confirmed now:'

  • Getting more focus on the work, that mean, more productivity
  • Read/understand the code better, and even faster
  • Vim run faster as well
  • Being way more cooler, my colleagues now look at me as a guy from Mars

Is there anyone doing the same thing?

P/S: This is the color scheme I'm using for my vim https://gist.github.com/huytd/8394f21bda3a08be025813c060d64e75

Posted on by:

huytd profile

Huy Tr.

@huytd

Write code, drawing things

Discussion

markdown guide
 

Won't venture to disagree with others' results, but turning off syntax highlighting would be detrimental to me. Due to my dyslexia, I rely on it heavily to help me visually parse code, and catch typos early.

 

I'm not dyslexic, but I also find that syntax highlighting helps me catch typos early. The more distinctly colored different segments of text are, the better, in my opinion.

 

Well, at least you have good taste in music! :)

 

To each its own of course, but for the life of me I cannot imagine why I would want to turn off syntax highlighting. If it helps you being more productive and understand code better, then please continue, but it's not for me.

With highlighting, I can easier understand the structure of sentences in the source. Keywords stand out and I can quickly scan the code for the parts I am interested in. If I suspect something is wrong in the definitions I scroll up until the color of the code tells me I am in the definition part of the source. If I make a typo, the words don't color so it tells me I made an error so I would not want to live without it. To me syntax highlighting is the best thing since sliced bread.

 

On second thought - and clicking through some of the linked posts - I must add that I am using a scheme with few colors:

Example

 

Last time I didn't have any syntax highlighting while coding, it was C64 BASIC, and I was 10. I have generally seen my code improve and my errors be easier to find as the degree of syntax assist tooling I've used has increased. Today, I use (all hooked into Atom) prettier, eslint, and syntax highlighting (Nord theme)... Not a whole lot of syntax errors go undetected.

So to me, this would be catastrophic advice.

 

I think, with code highlighting, you really need to evaluate what is being highlighted. Then you will suddenly notice that it doesn't really make sense to highlight everything.

For example Java keywords highlighting is not necessary - you can live with having them bold. Highlighting every code symbol (function, variable) also kinda misses the point. However knowing which variables are static and which are constants - is actually useful.

I don't think a developer should code without highlighting - that's a bad idea. But you should evaluate what highlighting you really need.

 

Your screenshot includes bold keywords and dimmed comments, so I assume you're either rolling your own or using a minimal syntax highlighting scheme, rather than actually turning it off?

You say "Getting more focus on the work, that mean, more productivity" but the only coloured thing on your screen, which immediately grabs attention, is a clock and a song title, both of which are totally unrelated to work (unless you're coding a bot that writes metal...)

 

I'm trying this out. Also trying out VIM since I delayed it quite some time!

I'm curious about your status line style and that music playing thingy. Would you mind sharing it? I love the style of it :)

 

It's just a script to display current playing song on Spotify on Tmux status line. You can take a look at github.com/jdxcode/tmux-spotify-info

For the tmux, I made a config file public here gist.github.com/huytd/10e490955d34...

 

How can you say:

Getting more focus on the work, that mean, more productivity
Read/understand the code better, and even faster

Without a parallel you working on the same thing over that period of time? This is bogus click bait.

 

Haha, I can’t believe some of these responses... seriously people? I learned to code long before syntax highlighting was a thing, and honestly, while I do use it today, I like a very tame color scheme for the most part. To me it seems like everyone should basically create their own theme, because we all think differently, and we all react to colors and other distractions differently.

Anyway, here’s to experimentation and exploration!

 

I worked a long time on various (exotic) platforms without effective or any syntax highlighting. I think it certainly makes you a better developer, in the sense of reading the code without aids, and taking assumptions of the editor (or any tool) you're using as granted. I could compare it to watching the movie vs. reading the book. You have to put in more effort, but it feels you just somehow get to a deeper understanding of the code.

Also, strictly speaking, your screenshot is not syntax highlighting off, it's just limited syntax highlighting. In most my cases, not even comments or language keywords were colored differently. ;)

I think every developer should try coding with highlighting off, if for nothing else then for an adventure and to stretch their limits. And it's good practice to reduce your dependency on your tools, just as good practice to keep your code's dependency to the minimum, if it's possible with reasonable effort. Otherwise it's just a matter of taste. At this point I can certainly switch back to not using syntax highlighting at all with a few hours of adjustment. But SOME syntax highlighting, just makes me more productive, I learned. And when you have work to do, that matters a lot.

 

Ha! I never noticed how little syntax highlighting I was actually using until I read this post and then quickly looked at my editor screen. Being colour blind means that I'm not seeing a lot of the "additional" information being added, so the end result is that I have 3 colours in use (base, constants, and strings) with bold for keywords.

I personally would think that too many colour variations would become distracting and slow down coding because you have to remember what each colour means rather than understanding the actual text of the code. But that's just me.

Do whatever makes you more productive. Working code is more useful than "pretty" non-working text :D

 

First of all, it's a personal preference.

Whatever makes you more productive the better. Personally though, I'd prefer syntax highlighting over the other because unlike you, it allows me to read, understand and browse the code much faster.

Your vim setup looks amazing by the way!

 

I agree. It's just the matter of personal taste, and I tend to share my taste to find more people just like me (or hopefully convert someone's taste :P)

 

I could try to disable syntax highlighting but I doubt it will boost my productivity. Better tools will do, so I count syntax highlighting as a tool. I have a delay (1s) before the linter runs so sometimes I detect syntax errors faster because of syntax highlighting. It's easier to me to navigate in colorized code as well for some reason.

 

This is the color scheme I use. I am curious to try without colors, but I need to change all the entries in the preferences and right now I am lazy... Maybe I'll try.

Reflecting a bit, I think that the most important highlighting for me are the keywords and the comments. I could definitively do without highlighting for strings and numbers and maybe type names too.

 

Wait what? While I can't wait for JetBrains to implement MORE distinct with MORE options to highlight something, some people DELIBERATELY turn off the highlighting in their editors? And try to convince others that indistinct gray text on black background is better than highlighted, bright highlight on dark background?

Not only syntax highlighting helps to understand code fast: you rely more on color than on reading code to see the place in code you're looking for.
If color scheme of syntax highlighting HURTS your productivity, you should change both editor and colorscheme, because it's the real reason it does not work for you.

 

When I first read about this idea, I felt it's so crazy, and same as most of the opinions here, I was rely on rainbow to check my syntax errors until I decided to give it a try.

It turned out typo and syntax errors is something you won't see if you really pay attention for every line of code you write.

And it's not completely syntax off, as many people pointed out, I used 3 different colors: gray, white and "less white" :D including the bold font.

P/S: I know it's hard to accept, just like if you forced yourself to have salad instead of baby back ribs for lunch, you missed the ribs but you feel good after finished the salad :joy:

 

Actually I've thought about this before. When I do it I realize that it encourages me to add more whitespace around things. I actually have a color scheme right now that highlights mostly comments which encourages me to write better docs. I think that most color schemes are just too dumb and aren't telling you much about your code. Really folks, just try it for a day or two as an exercise, see if your code comes out better.

 

I find syntax highlighting over PuTTY disturbing, it looks like a unicorn has exploded in my terminal. Other than that, I try to use as little colors as possible for the aforementioned reason.

If you don't understand your code without rainbow colors, you probably use the wrong language. :)
The Vim in the OP looks nice.

 

Syntax highlighting isn't to help me understand the code. I can read/write/understand the code I'm writing with or without the colors, but it certainly slows down my flow when they're gone. If having little or no highlighting works better for you and others then that's definitely what you should do, but there would be zero benefit for me to code like that all the time.

 

You can change it in PuTTY going into Connection -> Data and changing Terminal-type string to xterm-256colors, xterm by default uses 8 colors. I use morhetz/gruvbox colorscheme in vim, it looks nice.

 

Am I too late to mention syntax highlight is NOT off in your screenshot? I mean, it's grayscale, ok, but still.

I tried this a thousand times. I change my color schemes all the time, it's a little less boring, since we now have to code with plugins and linters telling us what to do.

 

Yeah I mentioned it: gray, white and "less white" :D :D :D

 

That kind of music will destroy your productivity anyway, j/k, I'm also a fan of Amon Amarth.
But I see the syntax highlighter will help me more productive, maybe it's everyone to his taste.

 

We teach with a plain text editor at first - to show what that's like. No one chooses to keep using it after we show them sublime. We find syntax highlighting to be very helpful.

 

Used to never had it to begin with for the first 20ish years, but I would never turn it off now.

 

Please share your syntax highlighting (so clean for me xD)

 

It's in the last URL of the post :D