Live data from Hacker News

Small programming tricks

will-keleher.com

161–170 of 192 posts

Re: Small programming tricks

#161
In Jetbrains I do secondary shortcuts and I name them as what they are in my hand:

Alt M + V = Move Alt E + C = Extract Component Alt S + E = Search Everywhere _ many more.

Or just vim combos.. with ideavim

Re: Small programming tricks

#162
post #77

The thing with a lot of these tricks is that you have to get into the habit of using them. I knew `Ctrl+r` for history since I learned about the command line. I even have a nice shell integration with fzf. But I still used the up/down arrow keys for years or scrolled up when I was looking for a previous command, because I never remembered the shortcut and just took the path of least resistance to find something. Usua…

It's quite true. Years ago, after `git switch` was released, I wanted to try to switch from `git checkout` to `git switch`. Ultimately I had to set up some bash nastiness to error and "scold" me when I typed `git checkout` from memory, while still allowing shell scripts to call `git checkout` just fine. It was a fun exercise, and at least now I know how I could do it again: https://github.com/lelandbatey/dotfiles/blo…

Your beef is with git, which is terrible, not a shell.

Re: Small programming tricks

#164
post #134

Earlier quoted context omitted.

Hot-desking killed this practice. I now get desk anxiety on my in-office days

Have an AI agent compile the cheat sheets into a searchable website hosted on Github for your own personal reference.

The printed copy lets you build a spatial association with the command. You are more likely to be able to look up and have your eyes settle roughly where it is than write a query on a custom site.

I think for a digital solution to come close you need it permanently present on a nth monitor

Re: Small programming tricks

#165
A small side note I want to raise:

Folks need to be sufficiently motivated to learn it. All hell break loose when `RTFM` becomes taken offensively; What do I know - I am just a weird guy with a beard.

And folks always wanted to type the commands without RTFM'ing - now we have two problems instead of one.

Also, these were hard learned tricks YOLO'ing until 3.30AM debugging a failed DNS clusters or why the HSM suddenly decided to trip up at 5AM! Nobody even cares about the things we learn these days - Google and then your AI agent already does 98% of what I know already. So, let them blow up the clusters and the racks - your pal AI agent knows. Go ask them instead.

Re: Small programming tricks

#166

Wrote "script" by accident once in my terminal. Turns out the unfortunate naming of that gnu tool from unix days makes it rather unknown. Record a debugging terminal session including output to a file. Its pretty great.

I was using that a few days ago

Re: Small programming tricks

#168
post #134

Earlier quoted context omitted.

I was my most effective when I had a bunch of cheat sheets taped up in my workspace.

Hot-desking killed this practice. I now get desk anxiety on my in-office days

I am young enough that my entire career has been markdown files, screenshots, and photos on my phone. I (a)sync everywhere by pushing git lfs commits to my home server.

Seems like overkill until it saves my ass. It continues to do so almost half a decade into all the LLM hype. It hits the sweet spot between simplicity, convenience, reliability, and precision.

People strongly underestimate how good the git life can be, especially with all the blogspam on here trying to dethrone it lately.

Re: Small programming tricks

#169
I switched from vi readline mode to emacs recently primarily for Ctrl-r and Alt-. (insert the argument from the last command). I love how interactive they feel.

You can accomplish the same things in vi editing mode (with ? and !!) but they’re not as interactive.

Re: Small programming tricks

#170

The most useful shell trick I've used to date is mapping the 'cd' command to 'zoxide', which is a more powerful version of cd that remembers folders you've been to.

I go a step further. When I press Alt + j, it sends all the directories in zoxide to fzf (in order of frequency), and I quickly choose the directory and jump to it. I rarely type "cd" anymore. A huge quality of life improvement!

You don't need to use fzf. Zoxide has an interactive function too.
Post reply on HN