Ask HN: What are your favorite developer-efficiency tips?
I recently started integrating tmux and vim into my workflows. Obviously, it was a huge efficiency booster. What are some other tools (custom built or off-the-shelf), hotkeys, workflows that were game-changing for you as a dev? I'm interested in hearing about anything and everything (stuff from ctrl+l to clear the terminal to little-known git commands to larger-scale strategies like CI/CD)
531 comments
[ 2.3 ms ] story [ 301 ms ] threadAdd this to you inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward
Now up and down arrows will search your history with whatever you already have typed at the prompt. Re-running a command often? Probably just have to type its first letter and hit up arrow once or twice.
(fyi, for others: you need not use ctrl-r, just type and press up and down)
https://www.passwordstore.org/
yasnippets is the best for emacs.
To me, the key for being productivity is understand throughly the "tools" we use: IDE, languages, libraries, framework cli, os, shell,... Read the implementation, the docs, the issue tracker, even the git history if you have time.
When I started to learn vim, I tried many popular distribution without understand each of the plugins they included. And I almost gave up learning vim. It's until I start to read the vim manual, learn the key strokes one by one and then building my own distribution, that's when I really know how to use vim. Even so, I still learn many great things from books like Practical Vim by Drew Neil (on Tmux, there's Tmux 2: Productive Mouse-Free Development)
I think you might already know that, but still shooting here for some quick tips. I don't have any shortcut, just that motto.
Some developers use alternate F-words for RTFM.
F-words like:
Fabulous or Fantastic or Friendly
https://en.wikipedia.org/wiki/RTFM
You should also check out "Modern Vim: Craft Your Development Environment with Vim 8 and Neovim" from the same author.
Do small tasks immediately - reply to that email, merge from master, do that CR, etc. Delaying small tasks tends to abandon them.
Keep your workspace clean (physical & virtual).
Update docs as you use them.
Say "No" often.
I.e. do a little writing to help avoid coding the wrong thing.
For keyboards and other physical hardware, sure, you can't remap on the fly. But I'd wager the the vast majority of productivity-customizations that people implement are software-level.
And yes, some environments take a very dim view on you pulling repositories from outside their internal systems.
https://github.com/nikitavoloboev/dotfiles/blob/master/karab...
I go as far as binding keys to instantly type `console.log()` or `fmt.Println()` or the other language equivalent with my dot modifier key. Plus typing things like `Thank you` with dot+spacebar press.
https://github.com/nikitavoloboev/dotfiles/blob/master/karab...
The other tip that paid off in time is starting a wiki. And building an interface to access contents of the wiki instantly.
Wiki: https://github.com/nikitavoloboev/knowledge
Interface: https://github.com/nikitavoloboev/alfred-my-mind
And I can still use other people's computers although with some pain.
It's a little like how learning more instruments doesn't make you worse at the ones you know.
#d/2020/05/08 #fam/sis #fam/gifts — notes around a conversation I had with my sister today about potential gifts .
#d/2020/05/05 #recipes/dinner #recipes/c/italian — notes a ravioli recipe I made on 5/5. If I later make it for a group dinner, I'll tag it, too, so I can track when I made things for who and collect longitudinal feedback and recipe changes.
#todo/today is things that need to get done today; things that don't will get moved to other notes.
edit: parse error, unbalanced parentheses
Plan to write some more things and do videos to explain my workflow & wiki setup in more detail.
`rspecs alexa_api` translates to `rspec spec/services/alexa_api_service_spec.rb`
`rspecm startup` translates to `rspec spec/models/startup_spec.rb`
I also have a bunch of other shortcuts for repeating tasks like expiring Redis, dumping a test database for local testing, etc.
export HISTTIMEFORMAT='%F-%T'
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo \ bash$SHELLNO $PWD "$(history 1)" >> ~/.bash_eternal_history'
You are aiming for something that supports both 4K (3840x2160) [or greater I suppose] and a 60Hz refresh rate in that mode. On cheaper models this can be found on a HDMI2.0 input. More expensive ones might have DisplayPort as an option.
Shop around during TV season and you can find a quality model for $200/ea.
I started doing this a couple of years ago and it's hard to overstate the positive impact this has had on my macro productivity. I can come back to a project I haven't touched in six months and instantly start productively making improvements.
Tests and documentation really are for future you.
Unfortunately I've gone in the opposite direction as you. I recently moved from a company that had a good automated test culture, to one that has a culture of manually testing things, often in production. Everyone, even the senior engineers who've been around for a long time, regularly lands changes that cause prod incidents.
There's actually quite a good canary/rollback system in place to deal with this, so a lot of people think everything's fine. But they don't quite realize how much more efficient things are if you can just make a change and run a test suite, and quickly have confidence that you didn't break things.
It got to the point where I could drop in on a project by a team in another country that I'd never encountered before, read their README, checkout their code, run the tests, make a change and submit a pull request.
The big thing for me in the past couple of years has been applying the same discipline to my own personal projects and finding that even there my overall productivity improved rather than being held back by the extra work invested in testing and documentation.
https://github.com/wting/autojump
If this task is going to be done many times, then the automation WILL pay off. Running the automated task might take less time than the manual steps. And you can be doing something else.
The more of these kinds of tasks that you can automate, the bigger of a lever it becomes.
One of the oldest examples would be 'make'.
Also, learning, though that can be hard to justify.
Further, when that would happen, it is typically obvious that some bigger change has occurred which required the automated procedure to be updated and tested.
Yesterday I went looking for a similar key that would insert a copy of the last argument on the current line, like for when you want to copy or rename a file to a similar name in the same directory, as in `cp some/long/path/to/foo.txt some/long/path/to/foo2.txt`.
I couldn't find a command for this, so I made my own Zsh "widget" and bound it to Alt-/ so now I can type `cp some/long/path/to/foo.txt` and hit Alt-/ to prefill the second arg. I put the code for it up here: https://gist.github.com/dceddia/0a45a88dd61cbdf1be023d0a8f15...
(I'm on a phone and normally rely on muscle memory so it might be the wrong symbols).
`cp some/long/path/to/{foo,foo2}.txt`
(Though foo{,2}.txt is even shorter)
There was one bash feature along the same lines of this. It was like bringing up the previous command in a shell script, so you could modify it freely, then run it. It was useful for long command, I think. Haven't tried learning it though. Just saw a couple wizard colleagues using it, and it seemed cool.
Then getting to a frequently used directory is just a `goto X` away.
This is more of a quick link to directories themselves.
Maybe you could do something similar to the alias if you had my `~/.links` directory in your CDPATH, but then you'd still need to add the `-P`every time to get it to follow the symbolic link.
Not something I had ever thought of before honestly.
[1] https://github.com/rupa/z/wiki
My main one's 5k2k and I could still use more space.