Helpful Coding Tricks and Tricks

Do you have any tricks or tips that makes your coding environment more friendly?

On the Discord, there were some useful tricks and tips people were posting about organizing Chrome tabs. I thought we could share our tricks and tips here.

Once tool I love is the entr tool which can watch my file for changes and run the tests for me on file save. What tricks do you have up your sleeve?

2 Likes

One tool I only started using recently but loving it so far is autojump.

It’s like cd, but it takes note of directories you cd into so that you can later just say the name of the directory, and no matter where you are currently in the directory tree, it tries its best to figure out the directory you meant and cd there directly.

1 Like

The shell’s CDPATH variable is handy for cd’ing to places you go to a lot.

For example, if your exercism workspace is /home/me/src/exercism then set

CDPATH=.:/home/me/src

Then, no matter where you are, you can do

cd exercism/go/hello-world
2 Likes

As a vim user, I’d be lost without NerdTree. I see that plugin is on the verge of being abandoned. Time to look for a replacement.

I don’t use vim as an IDE. I alt-tab between gvim and a terminal (or in a tmux session, ctrl+a ctrl+a)

Of course, for exercism stuff, I lean heavily on my fish wrapper.

1 Like

Didn’t know about CDPATH, that’s good to know!

autojump goes a step further, in that it lets you refer just to a directory in your tree or even just part of the name of a directory and manages to figure out what you meant.

For instance, the repos I work most at my job are at:

/home/me/git/mycompany/myteam-stuff-ui
/home/me/git/mycompany/myteam-stuff-api

No matter where I am, I can just say:

$ j ui 
$ j api

And it knows what I mean. Even if “ui” and “api” are not unique and I visited other folders with that as part of name, if the folders for my work are the ones I visit the most, it’ll prefer those.

The other day I made a typo on a directory name, and it still figured it out somehow :slight_smile:

1 Like

fzf is also useful for that sort of stuff.

1 Like

The fish shell does this kind of thing too. It has really good autocompletion. It feels like it’s reading my mind sometimes.