DEV Community

Cover image for I spend one hour a week optimizing my development environment.

I spend one hour a week optimizing my development environment.

Oryan Moshe on July 14, 2019

The story of my unreasonable efficiency obsession - and the tools I use to fuel it If you're a productivity freak like me you probably f...
Collapse
 
gypsydave5 profile image
David Wickes • Edited

Lovely list!

Replacing my Caps Lock with ESC

If you're looking to take this hack a little further (and I'm sure you are if you've gone Spacecadet with your shift keys), try the Karabiner modification that changes Caps Lock to Escape on a single press, Control on hold.

Making Control easier to press will open up using the Emacs-like key bindings that are prevalent across OSX and its applications (i.e. Ctrl-p and Ctrl-n to navigate up and down in menus, terminal history, etc.)

I probably use parentheses hundreds of times a day.

I sincerely hope you're writing Common Lisp and loving it.

Calculator

While I love Alfred, if I'm doing any on the fly calculation I'll tend to use dc. Because it plays nicely with the rest of my unix tooling it's good if I can stay familiar with how it works- and the only way to stay familiar with something is to keep using it!

Collapse
 
oryanmoshe profile image
Oryan Moshe

Love the Control on hold idea, would definitely try it out and see if it suits my style!
As much as I love cli tools, dc is a bit too hardcore for me, usually the calculations I do are stuff like 24*60.

Collapse
 
gypsydave5 profile image
David Wickes

As much as I love cli tools, dc is a bit too hardcore for me, usually the calculations I do are stuff like 24*60.

For me it really shines as a part of an editor workflow. You can write the calculation on a line in Vim (or whatever), and then pipe it into dc and see the result in your editor.

bc is also available if you're not a fan of reverse Polish notation :D

Thread Thread
 
oryanmoshe profile image
Oryan Moshe

For vim this definitely works better than Alfred.
When I'm in a vim zone I usually don't use much of the GUI so it might be worthwhile to learn dc better!

Thread Thread
 
kungtotte profile image
Thomas Landin • Edited

For quick calculations you don't even have to leave vim or pipe out to anything!

<C-r>= in insert mode lets you type mathematical expressions and have the result inserted into your buffer. You need to add a decimal point if you want a floating point result otherwise it truncates to integers.

Bonus tip:
[num]<C-a> and [num]<C-x> will add or subtract num from the number under the cursor or the next number on the line if there's no number under the cursor. It defaults to 1 if you leave [num] out.

Collapse
 
kbilleter profile image
kbilleter

qalc is good

Collapse
 
havespacesuit profile image
Eric Sundquist

For Windows, AutoHotkey is a great scripting language that you can use to map all sorts of commands and macros to any keyboard shortcut. I even have it set up to have custom keyboard shortcuts depending on the title of the open window.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

1 hour a week, damn that's relatively a lot of time! I am a recovering tweaker, resist all temptation to do anything like this, the only thing I couldn't help. Change my PS1 to yellow with a branch name. Ultimately I have used a MacBook Pro for 2 years and I'm not impressed really anymore, I want something I don't have to change a trillion settings to feel productive. I'd better stay away from Linux then too.

Collapse
 
oryanmoshe profile image
Oryan Moshe

One hour seems excessive, but it's sort of a hobby so I guess It doesn't seem as much from my POV (:
My shell is customized out of control, adding a branch name to the prompt is definitely a must on every system!
I might make another post specifically about shell customization.

I'd better stay away from Linux then too.

As a former Arch / Gentoo Linux user, if you don't have time to tweak the system, I completely agree :P

Collapse
 
nolansym profile image
Jordan Gilliam

+1 for Alfred, but honestly I feel lost on any mac that doesn't have Spectacle installed. I know this might be a character flaw - but I physically cringe when someone spends 10 seconds using their mouse to rearrange window size.

spectacleapp.com/ 😍🔥💯📈

Collapse
 
oryanmoshe profile image
Oryan Moshe

As I said, I think the best way to navigate around a mac is by using spaces (built in fullscreen)
I literally never use any app in windowed mode.

But most of my co-workers do use spectacle so I can definitely agree it works for most people!

Collapse
 
kbilleter profile image
kbilleter

There's also HammerSpoon for .. any automation really :-) But it's good for navigation / moving stuff around

Collapse
 
logicxd profile image
David Moe

Great article! I'm going to try #3, #4, and #5!

For #3, the article for turing left_shift into ( is a little outdated.

Here's how I got it to work:

  • Download Karabiner-Elements
  • Open the link: karabiner://karabiner/assets/complex_modifications/import?url=https%3A%2F%2Fgist.githubusercontent.com%2Feyemyth%2Fdb4f923bcbd640b2d71a5f3fa0670e3a%2Fraw%2Fe62566f8db8985c07eb33df9459f247561218614%2Fshift_to_parentheses.json taken from github.com/tekezo/Karabiner-Elemen...
Collapse
 
oryanmoshe profile image
Oryan Moshe

I linked that article mainly for the philosophy behind Space Cadet, and not for practical info.
Thanks for sharing this Karabiner recipe! I'm sure it'll help a lot of people who didn't have a chance to get dirty with complex modifications (:

Collapse
 
attacomsian profile image
Atta

Thank you for a wonderful post 🙌

Clipboard history is very useful especially if you do a lot of copy paste (like me). I used to use ClipX on Windows a lot for copying multiple things and pasting them one by one. Last year, I switched to Ubuntu and it was terrible to work without ClipX for few months. I wish to see something similar to ClipX for Linux too (happy to pay $$).

Collapse
 
oryanmoshe profile image
Oryan Moshe

It'll probably be hard to find something similar to ClipX, as it uses the context menu which isn't really a key part of *nix systems.
Did you try CopyQ?

Collapse
 
attacomsian profile image
Atta

Yes. I tried CopyQ but it is not as good as ClipX is. I really liked the shortcuts and context menu.

Collapse
 
anas2204 profile image
Anas Siddiqui

I love Better Touch Tool as well, and it has added immense productivity on my Mac. Being table to customize Tab-changing on VS-Code/Chrome/Terminal saves so much effort (I have made 3-finger swipe left/right on all possible apps)

Collapse
 
fnky profile image
Christian Petersen

I use Karabiner-Elements to remap the useless Caps Lock (it's 2019, if you use Caps Lock it's time for some re-education) into an esc. Can't get easier than that.

You can also set this directly in macOS through System Preferences > Keyboard > Modifier Keys…. Of course, if you wan't a more advanced setup where you'd like to use Caps Lock for both ESC and Control, depending on how long you hold the button, or to support the Space Cadet Shift, then Karabiner is indispensable.

Personally, I use Karabiner solely for the remapping keys for my external keyboards to match the macOS key mapping and otherwise use the OS features to do the rest.

Trackpad 3 fingers drag

I cannot live without this feature. I miss it every time I use someone else's Mac for even a brief moment.

Collapse
 
lardissone profile image
Leandro Ardissone

Nice list!

I use Workspaces to accomplish many of your launch things.

Also use tmux + tmuxinator in my terminal to load dev environments.

For example, this script launches my MongoDB and Redis servers in a single iTerm2 tab:

# ~/.tmuxinator/dbs.yml

name: dbs
root: ~/dev

windows:
  - dbs:
      layout: even-vertical
      panes:
        - mongod --notablescan
        - redis-server /usr/local/etc/redis.conf

And I can launch it using: tmuxinator dbs (or mux dbs with my fish-shell alias).

Collapse
 
jwkicklighter profile image
Jordan Kicklighter

These are great! Would you mind sharing the details of the Alfred workflows (specifically that last one) and maybe the related Applescripts?

Collapse
 
oryanmoshe profile image
Oryan Moshe

I can share the workflows themselves, but honestly they're pretty boring 😅
Nothing too crazy going on there.
Here's the Applescripts for the last one, hope you can adjust them to your use case!

on alfred_script(q)
    tell application "Hyper.app"
            activate
        tell application "System Events"
            keystroke "bb"
            key code 36
            keystroke "rs"
        end tell
    end tell
end alfred_script

bb is my alias for switching to my dev folder, 36 is the keycode for enter, and rs is my alias for rails server over nodemon

Collapse
 
clara profile image
Clara

The touch bar customization looks awesome. Will implement today! Thanks for the tips!

Collapse
 
mitchartemis profile image
Mitch Stanley

I've been thinking of writing something like this as well :). I don't spend an hour a week optimising, but I do love making my workflow as efficient as possible.

Thanks for the tips!

Collapse
 
franck_fernandez profile image
Franck Fernandez

Nice article! If sudo TouchID doesn’t work with iTerm2, you can change Prefs > Advanced > Allow sessions to survive logging out and back in, and it could work 👌

Collapse
 
kbilleter profile image
kbilleter

The other issue is under tmux. That requires an extra line with pam_reattach.so

/etc/pam.d/sudo gets reset with Apple MacOS updates these days. I have a script to send me an SMS if these lines have been removed (or TOTP from ssh) :-)

Collapse
 
shubho profile image
Shubhojyoti

I love some awesome new Alfred workflows from this article. Thanks a lot.

Collapse
 
selahattinunlu profile image
Selahattin Ünlü

I'll read it later but I had a look it fastly. Replacing caps-lock with ESC seems so sensible. I'll do it as well :))

Collapse
 
gregorskii profile image
Gregory Parsons

Wow didn’t think of a lot of these.

Thank you Sir!

Collapse
 
sobuj profile image
Sobuj • Edited

I've never used Alfred but Wox launcher is best alternative for Windows.

Collapse
 
oryanmoshe profile image
Oryan Moshe

That looks sleek
Would definitely recommend it to any friend who uses Windows!

Collapse
 
jamesthomson profile image
James Thomson

You can use Spotlight / Alfred as a calculator. Apparently this isn't as known as I thought it was.

Probably my most used Alfred feature :) That and I made a quick search for Can I Use.

Collapse
 
rbo13 profile image
Richard Burk

I've remapped my caps to control :)

Collapse
 
liquidmantis profile image
Will Ernst

Why not both? One of the Karabiner Elements complex mods rules makes the caps lock key esc when used alone, or ctrl if held and used in combination with another key.