Live data from Hacker News

Show HN: GitHub style split diffs in your terminal

github.com

41–50 of 53 posts

Re: Show HN: GitHub style split diffs in your terminal

#41
post #24

When I find myself wanting a split diff in the terminal, I tend to gravitate towards just using Vim’s built in diff mode via vim-fugitive. I even have some git aliases that will open vim and and show fugitive diffs for every file changed on the current branch. The I like this over fancy CLI diff viewers for a handful of reasons: - It re-uses my editor config (no need to fuss with that tools ad hoc config format) - I…

You and I have similar setups! I love it, but there's one thorn that I've not been able to figure out yet. Have you (or anyone reading this) been able to figure out how to get diff-highlight to be more intelligent so that if 'foo' changes to "foo", the highlighter is smart enough to only highlight the quotes as changing, but not the word foo? (Though this example is trivial, any time you've got two changes on the sam…

You can't configure diff-highlight to do that. It 'will find the common prefix and suffix of two lines, and consider everything in the middle to be "different".' [1]

To highlight only the quotes as changing, you need something else. On (Neo)Vim, for example, vim-gitgutter does this [2] (I'm the author).

[1] https://github.com/git/git/tree/master/contrib/diff-highligh... [2] https://github.com/airblade/vim-gitgutter/blob/master/autolo...

Re: Show HN: GitHub style split diffs in your terminal

#44

Earlier quoted context omitted.

I think a big problem with the node ecosystem is the lack of standard library. When I'm developing on PHP, Python, or go, they have a vast standard library that means the likelihood of me using a third-party package is relatively low for the most mundane stuff. Comparing that to node, and you'll need to use an npm package for just about anything. This automatically gives you a much larger attack surface. If I underst…

Definitely a valid counter-point. I'm sure for that and several other reasons, the Node package ecosystem is probably indeed the riskiest of the set. But it's still really foolish for the parent just immediately turn their nose in disgust simply at the sight of a package.json file. Or to say "When I depend on a library A in say Python I can be reasonably sure that it won't download and execute random shit from Intern…

You totally misunderstood my point. I wasn't talking about backdoors or supply chain attacks. When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function. The problem is that this is generally acceptable in nodejs/NPM ecosystem. In other words, the gap in dependency hygiene between nodejs/NPM and other ecosystems is huge, and users of it seems not to bother.

Re: Show HN: GitHub style split diffs in your terminal

#45

Earlier quoted context omitted.

Definitely a valid counter-point. I'm sure for that and several other reasons, the Node package ecosystem is probably indeed the riskiest of the set. But it's still really foolish for the parent just immediately turn their nose in disgust simply at the sight of a package.json file. Or to say "When I depend on a library A in say Python I can be reasonably sure that it won't download and execute random shit from Intern…

You totally misunderstood my point. I wasn't talking about backdoors or supply chain attacks. When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function. The problem is that this is generally acceptable in nodejs/NPM ecosystem. In other words, the gap in dependency hygiene between nodejs/NPM and other ecosystems is huge, and users of it seem…

>When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function.

Can you give an example?

I'm aware of the banner thing, but I think that was only a few projects, and that's something else entirely.

Re: Show HN: GitHub style split diffs in your terminal

#46

Earlier quoted context omitted.

You totally misunderstood my point. I wasn't talking about backdoors or supply chain attacks. When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function. The problem is that this is generally acceptable in nodejs/NPM ecosystem. In other words, the gap in dependency hygiene between nodejs/NPM and other ecosystems is huge, and users of it seem…

>When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function. Can you give an example? I'm aware of the banner thing, but I think that was only a few projects, and that's something else entirely.

See the link in my original post. The other things I'm aware of are ridiculous behaviors of npm packages, like create-react-app, which feels the right thing to do is to spawn my $EDITOR when it sees exception in the log (which it hides), except that the whole terminal session freezes because vim and create-react-app fight for the tty. And there are other things where authors pull in insane amount of dependencies to log in their own colorful fancy way.

But then again, I'm not that well versed in nodejs to judge by that experience alone. As I said in the middle, I'm not trying to dismiss author's work. I'm sorry for the tone of my previous replies. This comment thread I spawned is also very off-topic.

Re: Show HN: GitHub style split diffs in your terminal

#47

Earlier quoted context omitted.

>When I say that a dependency downloads and executes random shit from Internet I meant it as a behavior intended to fulfill its function. Can you give an example? I'm aware of the banner thing, but I think that was only a few projects, and that's something else entirely.

See the link in my original post. The other things I'm aware of are ridiculous behaviors of npm packages, like create-react-app, which feels the right thing to do is to spawn my $EDITOR when it sees exception in the log (which it hides), except that the whole terminal session freezes because vim and create-react-app fight for the tty. And there are other things where authors pull in insane amount of dependencies to l…

>See the link in my original post.

>Over a year ago, I was investigating using Prisma to be the ORM for a GraphQL API of a Postgres database. When doing a proof-of-concept, I discovered that under the hood @prisma/client was spinning up it's own GraphQL server that it would send requests to in order to generate SQL to send to postgres. This extra middleware layer between my frontend code and postgres generated some pretty poor performing queries that took 50% longer to complete than the queries generated by using Hasura as our whole GraphQL API.

Doesn't seem like it's worth writing off Node/JavaScript/NPM just due to this large project making a questionable design decision

>like create-react-app, which feels the right thing to do is to spawn my $EDITOR when it sees exception in the log (which it hides)

Just seems like it's Facebook's problem. I wouldn't be surprised if there's some Python package out there that does something similar. There's nothing inherent about JavaScript that makes this more likely to happen. Maybe there's something inherent about the community, but I'd really need to see a thorough empirical analysis of packages across a lot of languages before I start making judgments about that.

It might be worth making fun of a particular package if they pull in way too many other packages, but it's still all a case-by-case evaluation.

I personally strongly dislike JavaScript and much of its ecosystem, myself; it's just the kneejerk pattern-matching reaction that I thought was unwarranted.

Re: Show HN: GitHub style split diffs in your terminal

#48
The diffs look beautiful. One suggestion to the author be to bundle this as a self-contained binary. This would have a huge impact on whether I want to install it.

For this, I would look into Deno, which supports self contained binaries with typescript. I've never tried it myself so not sure how much work this would be.

Re: Show HN: GitHub style split diffs in your terminal

#49

Earlier quoted context omitted.

You and I have similar setups! I love it, but there's one thorn that I've not been able to figure out yet. Have you (or anyone reading this) been able to figure out how to get diff-highlight to be more intelligent so that if 'foo' changes to "foo", the highlighter is smart enough to only highlight the quotes as changing, but not the word foo? (Though this example is trivial, any time you've got two changes on the sam…

You can't configure diff-highlight to do that. It 'will find the common prefix and suffix of two lines, and consider everything in the middle to be "different".' [1] To highlight only the quotes as changing, you need something else. On (Neo)Vim, for example, vim-gitgutter does this [2] (I'm the author). [1] https://github.com/git/git/tree/master/contrib/diff-highligh... [2] https://github.com/airblade/vim-gitgutter/b…

Thank you! I’ll check it out. I appreciate it!

Re: Show HN: GitHub style split diffs in your terminal

#50

Earlier quoted context omitted.

You and I have similar setups! I love it, but there's one thorn that I've not been able to figure out yet. Have you (or anyone reading this) been able to figure out how to get diff-highlight to be more intelligent so that if 'foo' changes to "foo", the highlighter is smart enough to only highlight the quotes as changing, but not the word foo? (Though this example is trivial, any time you've got two changes on the sam…

You can't configure diff-highlight to do that. It 'will find the common prefix and suffix of two lines, and consider everything in the middle to be "different".' [1] To highlight only the quotes as changing, you need something else. On (Neo)Vim, for example, vim-gitgutter does this [2] (I'm the author). [1] https://github.com/git/git/tree/master/contrib/diff-highligh... [2] https://github.com/airblade/vim-gitgutter/b…

gitgutter is amazing, btw. thank you.
Post reply on HN