Productivity tips & tricks
for a developer
Sebastian Witowski
Hi, my name is Sebastian and I would like to talk with you about keyboards.
Those beautiful creatures.
So perfectly designed, that after hours and hours of using it every day, it leaves us with nothing less than the feeling of ultimate satisfaction.
Except that, it's not perfectly designed.
But it took me a few years to actually notice it.
I remember when I first discovered that some people are swapping the Caps Lock and Esc keys and I thought - wow, this is amazing.
I mean, when you think about it - there is so much space on the keyboard wasted for the Caps Lock.
It's one of the biggest keys there, but you only use it when you need to argue with someone on Facebook.
On the other hand - the Esc key, that you use more often, even when you don't use Vim, is very small and located in a very annoying location.
So I swapped them and I was very happy...
... until I got this guy.
Apparently Apple decided that you won't be able to swap the Esc key with any other key.
So I was stuck with 2 Esc keys: one on the touchbar and one under the Caps Lock and no Caps Lock key.
Which was bad - what if someone is wrong on the Internet?
How can I keep my discussions on a typical Internet level if I can't turn on the Caps Lock?
So I started digging a bit and by chance I found the most clever solution that I have seen in my life.
You see, someone came up with an idea to map pressing both Shift keys at the same time to Caps Lock.
You press both Shifts and you turn the Caps Lock on.
You press them again and you turn the Caps Lock off.
Again, once I saw it, I thought - this is brilliant!
And not only for people using macbooks, you can use this trick on any keyboard and it works really great.
This made me think about the productivity - are there any other ways that I can improve the way I work?
Are there any books about productivity?
So I did a quick search and I found the "Getting things done" book by David Allen - it had a lot of reviews and it was mentioned on many websites related with productivity, so I though it has to be good.
It wasn't.
It was an OK book.
It mainly focused on making lists and if you have been working for a while, you probably already figured out that making lists of things that you have to do is quite helpful.
So I tried to find other ways to improve my productivity and I've noticed that, what works really well for me are all the small tips that I can start using right way, not the whole methodologies.
But those tips are not easy to find.
People don't write books about productivity tips, they write books about methodologies.
And sometimes, you don't even know that something is possible, so you don't try to improve it, like for many years I didn't know that you can remap keys on your keyboard.
So let me show you a few tricks that improved my productivity - maybe you will find some of them useful.
dotfiles
.bashrc , .vimrc, .gitconfig
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias ll='ls -al'
alias g="git"
alias ga="git add"
alias gb="git branch"
alias gci="git commit"
alias prod1='ssh cds-wn-01'
alias prod2='ssh cds-wn-02'
alias chown='chown --preserve-root'
source
Most of you probably heard about the dotfiles - and if not, your should really check them out!
Those are the configuration files for your computer.
You can store them on github and download on each new computer that you will be using - that way, you will immediately have all your favorites commands and settings back.
dotfiles
.bashrc, .vimrc , .gitconfig
syntax enable " enable syntax processing
set number " display line numbers
set showcmd " show command in bottom bar
set showmatch " higlight matching parenthesis
set history=1000 " store lots of :cmdline history
set incsearch " search as characters are entered
" Allow saving of files as sudo
command W w !sudo tee % > /dev/null
" Pressing s will toggle and untoggle spell checking
map s :setlocal spell!
source
The same applies to vim.
You can configure all your shortcuts, settings and plugins by editing just one file.
dotfiles
.bashrc, .vimrc, .gitconfig
[alias]
ci = commit
co = checkout
d = diff
l = log
# Squash last N commits together
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
# Checkout a PR (usage: git copr 1234)
copr = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
# Merge GitHub pull request on top of the `master` branch
...
source
And it also applies to git.
You can define some 1 or 2 letter shortcuts for most common git commands, but you can also write more advanced functions.
For example, I have some functions that will squash last N commits together or checkout a pull request from github to a separate branch.
There is no way I would remember how to perform all those actions without checking the stack overflow, but once you put them in a function, they are super easy to use.
vim
" Map leader key to space
let mapleader = "\"
Coming back to Vim for a moment, I don't use Vim very often, but I found a very useful tip - use space bar as a leader key.
It's huge, it's centrally located and you can reach it with both hands, so it will be much easier to use it instead of the default backslash.
IPython
Execute some code each time you start IPython
....
c.InteractiveShellApp.exec_lines = [
'from invenio.search_engine import perform_request_search',
'from invenio.bibformat_engine import BibFormatObject'
]
IPython#config-file
One thing that I noticed is that, each time I fire up IPython on production machines to do some debugging, I'm using the same commands.
And that requires me to type "from foo import bar" all the time.
That's annoying.
So I searched the internet and found out that you can customize IPython, so it will execute some arbitrary code each time it starts.
Convenient.
Text expanders
Speaking of typing the same stuff over and over again.
There are some phrases that you probably type quite often, like the signature of the email, your full name, your address or your email.
So instead of doing that, you can use a text expander that will replace some shortcuts with a different text.
Just like the code snippets in your text editor.
What are your tricks?
@SebaWitowski
slides: https://switowski.gitlab.io/productivity-for-developers
So here just a few of my productivity tricks and I know there are a lot of people here with their own keyboard shortcuts, mappings and other stuff like that, so I would love to talk with you and find a way to somehow share it with the rest of the world.
So just come and talk to me or if you can't find me, ping me on Twitter.
Thanks!