Live data from Hacker News

Linux Terminal Goods

diego-pacheco.blogspot.com

21–30 of 65 posts

Re: Linux Terminal Goods

#21

some vim enthousiast here scalded me for sending him spacevim linkand told me to use neovim. i don't use vim so i wouldn't know, and vim people seem easily offended :D. anyhow, just thought i'd not his input.

“Hey you like Jehova, right? I’ve been told this Jesus guy is pretty cool, I wouldn’t know myself to be honest but maybe you’d like him?”

Re: Linux Terminal Goods

#22
Regular vim has tabs and you can bind any key you want to switching them (I use F2/F3). The default is :next and :prev or gt/gT. I’ve been using the feature for years now.

You can also open a list of files in separate tabs with the -p argument. So “vim -p CppFile.*” will open the .h and .cpp in separate tabs for example. You can then Y/p between the two buffers.

It’s so useful that I always “alias vi=vim -p” in my .profile.

Re: Linux Terminal Goods

#23
Maybe I'm completely missing the point of `bat` but I usually just use `view` (vim/neovim in readonly mode) if I want to read files with syntax highlighting, GitGutter, line numbers, etc.

Re: Linux Terminal Goods

#24

I spend loads of time in a shell. One day I'll push my full dotfiles publicly, but until then here's a few snippets I've found super handy. I'd advise against using them verbatim but there's a few things in there that took some time to figure out. Beware they can be somewhat buggy / break things though. Highlights include: - Bind C-c/C-v to Copy/Paste, bind C-g to sigterm (Note: Breaks docker interactive unless you m…

Inspired by a colleague, I wrote this (for bash):

https://gist.github.com/archi/2a2331401842c0548fa8de0f69796f...

> up 4

go up 4 folders (=> "cd .." 4 times).

> up

goes up one folder, and you can repeat pressing ENTER to go up one more. Press anything else to drop back to the shell.

Could probably be "better" (e.g. no subshells), but works well for me.

Re: Linux Terminal Goods

#25
post #19
post #15

Earlier quoted context omitted.

I guess it's like anything programming related. Things don't make sense until they make sense. Bash's syntax is a bit rough at times and I often find myself having to Google things even though I know what I want to do at a conceptual level. But the real magic isn't just Bash alone. It's combining it with Unix tools to pipe together programs to solve problems. I guess at the end of the day no one has tried to fix it b…

The real advantage it has is simply that it’s there, always . It enjoyed a network effect a long time ago and is now so entrenched that challengers have a mountain to climb - entire generations of professionals know how to get stuff done with it and expect it to be there from the start, so any system that goes with an alternative is at an immediate disadvantage. A few OSes are trying to push what are effectively incr…

> The real advantage it has is simply that it’s there, always.

Yes, this is a huge deal in a good way. It's also why standalone zero dependency Python scripts are so successful since most systems have Python installed by default.

Although after reading your first sentence, I got excited. I thought you were going to write about how it's always there in the sense that if you're working in the terminal, Bash and friends are always right there at your finger tips. There's no context switch to get something done, which is super empowering for hacking together things to solve a problem. It just feels like the whole terminal environment in general was made to let tinkerers create the best possible system / workflows for them personally.

Re: Linux Terminal Goods

#26

Maybe I'm completely missing the point of `bat` but I usually just use `view` (vim/neovim in readonly mode) if I want to read files with syntax highlighting, GitGutter, line numbers, etc.

Bat works the same way as ls when it's being piped. But it has better default features than cat, the syntax, numbers and the pager. if the file doesn't fit the screen, it becomes paged, so you don't have to do the whole: `cat file.txt` (too big), `view file.txt`

Re: Linux Terminal Goods

#27

Maybe I'm completely missing the point of `bat` but I usually just use `view` (vim/neovim in readonly mode) if I want to read files with syntax highlighting, GitGutter, line numbers, etc.

Not sure if view lets you do this but bat will switch off highlighting if you are piping output `bat file.txt | grep ...`. This makes it easy to make an alias cat=bat and have everything work. Also you can make bat display output with `less` and then line numbers can be toggled, not sure about gitgutter.

Re: Linux Terminal Goods

#28

I spend loads of time in a shell. One day I'll push my full dotfiles publicly, but until then here's a few snippets I've found super handy. I'd advise against using them verbatim but there's a few things in there that took some time to figure out. Beware they can be somewhat buggy / break things though. Highlights include: - Bind C-c/C-v to Copy/Paste, bind C-g to sigterm (Note: Breaks docker interactive unless you m…

I agree with powerlevel9k. i still have marginal enjoyment from the fiddly things thought and i've switched to powerlevel10k [1]. Its noticeably faster and the default settings are minimalist enough for me. does not fix the fact that you need to install fonts which I can't get working on some terminals (urxvt).

[1] https://github.com/romkatv/powerlevel10k

Re: Linux Terminal Goods

#30
post #9
post #7

I've just skimmed around it as someone who repeatedly need that kind of book to achieve little things in bash. I understand bash is the basis of so many things, that its importance is just enormous. But at the same time, I'm appalled by its syntax, idioms, etc. It's barely readable for the casual reader that I am. I wonder why nobody tries to provide a meaningful alternative. I've seen some (in python for example) bu…

Generally if you're trying to do something that feels like a "program" in shell script, rather than loosely gluing existing tools together, the threshold for moving it into Perl or Python should be low. Even things like trying to get the quoting right for lists of files some of which may have spaces in their names is fiddly enough to drive people to writing a "proper" program. (or was this comment intended for https:…

The moment I have to use arrays in bash, I open up a python interpreter. Syntax makes far more sense than in bash.
Post reply on HN