TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Turning off syntax highlighting

172 pointsby dudzikover 8 years ago

44 comments

jakub_gover 8 years ago
Slightly meta: Turning off the syntax highlighting entirely seems a bit hardcore to me, however, <i>I always read each commit I do</i> via git diff &#x2F; pull request view, which does not have syntax highlighting (other than red&#x2F;green for removals&#x2F;additions), and I always strive to make the diff look good for each commit (which means, doing one thing at a time in each commit, and making sure it reads well).<p>Unfortunately, not everyone I work with reads their code (yep, they write-commit-push-and-forget!) which sometimes makes code review a not so nice experience.<p>Please, please, <i>read your diffs</i> before sending code for review.
评论 #12886430 未加载
评论 #12889544 未加载
评论 #12888001 未加载
评论 #12887408 未加载
评论 #12886556 未加载
评论 #12886450 未加载
评论 #12889733 未加载
评论 #12886423 未加载
bluejekyllover 8 years ago
In the first few sentences he expressly states why you want highlighting:<p>&gt; I couldn’t skip through the source that fast anymore and it became harder to read<p>Which, yes all the modifications to style (which is only his own code by the way) helped factor out. But I bet he&#x27;d be even better now with highlighting that he&#x27;s made these additional changes to his style.<p>I worked for years without syntax highlighting. I am much more efficient with it for exactly the reason quoted. To each their own, but having visual cues to help is not a bad thing. I want my job to be easier.<p>I used to program black on white, then I was converted after jetbrains came out with an excellent dark theme with huge color variants that make code pop even better.<p>I&#x27;ll never go back; I want my work and job easy, not made harder.
评论 #12889003 未加载
评论 #12887112 未加载
eikenberryover 8 years ago
I predict that in a few months the author will turn a toned down version of syntax highlighting back on. All the advantages he stated were the result of disrupting his previous practices. Doing that forces you to reconsider how you do things and end up improving your skills. But they are learned lessons, not some mysterious side affect of less color.
评论 #12886754 未加载
评论 #12889798 未加载
pjmlpover 8 years ago
No thanks.<p>The last time I could bare not using syntax highlighting I was still on MS-DOS.<p>Since Turbo Pascal 7 (released in 1992), syntax highlighting is a must have on my programming environment.<p>But I understand when we are talking about vim, people prefer an hardcore experience.
评论 #12886472 未加载
评论 #12886437 未加载
评论 #12886740 未加载
评论 #12887649 未加载
评论 #12887645 未加载
gnuvinceover 8 years ago
This seems to be an over-reaction to overly highlighted code. I work with Erlang in Emacs, and at first I couldn&#x27;t believe how much of a Christmas tree my code looked like: every token had its own color, and it was really hard to read. Fortunately, erlang-mode has a setting to reduce the amount of highlighting. I don&#x27;t think the proper reaction to a code base that has too many colors is to have none at all: trop c&#x27;est comme pas assez. I think many would be happy with some limited highlighting, for example comments, strings, and other constructions that can span multiple lines, incorrect escape codes, possibly-misspelled identifiers, etc. I don&#x27;t really need or care that keywords and integer literals are colored differently.
fatbirdover 8 years ago
I have 2.5 major distinctions made in my syntax highlighting, and it&#x27;s common to almost all languages for me:<p>Comments are a shade that&#x27;s near the background: I can read them if I focus on them, but otherwise they&#x27;re not present when I&#x27;m reading code<p>Strings are a colourful colour, because the next visual distinction I want is between what&#x27;s an operation or name, and what&#x27;s data or literal. Numbers don&#x27;t get this treatment because they&#x27;re sufficiently obvious on their own.<p>The base text colour has a small distinction between keywords (darker) and everything else (lighter).<p>Sometimes I&#x27;ll pull in another colour if I&#x27;m in something like Python for things like decorators, to create a distinction between code and meta-code.<p>This takes care of 95% of the visual distinguishing that&#x27;s useful, and the rest is noise that adds cognitive load to track. As a bonus, because it&#x27;s common to all languages in which I work, switching is easy because almost every language breaks down nicely between these categories.
评论 #12889463 未加载
stevebmarkover 8 years ago
Not this again<p>&quot;We should remove all color from traffic lights and make people remember which position is what&quot;
评论 #12886414 未加载
评论 #12886569 未加载
评论 #12889837 未加载
评论 #12888098 未加载
评论 #12888532 未加载
Animatsover 8 years ago
Syntax highlighting only helps with the easy stuff. It doesn&#x27;t do anything for<p><pre><code> std::array&lt;std::shared_ptr&lt;Window&gt;, max_window_count&gt;{}; </code></pre> or<p><pre><code> s.lines() .map(|bline| UnicodeSegmentation::graphemes(bline, true) .collect::&lt;Vec&lt;&amp;str&gt;&gt;()) .map(|line| wordwrapline(&amp;line, maxline, maxword)) .collect::&lt;Vec&lt;String&gt;&gt;() .join(&quot;\n&quot;) </code></pre> because nothing there is a language keyword.
评论 #12887178 未加载
评论 #12887071 未加载
the_mitsuhikoover 8 years ago
I tried this multiple times over the last few years and it always didn&#x27;t matter. It&#x27;s not making a measurable difference but it looks less pleasant and I rather look at pretty things.
评论 #12888562 未加载
Philipp__over 8 years ago
I found most of syntax highlighting easy distracting. But I couldn&#x27;t turn it off completely as it felt <i>weird</i>. What I did is I modified theme who&#x27;s colors I loved the most, so that it highlights less things, so that only some keywords would be highlighted like (break, return, for, if, etc). That way it helped me as screen didn&#x27;t look to colorful, distracting and it didn&#x27;t strain my eyes as before, but still providing some necessary information that pops out, to help me see the structure of my code better. But that is just me. I think I am not yet ready to give up syntax highlighting completely, but who knows, maybe one day. I am surely making progress towards that.
BaNzounetover 8 years ago
Author should provide some before&#x2F;after code to show how it affected his coding style.
jstimpfleover 8 years ago
&gt; Conditional syntax highlighting<p>I think that&#x27;s the right approach. Different situations afford different tools. In normal usage, reading only in a single color is a real relief to me; but of course it&#x27;s typically easier to find missing delimiters and such with syntax highlighting.<p>I&#x27;ve had this shortcut in my vim configuration for a very long time and I use it frequently:<p><pre><code> nmap &lt;F11&gt; :if exists(&quot;syntax_on&quot;) \| syntax off \| else \| syntax enable \| endif \|&lt;newline&gt;&lt;C-g&gt; </code></pre> Similarly, there should be actual different flavours of highlighting for different tasks. I have configured a very light highlighting which highlights mostly control flow words (if, while, for, return etc) and maybe strings. It&#x27;s much better than the colorful default or syntax off for many situations. On other occasions it might be useful to highlight all variable declarations, etc.<p>I have come to think that it&#x27;s the same with programming languages: Different languages require you to type different things explicitly. Sometimes that&#x27;s beneficial but often it hurts. For example, typing a function signature is much more convenient in python (just variable names), but when debugging the explicitness of a more rigid type system often helps finding bugs. Similarly typing &quot;const&quot; or the precise type of integer is really annoying in many situations. It&#x27;s visually distracting and shifts the focus on alignment or ordering of statements, instead of the problem to be solved. On the other hand, sometimes these things are just important. It would be very nice to have a programming environment where these details can be hidden most of the time and only turned on when really needed.
drothlisover 8 years ago
I like to highlight just the places where you are defining new variables&#x2F;functions&#x2F;types so that the definition is easy to spot. What is the point of highlighting keywords? I suspect that highlighting engines do it simply because it&#x27;s easy to do, not because it&#x27;s useful.<p>It looks like this: <a href="http:&#x2F;&#x2F;david.rothlis.net&#x2F;code_presentation&#x2F;distracting_syntax_highlighting&#x2F;" rel="nofollow">http:&#x2F;&#x2F;david.rothlis.net&#x2F;code_presentation&#x2F;distracting_synta...</a>
评论 #12886846 未加载
评论 #12886451 未加载
评论 #12886538 未加载
bbarnover 8 years ago
On an average day, I use visual studio for 4 languages. There&#x27;s C#, HTML, JS, and some old VB.net depending on how old the code I&#x27;m working with is. Many times the same fix&#x2F;feature will touch all of them. That&#x27;s just on the .net stuff. Having the same general colorization scheme in place is probably all that makes skimming through code possible for me.<p>I remember feeling like the game changed when I went from grey and yellow on black to grey and holy crap other colors for other things on blue from turbo pascal 3 to 7. You can&#x27;t take it back from me now. I&#x27;ve had my syntax highlighted for 2&#x2F;3&#x27;s of my life now, I&#x27;m not giving it back.
zvrbaover 8 years ago
Yes, let&#x27;s use roman numerals too lest we calculate too efficiently and be able to express more complex calculations more easily.
评论 #12886527 未加载
jack9over 8 years ago
This seems like old-is-new waxing, reaching for some reason the old way is better.<p>&gt; Initially, turning off syntax highlighting felt weird. I couldn’t skip through the source that fast anymore and it became harder to read.<p>It does, that&#x27;s the point of syntax highlighting. This isn&#x27;t a good thing(tm).<p>&gt; Even though this appeared to be an impairment I found it to be the strongest argument for making the switch. By forcing me to read the code more carefully, it made me understand it better<p>I tried not highlighting a bunch of times, it&#x27;s called switching from my IDE to vi for whatever reason. It&#x27;s not better for me.
评论 #12891089 未加载
codepunkerover 8 years ago
Let&#x27;s not use headlights anymore too... This will force the us to drive more carefully and reduce speed to avoid a potential disaster.
评论 #12886668 未加载
twblalockover 8 years ago
I think syntax highlighting probably evolved before editors and IDEs could flag coding mistakes. A lot of the rationale for it no longer applies, e.g. coloring strings a certain way so if you forgot the terminating quotation mark, the rest of the file would change to that color and you&#x27;d know you screwed up.<p>I haven&#x27;t used syntax highlighting for years. My IDE highlights mistakes and compiler errors, and everything else is black. It&#x27;s actually a lot easier on my eyes, and the errors stand out a lot more because they are the only colored parts of the text. I only use highlighting these days to separate tags from content in markup languages like XML and HTML, where I still find it helpful.<p>This is all personal preference anyway, and it doesn&#x27;t matter very much. But I do encourage people to try going without syntax highlighting for a few days. You may find that you didn&#x27;t really need it, or that it was compensating for sloppy coding, and you may not want to switch it back on at the end of the experiment.
apetrovicover 8 years ago
Even better - we should ditch color monitors altogether. You know, to be edgy and different.
评论 #12887517 未加载
评论 #12887120 未加载
评论 #12888843 未加载
mseepgoodover 8 years ago
Turning syntax coloring off was the best decision in my career. I have never looked back.
评论 #12887197 未加载
评论 #12887965 未加载
评论 #12888763 未加载
评论 #12902942 未加载
tambourine_manover 8 years ago
I worked for years with SimpleText&#x2F;TextEdit on the Mac (Classic&#x2F;OS X) and Pico on the server.<p>I felt syntax highlighting was a gimmick that distracted me from my Monaco 10 with no anti-alias perfection. If I needed to do some repetitive editing beyond a simple find&#x2F;replace, I&#x27;d write a small shell script. I was kind of proud of my minimalism. You can do a lot with native Carbon&#x2F;Cocoa key bindings alone. Life was good.<p>Then someday I saw a video of someone doing crazy work in Vim. Flying. I <i>had</i> to learn that. I forced my self to use Vim exclusively for one job, from beginning to end. I kept watching similar videos to get over the nightmarish frustration that is anyone&#x27;s first week or so in Vim. But after that, I was completly hooked.<p>However, I still have warm feelings when I open some code in TextEdit. Black, 10px Monaco text over a 90 by 30 white background. Ah.
CalChrisover 8 years ago
This experiment applies to textbooks as well.<p>I looked over an old edition of Halliday+Resnick once, a well thought of lower division physics book. The text was substantially the same but it was black and white. This meant no <i>syntax highlighting</i> and also no glossy paper. The result was a LOT easier to read.<p>Glossy paper is a designery thing to do for deeper blacks but it&#x27;s less readable. Indeed that&#x27;s why actual designers like matte finish MBPs, because you don&#x27;t want to read with a 20% opacity of yourself staring at you.
kpilover 8 years ago
Ok, this thing with young developers going into grandfather-mode is starting to get old.<p>Acknowledge that it&#x27;s a hipster thing to use vi and fixed gear bikes, and carry on with your life.
yitchelleover 8 years ago
Coming from an age before syntax highlighting was a thing, I would hate for us to go back to it. I first saw it in Turbo C and it was amazing. This is another tool that we can use to give us better code quality.<p>However, some folks is pushing the syntax highlighting into realms of an art piece. I had a coworker that would using bold, italics, different font sizes, as well as colours.
aratnoover 8 years ago
I totally agree with this, and use `:syntax off`, but comments really mess with visual clarity. For dimmed comments, I sometimes switch to nofrils.<p><a href="https:&#x2F;&#x2F;www.robertmelton.com&#x2F;2016&#x2F;04&#x2F;10&#x2F;syntax-highlighting-off&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.robertmelton.com&#x2F;2016&#x2F;04&#x2F;10&#x2F;syntax-highlighting-...</a>
评论 #12886413 未加载
评论 #12886456 未加载
评论 #12886475 未加载
vbezhenarover 8 years ago
I don&#x27;t turn syntax off, but I hate rainbow in my IDE. I usually use bold for keywords, different colors for comments and string literals, underscore for class members (for Java). Basically that&#x27;s all. I don&#x27;t need any other highlighting, it&#x27;s just a noise for me which makes it harder to read the code.
评论 #12886592 未加载
jablanover 8 years ago
It probably goes well with typing on one of these horrible new Macbook keyboards - it makes you think twice before pressing each key, thus making your code even more thought-out and succinct.<p>As one of those programmers who were long ago forced to use no syntax highlighting (because monitors were monochrome), I say no thanks.
jugover 8 years ago
I think he may have a point, but I think there&#x27;s a minimal highlighting configuration that is helpful, yet not obnoxious: one where comments and constants are highlighted in their colors.<p>Comments are pretty much universally &quot;skimmable&quot; if what you want to get at is the code, and also completely unrelated to actual code (other than describing it), so I think they deserve their own color and that it is helpful. Also, conversely comments in their own color stand out from the code so that if you&#x27;re looking for descriptions, they are easier to find.<p>Colors also being useful for constant values (strings and numeric ones alike) because at least I really want something hard coded to stand out. Sometimes it should be hard coded, sometimes it shouldn&#x27;t, but pretty much always, what the hard coded content _is_, is of interest.
djhworldover 8 years ago
I don&#x27;t agree with the idea whatsoever, but I really like the minimalist design of the authors website.
Yaggoover 8 years ago
I do use syntax highlighting, but only with two additional subtle colors (one for literals, another for language keywords). Many editors come with themes resembling a decorated Christmas tree.
Rudismover 8 years ago
I&#x27;d argue that you could learn to read code carefully, understand what it&#x27;s doing, and write good code without losing the convenience of syntax highlighting.<p>Unless the color scheme you were using really was so garish that it hindered your ability to improve your skills as a software engineer, in which case you could probably find a more subtle color scheme that would give you the same benefits as turning it off did. I&#x27;ve heard great things about the solarized color schemes. I use wombat myself.
Kareeeeemover 8 years ago
Not sure about all the benefits and whatnot but I&#x27;ve learned to like &#x27;syntax almost off&#x27; better. I do want to differentiate between comments though. And vim adds some of it&#x27;s own colors to stuff like the linenumbers that I dislike.<p>So I use this. <a href="https:&#x2F;&#x2F;github.com&#x2F;Kareeeeem&#x2F;vim-walou" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Kareeeeem&#x2F;vim-walou</a><p>There&#x27;s more stuff like it but I wanted to pick my own gray values and dislike pure white on pure black.
rcarmoover 8 years ago
The Acme&#x2F;Plan9 folk were bullish on coding without syntax highlighting (and with proportional fonts). I spent a while trying to use Acme a couple of years back and agree that it&#x27;s not essential, but I switch programming languages so often these days (Python&#x2F;Go&#x2F;Clojure plus the occasional Java&#x2F;C#) that I need it to remind myself of what goes where in each language.<p>But I can see the benefit of forcing you to make your code more readable in general.
z3t4over 8 years ago
I only color comments and strings.
评论 #12886568 未加载
iKlsRover 8 years ago
My solution for half a year now, after years of a bajillion themes, it&#x27;s hard to go back, using a light theme with dark text works to an extent but I code mostly at night so I need a dark theme in general. Just use about 2 shades of grey and one other soft color. <a href="https:&#x2F;&#x2F;i.imgur.com&#x2F;FHALH2G.png" rel="nofollow">https:&#x2F;&#x2F;i.imgur.com&#x2F;FHALH2G.png</a> -- or search for Phoenix theme
dinhnvover 8 years ago
In my team, an old geek man also have told me about `syntax off`. I also have tried a couple of times. But it makes my eyes hurt cause of looking carefully at every word, tokens. Another thing I consider to build my workspace is &#x27;attractive&#x27;. Code with proper color highlight make it sexy to work with.
z0rover 8 years ago
syntax off, proportional width, (<a href="https:&#x2F;&#x2F;twitter.com&#x2F;rob_pike&#x2F;status&#x2F;567476552187641856" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;rob_pike&#x2F;status&#x2F;567476552187641856</a>), all code right aligned, ZWS for tabs
评论 #12889581 未加载
评论 #12886628 未加载
k__over 8 years ago
I have the feeling most of this isn&#x27;t a direct problem of syntax highlighting.<p>Most people simply highlight dumb stuff in their code.<p>For example, comments often have a bad contrast and stuff like brackets, curly braces or parathesis have high contrast.
baratover 8 years ago
Is there any example for this so-called conditional highlighting that we could take a look at ?
return0over 8 years ago
I thought broscience was supposed to stay in the gyms.
jowiarover 8 years ago
I think a large part of the issue with syntax highlighting is that our &quot;standard&quot; for syntax highlighting is rather dumb. A few thoughts:<p>- Who the hell would write prose by making all the verbs blue, the nouns red, and the adverbs green (or something to that effect). That&#x27;s what we do for code. Something togglable a-la iA Writer might make sense, though. At the same time, I can sort of understand, though, because we&#x27;re almost always in &quot;edit&quot; mode for code, very rarely in pure &quot;write&quot;.<p>- I find having lint-errors highlighted provides a similar nudge to the &quot;squiggly-red underline spellcheck&quot;.<p>- Our editors aren&#x27;t configurable enough with regards to typography. I like to use subtle weight changes, highlighting &quot;headings&quot; and whatnot, and very few tools seem to make that change available.<p>- Semantic highlighting seems super interesting, but I haven&#x27;t found a tool that I like yet.<p>One project I&#x27;d love to see is to get a bunch of folks together to do some proper layout-by-hand on code -- Given 100% control over typography, how would you format it to maximize readability, minimize distraction, highlight relevant contextual knowledge, etc? And then work to push tools in a direction that they support configuration to allow for said tasks.
评论 #12886483 未加载
评论 #12886579 未加载
评论 #12886486 未加载
评论 #12886686 未加载
评论 #12891905 未加载
评论 #12887988 未加载
ncauneiaover 8 years ago
Is disabling syntax highlighting the new standing desk?
doucheover 8 years ago
I like to take advantage of my tooling to make my life easier. Writing good code is difficult enough without imposing additional constraints upon yourself to make it more challenging.
评论 #12887832 未加载
评论 #12887834 未加载
draw_downover 8 years ago
No, no, no.