6 ms·
:syntax off (2016)
- deleted 3y ago[deleted]
- hellcow 3y agoI turned it off as an experiment ~10 years ago and haven't needed it since. Like the author, it was jarring at first, but then I grew to prefer it. I still highlight trailing spaces in bright red, but otherwise it's (nearly) white text on a black background.
- chrislan815 3y agohmmmm never have i thought about turning syntax off... do you also turn off autocomplete?
- JohnFen 3y agoI always have autocomplete turned off, because I find it gets in my way even more than syntax highlighting.
- hellcow 3y agoI also have no autocomplete. I don't want the distractions/popups when writing code and getting into deep focus. When I want to autocomplete a long name, I trigger it by hand using Ctrl+p.
- chrislan815 3y agoi like the idea of trigger it by hand.
- pandemic_region 3y agoInteresting, what language do you code?
- hellcow 3y agoGo, Typescript, Zig, Python.
- samatman 3y agoAutocomplete is right on the verge of being a net drain on my productivity and I've turned it off out of pique more than once. It will "randomly"† replace words, and the box obscures text, which greatly pisses me off if I happen to be reading that text. [†]: Obviously this isn't actually random, it's just hitting a key which tab-completes when I don't expect it to. But it feels random and takes me out of flow. Syntax highlighting, on the other hand, I was memed into trying to code without it, and I hated it. I suspect, like many things, there are a minority of neurotypes for whom turning it off is better, and a majority who prefer it for good reason.
- marcosdumay 3y agoOh, I imagine you are using some editor created by the kind of genius that invented autocompletion on space or on enter. Those are at their best when they decide that what you write is just a hint, to be match by proximity instead of literally. Autocompletion doesn't need to be braindead. Unix terminals have had it for decades, and I have never seen anybody complain.
- JohnFen 3y ago> Unix terminals have had it for decades, and I have never seen anybody complain. Probably because you don't see the autocomplete there unless you specifically ask for it. This is a world apart from editors that automatically pop up autocomplete options. Those are an unwelcome distraction. If Unix shells behaved like that, I'd strenuously object.
- lelanthran 3y ago> Autocompletion doesn't need to be braindead. I wouldn't go so far as "brain-dead", but it is an annoyance, because I am looking at the screen when I am typing, and the lines below and lines above are context that I can easily retriever without needing to store them in my head. When the autocomplete window pops up it obscures the context above and below the line I am on, and in turn my context switches instantly from (for example) "Use the results of the previous operation as a parameter to this function" to "what was the name of the variable that I used for 'results' on the previous line? I can no longer see the previous line". For me, I think, an autocomplete would be best if displayed off to the side, in a consistent spot that never changes. Maybe reserve a small box on the right hand side of the editing window for things that constantly change on every keystroke. This has the advantage of being able to ignore it, and only switch my gaze (and hence my context) when I actually want to read what it is displaying.
- TrueDuality 3y agoI used more or less a bare vim (not minimal, not neovim) config with no plugins and < 100 lines in my vimrc for about 5 years. Minimal syntax highlighting, zero popups or autocomplete, no jump to definition, etc. It wasn't intentionally by choice, I remember getting frustrated with some interaction between a couple of plugins and resolved to start from a clean slate and carefully configure and curate my config. The clean slate happened but the subsequent configuration never did. I got used to it pretty quickly and it forced me to keep more of the code base in my mental RAM at any point in time. That still resulted in quite a bit of hunting around, slower refactors but I was thinking about the code quite a bit more. I finally started using a much more feature rich environment and while I'm glad I did the long stretch without it, I even feel I benefited from it, I don't think I could go back. For autocompletes specifically I do find the immediate suggestions annoying even when I can type right through them. I have no idea how people work when they have to pause their coding to actively dismiss suggestions either via the mouse or through a keyboard shortcut. For the time being my autocomplete suggestion window is a key combination to even display for a single instance and no additional actions need to be taken unless I want to accept the suggestion (I can still type right through it). I'm sure everyone's mileage will vary but autocomplete feels significantly more intrusive to me than syntax highlighting.
- marssaxman 3y agoI disable autocomplete, brace matching, suggestions, hints, and every other feature which pops something up or moves the highlights or causes a flash in the editing pane, because I can't stand the distraction. Opening up a factory-configured installation of VSCode, with all of its automatic helpers turned on, feels about as disorienting and off-putting as browsing the web without an adblocker.
- kstrauser 3y agoI couldn't do it. 1. I appreciate having instant feedback if I've mistyped the number of closing quotes, brackets, or parenthesis. If everything below line 100 is displayed in the color for strings, I know what mistake I made there. 2. The color is visually appealing to me. I stare at my screen for 8+ hours a day, or more if I'm working on a hobby project. I like it to look pretty. It makes reading code more enjoyable for me.
- LanternLight83 3y agoBoth points resonate with me, but I'd push back againt the idea that colored syntax highlighting is neccessary for either. I'm thinking of the Pygments 'bw' theme[1], which denotes strings in italics, and nano-emacs[2], which also manages to do.. a lot with a little (at least aesthetically, ie. idk about code volume or corner cases). 1: https://pygments.org/styles/ https://pygments.org/styles/ 2: https://github.com/rougier/nano-emacs https://github.com/rougier/nano-emacs
- kstrauser 3y agoFair points. Those both highlight syntax with type choices instead of color, so you're still getting a lot of the benefit but in black-and-white. I think I'm personally more likely to quickly suss the difference between black text and yellow text than between regular and italics, so I wouldn't personally use that approach. I appreciate that there are choices, though!
- b112 3y agoIt makes reading code more enjoyable for me. This is the joy of uniqueness. For me, colour is beyond annoying on text. I loath it, yet would never want your colours removed! I worked for a guy who thought he was "helping" by barging in and distracting me, whenever he saw me in deep thought. I finally confronted him on it, and he thought this helped the creative process! OK great! I think through a mega-complex problem, anticipating possible issues with furture use of my code, security issues, or if people use the API wrong, and in barges the guy 70% of the way through a thought process and starts blathering on about something irrelevant. Sure, I guess ot helps HIM become creative, but it just wastes my time and is highly annoying, and does nothing for me. Except perhaps engender mistakes. Letting others work as they do best, is pivotal to success. So please all people who have read this far, colour is great, but also no colour is too.
- dingnuts 3y agoidk man, I remember graduating from writing my HTML in Notepad to HotDog and being blown away by the syntax highlighting and I never looked back I've heard this argument before and I just can't say that I share the experience.
- ponyous 3y agoReally interesting and this inspired me to build my own color scheme that focuses on the control flow and is much less of a rainbow than traditional color schemes. For example, function calls, ifs, returns, ... are all white and bold. The rest of the code is less prominent. Often colour schemes can be there "just" to reaffirm the structure of the code. If I ask one of my friend devs "what does green mean in your editor?" they won't know the answer until they look at the code. In my colour scheme you know that white and bold changes the flow of the code and requires more attention. Type checking, linters and formatters take care of semantics. Ie. I don't need a string and number colored differently, because type checker will tell me it's not right. I already open sourced the treesitter queries that enable the control flow color schemes in neovim: https://github.com/meznaric/nvim-controlflow-queries https://github.com/meznaric/nvim-controlflow-queries If anyone is interested let me know and I will focus on open sourcing the color scheme this weekend.
- mst 3y agoIIRC elvis' hilighting works similarly, I remember that being pretty much the only synhi I've encountered in an editor that I didn't end up turning off with extreme prejudice. (I find I can skim code more easily when I can think about the structure at different levels - block, function, statement, expression etc. - and I find that for me, syntax hilighting often makes that harder and slower ... but "for me" is definitely load bearing in that statement)
- thechao 3y agoI use "print mode" syntax highlighting which is just bold, italics, and (rarely) underline, or some combination of those. It's a habit I picked up when I had one PI who was severely red-green color blind, and another who had mild yellow-blue issues.
- frankjr 3y agoI could never turn it off completely but I do sometimes use the Acme theme during the day (it's too bright in the evening), which highlights just comments, strings, and errors. https://github.com/helix-editor/helix/wiki/Themes#acme https://github.com/helix-editor/helix/wiki/Themes#acme
- rphln 3y agoThere's also the Alabaster variants [1], which includes a dark theme. I really like Alabaster BG, but sadly VS Code lacks support to implement it. [1]: https://github.com/tonsky/sublime-scheme-alabaster https://github.com/tonsky/sublime-scheme-alabaster
- KingMob 3y agoIs there any evidence for or against this? Or is it just vibes?
- Sohcahtoa82 3y agoPersonal preferences don't require evidence.
- KingMob 3y agoI'm not telling the author what to do; I'm asking for the rest of us if there's any evidence one way or the other.
- Sohcahtoa82 3y agoYou're still asking for "evidence" for something that's purely a personal preference. I mean, I suppose you could argue that the article states that disabling syntax highlighting made him a better programmer, but asking for evidence that it actually did is silly. It's difficult, if not impossible, to truly measure how good a programmer is.
- KingMob 3y agoI'm not asking for evidence about the author. I'm asking, is there any scientific research into the matter in general? If there was any research on the matter, it wouldn't be "purely a personal preference". If the author had data about their personal productivity, they would probably have mentioned it in their blog post, no?
- kevincox 3y ago> I was structuring my source better; I was applying recurring visual patterns This doesn't actually seem optimal. You lost a source of information so you are changing your coding style to compensate. The other changes mentioned seem positive in isolation, but this one just seems to be compensating.
- refactor_master 3y agoAgree. You can definitely tell which parts our code base was written in vim, as compared to a full bells-and-whistles editor. I’m sure they can achieve the same in theory, but in practice it turns out the IDE solves a need that the terminal doesn’t quite.
- samatman 3y agoI will prefer to stick with syntax highlighting, thank you. It's to most people's taste, but not everyone's, probably worth trying it both ways to see which category you actually belong to. I do wish an editor (heh) had added Gary Bernhardt's ideas[†] about multiple sorts of syntax highlighting for different purposes. Specifically, highlighting only variables as to the scope they belong to, another nice one could be highlighting pure and effectful function calls differently. Or highlighting the names of modules/packages/whateverthelanguageuses in distinct colors at the top of the file, then using the same color for every name which came from that package, underlining imports which aren't being used. I would cycle through such a collection rather frequently, I suspect. [†]: https://www.destroyallsoftware.com/talks/a-whole-new-world https://www.destroyallsoftware.com/talks/a-whole-new-world
- kartoshechka 3y agoyou should set up semantic token highlighting together with highlight on cursor hold for your language of use, former is usually a feature of language server, latter should be out of box behavior in modern ides not quite what you desire, but certainly better than plain syntax highlight
- wrs 3y agoSyntax highlighting is nice, but it’s gone way overboard with 31 different categories. I’m not as minimalist as the OP, but I leave on just enough to tell if my strings are delimited, notice if variables are misspelled, and make sure I don’t miss a comment. I don’t need the editor to tell me that “if” is a keyword by lighting it up! If I have a philosophy, it’s to put the language in the background and the significance in the foreground.
- _gabe_ 3y agoIt is putting the significance in the foreground. An if statement is a semantic part of the language. Highlighting that is calling out that there is a higher level of programming going on there than a sequential list of instructions. No programmer needs the keyword “if” to be highlighted to know what it means. Also, how does having strings highlighted put significance in the foreground? The only thing it will show you is if you missed a delimiter. It doesn’t call out parts of the program that do something noteworthy.
- wrs 3y agoI don’t “highlight” strings by making them fluorescent green or something. I do put them in a couple of different, same-valued colors so it’s obvious when they aren’t lexing the way I expect (like the variable substitutions aren’t actually substitutions because I forgot to use ` or f”). I do actually highlight some things; for example, method declarations to make them easier to scan for.
- eterm 3y agoImmediately this sounds wrong to me, because even talking of "re-arranging my code" is something that should be avoided. Let auto-formatters format. This is especially important in team situations where formatting enforced via editorconfig will keep merge conflicts to a minimum. Even working solo having a forced style will keep code consistent and remove distracting unimportant changes from refactors. Define a style, have tooling enforce it.
- delichon 3y ago> ...even talking of "re-arranging my code" is something that should be avoided. Why? I find a well organized code file to be easier to read, e.g. grouped together constants, related declarations, class methods, instance methods etc. And to display those groups in some common order so it's easy to find them. An auto-formatter would have to have deep knowledge of intents to do that automatically.
- leduyquang753 3y agoSometimes there are situational choices that autoformatters cannot comprehend. I also failed to make formatters follow the style choices I use, they were just not configurable enough.
- kstrauser 3y ago> Sometimes there are situational choices that autoformatters cannot comprehend. I haven't stumbled across that. Could you give an example? > I also failed to make formatters follow the style choices I use, they were just not configurable enough. That's kind of the whole point. I love, love, love Python's Black formatter. In my opinion, it chose the wrong default for quoting strings (i.e. it re-writes single quotes as double quotes), which irked me until I gave up and accepted it. In return, I no longer have to put up with my coworkers' insane style choices, just as they no longer have to tolerate mine. With a single addition to our CI pipeline, the days of dumb arguments about the "right" way to format our code came to an end.
- codetrotter 3y ago
- jthemenace 3y agoGood for you, glad you found some value in it. However, that's a no from me dawg. I'm waaaaay too accustomed to all of the niceties that modern syntax highlighting and LSP provide. I'm so certain that it's a huge step back for me that I won't even try it.
- mst 3y agoQuite a few people think that until they -do- try it and then find it has its advantages. I know of a number of people who made the deal with themselves "I'll try it for a week/month and then see what I think" - I think over half went "well, that was interesting" and turned it back on, but a surprising (to me, a no-synhi preferring person who thought I was rarer than that) number switched to either "hilighting only for languages I'm unfamiliar with" or "no hilighting at all." I don't recall anybody regretting trying the experiment. (that's not to say you -should- try it, but I do think your certainty that you'd get nothing at all out of doing so may be misplaced)
- jraph 3y agoInteresting. Wouldn't linters help get the benefits (simpler code) without the drawbacks (of making the code harder to read), and also somewhat enforce the rules you like?
- camel-cdr 3y agoI personally only use syntax highlighting for comments and literals. Comments are probably an obvious choice, the reason for literals are mostly for strings and format strings.
- karmakaze 3y agoI used to dislike syntax coloring while coding. It's fine for reading/reviewing. Now with great improvements in displays, fonts, and IDE themes, I quite like it. It's subtle enough to be visible if you care and not loud when you don't. I still don't like color in my command-line terminals though. The only place I regularly use it is for `git log` with a custom formatter. Maybe it's because I like my terminal font small (lots of reading logs) and colored text isn't as good very small. I also find differing vibrant colors to focus in different perceptual planes adding to eyestrain.
- ryanolsonx 3y agoI love coding with syntax highlighting off. The signal from linters or other code analyzers ends up jumping out more when other things aren't highlighted.
- block_dagger 3y agoWhen you have to read a lot of software (staff engineer, architect, etc), code coloring helps immensely with getting a “feel” for a block of code quickly. It’s an indispensable time saver and if you don’t use it, you’ll be outcompeted.
- ryanolsonx 3y agoAs a staff engineer that reads a lot of code, I go without syntax highlighting. Things are just fine.
- brianaker 3y agoWith vim you can restrict syntax highlighting by scope and/or folding, limelight.vim provides a good example how to implement this.
- ryanolsonx 3y agoFor VS Code users, I have a collection of themes without syntax highlighting https://vscodethemes.com/e/ryanolsonx.distilled/fogbell?language=javascript https://vscodethemes.com/e/ryanolsonx.distilled/fogbell?lang.... Some are rough around the edges, but right now I'm using my port of Fogbell and enjoying it.
- worksonmine 3y agoI do something similar but with a monochrome theme. Comments are faded, values are highlighted and everything else is in normal color. Makes it very easy to quickly scan the code and understand what's going on, I think the context is less important but easy to see when needed, if it's an int or float is usually obvious simply by looking at the value.
- secondcoming 3y agoThe pinnacle of syntax highlighting was VB6 where comments are green and keywords are blue, and you had no choice. I really can't stand things like italics in my code.
- MarkusWandel 3y agoAs an old-school guy who can touch type quickly, I absolutely hate autoindent, automatic closing curlies, syntax highlighting, and even particularly the temporary jump to a partly typed search string, highlighted and all, until you cancel the search and zap, you're no longer there. It is possible to work without all that stuff, and once the habit is formed, it is sticky. I fully understand that most people now are habituated the other way, and plain editing would feel strange.
- Linux-Fan 3y agoOf all the features that you have listed, I use only the syntax highlighting. I have never tried to turn it off for longer than a few minutes when it worked. When it is broken (e.g. wrongly coloring stuff) I sometimes turn it off, but this is usually not long enough to find out if I am really better without the colors. Turning off the syntax highlighting is still one of the things that I would like to try out some day...
- ryanolsonx 3y agoWhy do you hate autoindent? Have you seen issues with autoindent while developing? Vim `set autoindent` works well when configured with how you do tabs for a given language (ie `set sw=2 sts=2` for JavaScript)
- MarkusWandel 3y agoHabit! My original point, once you're habituated, it's much more natural to type an indent than to delete an automatically generated one because you want to go back one indent level, say for a closing curly brace. This just interferes with the "flow".
- ryanolsonx 3y agoI can see your point. Thanks.
- deleted 3y ago[deleted]
- JohnFen 3y agoI always turn syntax highlighting off, because I find it very distracting and it often makes code harder for me to read, without giving me any meaningful benefit.
- kazinator 3y agoSometimes I have to :syntax off when going through some 16 color terminal where the comments turn such a dark blue that they are unreadable.
- ryanolsonx 3y agoIf you've never seen anyone work with syntax highlighting off, there are some YouTube videos that inspired me to try coding with syntax highlighting off: 1. "Hacking with Andrew and Brad" - Andrew Gerrand (previously on the Go core team) uses Vim without syntax highlighting.[0] 2. "Advanced Embed With Go Generate - Andy Walker" -- this guy uses bold/italics/few colors in his editor. Interesting visual on how you can use font to show different aspects of the code.[1][2] 3. "Visual Studio Code, No Syntax Coloring, Go Fonts" [3] 4. "stb programming FAQ" - Sean Barrett answers why he uses VC6 and why his syntax highlighting is so minimal.[4] [0]: https://www.youtube.com/watch?v=1rZ-JorHJEY https://www.youtube.com/watch?v=1rZ-JorHJEY [1]: https://www.youtube.com/watch?v=YnWpuoWzEj0 https://www.youtube.com/watch?v=YnWpuoWzEj0 [2]: https://www.youtube.com/shorts/loLLjjRBK-k https://www.youtube.com/shorts/loLLjjRBK-k [3]: https://www.youtube.com/watch?v=tgc1045AsMA https://www.youtube.com/watch?v=tgc1045AsMA [4]: https://www.youtube.com/watch?v=3BYKiOHdCNg https://www.youtube.com/watch?v=3BYKiOHdCNg
- wduquette 3y agoHeh. When I started programming, there wasn't any such thing as syntax highlighting. I jumped on it as soon as I could, and I'd hate to live without it. On the other hand, I turn off a lot of the weird little insets my IDE likes to put into the editing window as though they were part of the source code. I don't like having the lines of code jumping around as I move the cursor.
- pmdulaney 3y agoI turn off syntax highlighting for perhaps an unusual reason. I've fine-tuned the font and background colors I use in vim, and when syntax highlighting is activated, the fonts hurt my eyes.
- bitwize 3y agoIt's cool to see other hackers "switch off the targeting computer". I used Emacs for a while with $TERM set to vt100, which masked much of the highlighting. To this day I don't use autocomplete, because I don't want a video game popping up in my FOV while I'm coding; and because using the full name of classes, functions, and methods helps me remember them better and how they fit together. I have this idea that IDE features are designed to make programming more normie-friendly and approachable; and that neurodiverse hackers like myself, who used to predominate back in the 70s and 80s, just find them distracting. There's probably some neurodiversity specificity in there, but recently the idea got some support from this study: https://link.springer.com/chapter/10.1007/978-3-031-35017-7_9 https://link.springer.com/chapter/10.1007/978-3-031-35017-7_... Which was also covered on Hackernews: https://news.ycombinator.com/item?id=36721055 https://news.ycombinator.com/item?id=36721055 I keep dreading the day when I finally have to switch to Visual Studio Code, either because work requires it or there's just no longer adequate tooling in anything else. I will be completely at sixes and sevens compared to Emacs or even vim.