Simple trick I use almost daily for navigating backwards to an exact directory: https://gist.github.com/GNOMES/6bf65926648e260d8023aebb9ede9... I use this often instead of chaining together multiple '../..'. Also nice for when I use Zoxide to CD into a deep nested directory. I quickly found out unless you manually CD each hop, the different parent directories aren't added to your Zoxide DB. (I have come across snippi…
Small programming tricks
231–239 of 239 posts
Re: Small programming tricks
#232https://github.com/hiAndrewQuinn/shell-bling-ubuntu
More readable presentation: https://hiandrewquinn.github.io/shell-bling-ubuntu/
Among other things, fzf gets installed with all the proper key bindings, ripgrep, fdfind... basically every papercut I could find between going from a vanilla Ubuntu or Debian box to a configured one is handled in this shell script.
Re: Small programming tricks
#233A few tidbits I wish I had known about sooner: bash: Ctrl-L to clear the screen VSCodium: Shift+Alt+[arrows|mouse click] to select a rectangular block scp for moving files (instead of ftp)
Ctrl-l to clear the screen, Ctrl-p to select previous command, Ctrl-j to enter it again. I don't even use Enter key when in terminal anymore.
When you want to pause entering a command for a moment do Ctrl-a to go to the start of the line, and type # to comment out. Then Ctrl-j. You can return to that later with Ctrl-p, then Ctrl-a again and Ctrl-d to remove that comment.
To edit complex commands you might want to use Alt-e to enter $EDITOR.
Re: Small programming tricks
#234I remember when I was using JetBrains IDE they had this feature that would list all shortcuts and IDE features and how frequently I use them. This was excellent for feature discovery. I would regularly check it out and scroll to the list of features I never used and try them. I always wanted the same for Vim, zsh, etc.
Do they still do this? I'm using PyCharm daily but have never seen it. Would indeed be pretty cool!
Re: Small programming tricks
#235One of the things I frequently use with Emacs is writing/recording macros on the fly with F3 and running them. I am sure this is present in the other editors as well, but this has helped me a lot at times https://www.gnu.org/software/emacs/manual/html_node/emacs/Ba...
You can just record and play back your exact keystrokes like a _Super Smash Melee_ game plays back your inputs to replay matches. If you can figure out how to do any mildly complex action once you can literally replay it a thousand times. Just like AutoHotKey! To my that's the essence of citizen programming!
Re: Small programming tricks
#236My main trick is to use fish and enable vi key bindings. Especially on mac where there is no Home And End functionality.
Re: Small programming tricks
#237You might not need find due to advanced globs, but it's too easy to run into expansion limits when you match hundreds or thousands of files, so you're back to find for that.
My "find" is almost always
tree -if | grep "$" | head -1
head, of course, being optionalThe tradeoff is needing to learn regex, which is not any easier to learn than find arguments.
Re: Small programming tricks
#238I am so proud of this (I'm sure others came up with it way before me, but I still came up with it all by myself!) //* normal path /*/ debug path //*/ take away the the first slash to toggle the debug zone ON !
It's awesome in both senses! How readable has it become for you over time? Because on first glance and without syntax highlighting it's a head-scratcher.
Re: Small programming tricks
#239This reminded me to ask: To what extent are people still coding by hand these days? In my profession (academia), literally no one codes anymore. On one hand, it sucks because the joy and fun of programming has been replaced by constant agent orchestration tasks, but on the other hand, it's hard to go back to the way things were before because the productivity gain is so good. I remember learning a lot of these progra…
People in academia generally doesn't code much. So I am not surprised. LLM's have not affected us in the slightest when it comes to coding. Maybe we write a snippet, post it for llm to scrutinize, and usually LLMs spout bullshit and wrong suggestions and after enough verbal abuse it points to some issues with the code. But I don't get this delegation to LLM's for your entire coding. I hope everyone delegates to LLM :…