Live data from Hacker News

Linux Terminal Goods

diego-pacheco.blogspot.com

51–60 of 65 posts

Re: Linux Terminal Goods

#51

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 .p…

Is the '-p' necessary? I like to open files in windows with e.g. "vim -O file1 file2", and I've noticed that if I accidentally omit the '-o' or '-O', it opens each file in a tab. Or at least, it opens each file in individual pages that you navigate between with ':next' / ':prev'.

The -p gives you a tab for every file opened. If you don't provide it, it still opens them and you get a buffer for each one, but it doesn't open any tabs. If you still get tabs even if you don't provide it, maybe you have a vim plugin that's doing that.

Re: Linux Terminal Goods

#52

i really wish spacemacs didn't have that pretty lame loading screen, as a spacevim devotee i found alot of things that spacemacs does that specifically address some issues i have with spacevim. i know the correct path forward here is, of course, diving into the guts of spacevim and tinkering until it works for me, but i will post one quirk as it will probably be some time before i will be able to write my own compreh…

What about the loading screen do you dislike? I believe you can change the default after it loads up(and you generally want to be using a daemon in the background with Emacs so it’s a first time run thing mainly anyway)

Re: Linux Terminal Goods

#54
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…

I would highly suggest checking out Powershell. It works great on windows and linux, its object oriented, and it has all sorts of "networked" capabilities built into it to. For example, say you want to get the disk space on your own computer: Get-WmiObject Win32_LogicalDisk

If you want to do that on a remote machine you just add this to the end of the command -ComputerName remotecomputer: Get-WmiObject Win32_LogicalDisk -ComputerName remotecomputer

And then you can just use the returned object to iterate over it: $disk = Get-WmiObject Win32_LogicalDisk -ComputerName remotecomputer -Filter "DeviceID='C:'" | Foreach-Object {$_.Size,$_.FreeSpace}

Re: Linux Terminal Goods

#55

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…

What saved my ass more times than I can count is that I make sure that whenever I'm on a production machine my prompt has obnoxious color that makes me want to close that window as soon as possible.

Production root is made even more visually offensive.

Re: Linux Terminal Goods

#56
post #46
post #38

Earlier quoted context omitted.

Hey guys, I have the same thing, but I called the command ".." (no it doesn't conflict with the directory). ".." by itself is the same as ".. 3" .. () { local arg=${1:-1}; while [ $arg -gt 0 ]; do builtin cd .. &> /dev/null; arg=$(($arg - 1)); done; }

Mine is similar, but only does one cd command - to allow better use of `cd -` up() { local ups="." for((i=0;i

Ooo, good idea!

Re: Linux Terminal Goods

#57

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.

I immediately thought "yea I'm gonna keep using neovim" when I read about spacevim.

Re: Linux Terminal Goods

#58
post #46
post #38

Earlier quoted context omitted.

Hey guys, I have the same thing, but I called the command ".." (no it doesn't conflict with the directory). ".." by itself is the same as ".. 3" .. () { local arg=${1:-1}; while [ $arg -gt 0 ]; do builtin cd .. &> /dev/null; arg=$(($arg - 1)); done; }

Mine is similar, but only does one cd command - to allow better use of `cd -` up() { local ups="." for((i=0;i

"cd -" is equal to "cd $OLDPWD", so that still works with my function ;)

Though yours looks much nicer ^^"

Re: Linux Terminal Goods

#59
post #14

Earlier quoted context omitted.

Its simplicity is an important part of the offering. Bash is perfect when you need predictable executions. When you use Bash, you benefit from an entire ecosystem that also uses it. That same ecosystem is not motivated to drastically change the shell, and therefore it remains stable and predictable. Bash typically isn't like Python or JavaScript, where certain features are introduced at a particular version and you h…

I don't disagree with your points but I think your following comment is a little misleading: > Bash typically isn't like Python or JavaScript, where certain features are introduced at a particular version and you have to constantly check for them, or not use them outright, or maintain which binary you have installed at all times. One Bash binary typically contains the same feature set as another binary. While you're…

> As an aside

You mention it as an aside, but I think it speaks to your point about external utilities. In that thread (I also think GP intended to comment on that topic), there was confusion to what "Pure" meant. The first sentence is, "The goal of this book is to document commonly-known and lesser-known methods of doing various tasks using only built-in bash features."

Re: Linux Terminal Goods

#60
post #32
post #13

Earlier quoted context omitted.

You can also combine it with ripgrep. Much faster than git grep.

I actually time-tested git grep vs ripgrep, and I'm not seeing meaningful differences on my repos. ripgrep smokes regular grep but for some reason git grep is just as fast as ripgrep

Because benchmarking these tools is difficult to do correctly, and is heavily workflow dependent. If your search space is small, them it doesn't really matter what tool you use for example, they are all probably going to be pretty quick.

I wrote more about this here: https://lobste.rs/s/0kaozs/don_t_underestimate_grep_based_co...

Post reply on HN