:syntax off (2016)
dudzik.co
dudzik.co
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.
It doesn't have to be all or nothing. There's a spectrum, with darcula on one extreme, and no highlighting at all on the other. You don't have be on either extreme of the spectrum, you can always settle for something in between.
Some of the most enjoyable coding I ever did was 2001-2003, when I wrote C using vim in a black-on-white xterm, with keywords underlined, string literals and comments in gray, number literals in bold ... and nothing else!
Even now, today, I remember more of that code that I wrote then, than anything in the almost 1-million lines since.
Vim can now be configured to use italic for comments, green for string literal, magenta for known format-strings within string literals, red for unknown format-strings within string literals, blue for function calls, etc ad nauseum.
Now I pattern match the colors without even reading the code in detail. I think it's time I tried a mono scheme again.
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.
I've come to realize that I like certain programming languages, not entirely because of any objective superiority, but because my brain works a certain way and those languages compliment it. There are languages that I just can't stand that others heartily enjoy. I could make objective arguments with evidence but someone whos brain works entirely different from mine is going to remain unconvinced.
My wife used to do a similar thing.
Since the "deep thought" look is very similar to the "annoyed" look, she thought she'd lighten the mood by sending me funny things to look at and then demand I go look at them, and then she'd get annoyed that I didn't react.
Sorry, honey, I'm juggling a mental model of multiple functions and classes. The Humor module is currently disabled.
Like you, I finally had to set the boundary. When I'm in hyperfocus mode, DO NOT DISTURB unless it's important and can't wait. Don't even ask me if I want something to drink. Your assistance is not needed.
And yep. I like color. You don't. I'm glad we both have the options we like!
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!
This is a syntax error and ought to be highlighted with a red squiggly line or something.
The only essential syntax highlighting is syntax highlighting for (certain types of) comments because otherwise you might easily run into situations where they are impossible to distinguish from actual code.
That is what I am doing. Highlight comments. All else no highlighting. Looks extremely aesthetically pleasing to me
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.
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 [1]: https://www.youtube.com/watch?v=YnWpuoWzEj0 [2]: https://www.youtube.com/shorts/loLLjjRBK-k [3]: https://www.youtube.com/watch?v=tgc1045AsMA [4]: https://www.youtube.com/watch?v=3BYKiOHdCNg
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.
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...
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.
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.
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.
One thing clang-format ruined for me is when I laid code out in the same indentation as the JSON it was generating.
E.g.
json
.startObject("root")
.startArray("data")
.insert(1)
.endArray()
.endObject();
became json
.startObject("root")
.startArray("data")
.insert(1)
.endArray()
.endObject();I apply zero customization to it.
If rustfmt thinks the code should be formatted some way, so be it.
I have other things to spend my energy on, unrelated to any particular formatting choices.
Some people also said "just accept it" and that's part of why I ditched it. If it can be helped I do not accept it. This is not limited to code formatters, I want to have control over the things I personally use. I want to be comfortable doing my stuff.
* applying recurring visual patterns
* writing less convoluted statements
* keeping my files short and concise
I agree, but I can't stand it when the formatting is applied while I'm typing. I prefer to run it through a prettifier afterwards as a separate step.
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
not quite what you desire, but certainly better than plain syntax highlight
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.
I do actually highlight some things; for example, method declarations to make them easier to scan for.
I still highlight trailing spaces in bright red, but otherwise it's (nearly) white text on a black background.
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.
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
If anyone is interested let me know and I will focus on open sourcing the color scheme this weekend.
(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)
I've heard this argument before and I just can't say that I share the experience.
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_...
Which was also covered on Hackernews:
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.
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)
Comments are probably an obvious choice, the reason for literals are mostly for strings and format strings.
I really can't stand things like italics in my code.
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.
I really like Alabaster BG, but sadly VS Code lacks support to implement it.
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?
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.
[†]: 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.
Autocompletion doesn't need to be braindead. 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.
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.
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.
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?