My Most Important PhD Lesson

Never take your hands off the keyboard...

Falk Mielke, University of Antwerp, December 2, 2021

productivity phd advice computer

After four years of PhD studies, you might ask me if something got stuck. Is there anything that I can recommend whole-heartedly to new students, or something I think I should have started earlier?

In this post, I will give that philosophical question a try, and you might be surprised by what I chose. If you get bored, which I hope not, just jump ahead to the practical recommendations or the conclusion.

Caught in a Trap

Then about a year ago, I got stuck in the “vi” console text editor once more.

img

Having used linux since 2005, first as a dual boot, and fully switching shortly after, the vi trap was not new to me. I knew already that I could get out by entering :q!. I had “googled” that. But this time, for some reason, I felt the poisonous stab of my own clumsyness.

So I decided to watch a tutorial video on vim. Since then, I have gradually transformed my PC into a productivity machine. I would now argue that starting to learn vim initiated the most important learning process of my PhD.

Let me explain, why.

Mouse Overuse

Are you using ms word to write your texts? And outlook for mails? Or the apple equivalents? And a icon-based file manager? A browser showing you colorful links and images to click?

Good. Then you’re like the majority of people.

However, there is a problem with this: all the programs above are mouse driven, i.e. you will mostly use a point/click periphiral device to control it. Even in your word processing programm, which is made for words and text, you probably cannot get around without the mouse. But why is that bad?

First of all, ergonomics. If you have a computer mouse, consider using a trackball or a stylus tablet instead. These are inexpensive, and much better for your bones, muscles, and tendons.

Second: inefficiency. If you are a top manager, just continuously writing or dictating unformatted text, with someone else correcting it for you, you might be fine. But I find my self correcting and re-reading texts at least half of the time. Even if I were writing in an “office” word processor, I would be adjusting formats and so forth. During that behavior, one is constantly switching back and forth between mouse and keyboard. This costs time, and probably imposes stress on the motor apparatus. I call this the navigation problem, i.e. the need to navigate in the document and the control menus and settings efficiently. Part of this is a formatting problem, attributed to the need of getting a text formatted for visual convenience (but is that really what you want to do in the first place?).

Third: distraction. One might consider plain text and database-format lists as a reference. All the colorful images routinely filling your screen are distractive. A good advice in most presentation workshops is: “less is more”. When accustomed to it, a well ordered list of files or links will give you more information in less time. And it is less sneaky (consider privacy issues with the hidden links in e-mails and html, or security issues with file attachments). (This point will certainly get clearer below.)

Fourth, the mouse is just the most unattractive way of navigating a computer. Compare it to a multi-touch screen of a mobile device, or a properly used keyboard. A plain vanilla mouse is not sexy. You would look much cooler if your hands stayed on the keyboard all the time.

And this last suggestion is actually a simple solution. Why do we not just keep our hands on the keyboard when operating in “word”? I see three reasons:

img

This holds for all other programs in the MS office stack: their visual control is cumbersome, their internal processes hidden.

And I have made one fundamental observation long ago: people who are good at these programs use the shortcuts. This is Revelation No. 1: use keyboard shortcuts.

I will tackle the other issues below.

Just a brief recap:

Mode Based Editing

Now there was a time, years back, few remember, in the age before the internet, the mouse, and even Angela Merkel, when people could do all their word processing with just the command line interface. Probably the oldest text editor is ed. But soon after came vi and vim.

Vim has a neat solution for the navigation problem: it has modes. Per default, you are in a kind of “navigation mode” (though it is called “normal mode”). In this mode, you can neither write text, nor control the editor. You just move around and then switch to other modes.

You can imagine (or try yourself): this is the most weird situation if you are not used to it. And this is why so many people get stuck in the editor accidentally. But, this hurdle is just inital. Free your mind, and give vim a chance. Once you have understood the modes, all the rest will logically follow.

For example, because of conditioning to word, people would intuitively use the arrow keys to navigate. Vim uses H, J, K, L. This has a reason. Generally, vim eliminates any need to move your hands away from the home row. It does so by modes, and by meaningful, well-optimized keyboard shortcuts.

Are modes a weird thing? No! In fact, they are indispensible in Spreadsheet processing software. If you ever used Excel, you are already familiar with modes, just never called them by that name.

The downside in Excel: you tend to use the mouse to switch modes.

The shortcuts in vim are intuitive, meaningful, and long evolved to be efficient. For example, you can edit before the cursor (i as in “insert” mode), after the cursor (a), you can edit from the beginning or end of the line (I, A). You can navigate words (w) backwards (b) or word endings (e), or navigate paragraphs (], }), or find letters to jump to (f), or jump in the document (G, gg, and many more). You can alter certain portions of text (c for “change”, combined with w: word, l: letter, 3c: three lines, etc.), or replace just the current letter. Most commands can be preceded by a number, which means “repeated command”, e.g. if you want to cut the following three words, type 3dw (“three delete word”). You can easily repeat commands (.) or record macros (q). And there is much more.

Almost every key in vim has a meaning in each mode. And the mnemonics make sense.

Finally, although the “im” in vim already stands for “improved”, there are some variants which build on top of that. I personally use “spacevim”. It can be installed quickly on new system and has a perfect default configuration, including an appealing color theme.

Brief summary:

Learning to Type

Okay, so there is a parallel universe full of geeks in which one can control everything by just the keyboard? Then maybe then I should learn to type!

img

The more I got accustomed to the idea of this “parallel universe”, the more it occurred to me how inefficient I had been typing all the years. So I decided to take a step back and learn to type efficiently, ten-finger-method, on US layout (because it is useful for programming, by keeping special characters in reach).

I could not over-recommend the free software “klavaro”, and I use it as a daily morning exercise before work. There are also some typing games out there (epistory, nanotale), which I have tried. Even if you are not into gaming, they are a useful tool for learning, because they force you to look up from the keyboard.

Revelation No. 2: learn to type well.

Then, I also purchased a split keyboard. This keeps my hands at a distance apart, in a natural position, which straightens my old, aching spine. I even got one with unlabeled key caps. There are some models, and I only have one product (the “zsa moonlander”). I do not have comparisons, and it is too expensive to recommend whole-heartedly. Next one will probably of the “lily58” type.

Just keep ergonomics in mind, and use what is good for you.

Practical Recommendations: Enter Evil Mode

With this foundation, I have gradually explored other programs which implement the vim idea. Below is a list. The remarkable thing is that all these programs are controlled by largely the same set of keyboard shortcuts. This means I can do all these things without moving my arms. And whenever I learned a new one of these, I knew most of the shortcuts already.

Disclaimer: I am using the following programs on linux, where they are easy to set up and where they integrate well. There are windows equivalents, but installation might be cumbersome. I guess windows is and will always be THE framework for work inefficiency.

All these software tools boil down to a single wisdom, which I call Revelation No. 3: control your computer. Computer tools are to help you, not to annoy you by letting you click throug an unnecessary series of historically grown menus, repeatedly.

Coding: doom emacs

Emacs is a whole new world on its own. It is different from vim, and has a completely different purpose and undergrowth. I use it as a development environment, and because of “evil mode”, it can be fully controlled by vim-like key bindings.

I can highly recommend “doom emacs” by Henrik Lissner. Just as with spacevim, it has most of the useful configurations, and can be used out-of-the-box.

img

In evil mode, interaction with emacs is only slightly different from work in vim. However, there is a lot to learn before you can appreciate the full potential of emacs. Luckily, there are many good videos which helped me to learn emacs online. For example, search on Distrotube or System Crafters.

The two killer features of emacs are *org mode* and git integration via magit. I will explain more below.

And if you were frowning at the prospect of losing your colorful images when stepping to “plain text”, there are good news: emacs itegrates them and can display figures, links and code in-line.

File Management: ranger

You might find it awkward to manage files in a text-based manager. But then there is “ranger”.

There are configurable shortcuts to your favorite folders. There is great file type compatibility for previews. There is a shell integration to mess with any detail of your files and folders. And there is a lot of convenience, for example, there is “bulkrename”, which will give you a vim editor with a list of filenames to change for the files to be renamed.

img

Browsing: qutebrowser

YES, you can indeed browse with just the keyboard! Try qutebrowser!

img

Or, as a mild starter, there are “vimify”/“vimium” plugins for the more common browsers.

E-Mails: neomutt + mutt-wizard

This was one of the more tricky programs, but not because they are complicated, but because my university uses “exchange server”. Yes, exchange server. And “AD”. And “Outlook”. Sometimes via a cisco vpn. Yes. Despite the recurrent security issues. Despite the telemetry. Despite the spam. I know, I know. You couldn’t possibly imagine a worse platform for business info exchange. But, hey, I’m just a biologist.

Anyways. Sorry to drift away from the excited, euphoric tone of this post. Ultimately, I managed to attach “neomutt” to my end of my employer’s mail servers.

img

Luke Smith has several great videos about it and is the initiator/maintainer of mutt wizard, which helps a great deal to get an initial configuration.

There is also an emacs-integrated mail client, mu4e. But if I would start that now, then this blog post whould be about emacs, not about vim.

Desktop Environment: qtile

For the linux users among you: try a tiling window manager! It is the logical conclusion of the vim paradigm to just control your whole OS with keys. I use qtile, because I can hack it in python. Other great ones are awesome, xmonad, or i3.

I also started assembling a dotfiles folder, which practically means that whenever I set up a new computer, it takes literally five minutes to get all my programs configured and set up exactly as I love them.

Graphics: no hope

One could certainly turn the “keyboard only” paradigm into an obsession. I wouldn’t. It is rather futile to replace the mouse in image editing programs such gimp or inkscape, or professional 3D software, except with an artist tablet and stylus (see above). But remember “revelation 1”: they certainly have keyboard shortcuts! (at least blender does)

There is sxiv for managing photos and images. But apart from that, I think there is no harm in using a mouse for purposes where it makes sense, such as image processing.

All Free

You might have noticed that all of the programs above are free, respect your privacy, and are reliable in everyday work. Use free and open source software, and consider supporting the developers as you would by paying a (potentially worse) product.

Revelation No. 4: use free and open source software.

Efficient Scientific Publishing

I mentioned emacs’ “killer features” above. There is a great talk by Thibault Lestang, who advertises emacs as an environment for producing scientific publications. Consistency and reproducibility are the major criteria here, and indeed, org mode and git integration via magit are outstanding features for the pursue these goals.

img

It is not only that you can dynamically connect parts of the publication workflow. (For example, you can include code in your manuscripts which dynamically updates figures in the text. How cool is that!)

It is also maximally compatible: one can export org mode documents to pretty much any format anyone else might need (e.g. LibreOffice text, LaTeX/PDF, markdown or html). And because all is text-based, version control works as a charm.

Revelation No. 5: the scientific process is enhanced by text-based tools.

If any publisher in my field would accept org mode documents for submission, I would not hesitate to send my work.

Conclusion

To many of you, conditioned on the most common operating systems and their historically grown workflows, this whole blog post might seem odd, puzzling, or far off at first glance. But the actual path is not as steep as you might think.

For example, start by watching a vim video, run the vim tutor, try using vim for some text files, just casually. Use spacevim or doom emacs, they come fully packaged. Just get used to the idea of computer control. The rest will follow, or not.

img

For me, it took less than a year of “side-loading”, slowly migrating my working procedures. Now I am close to finishing my first org mode manuscript. And I produced this whole blog post in less than four hours, without touching the mouse. Starting vim was an incredible boost in productivity, and qualifies as the best thing I learned during my PhD.

When I started my PhD, I was using linux, which bore the stigma of being a “nerd”. I was not. But what is a “nerd”, really? To me, it seems that we give this label to people who just learn to analyze their procedures and control the devices and tools around them. You know… those people who make their lives easier by usint tools the right way.

  1. Use keyboard shortcuts.
  2. Learn to type well.
  3. Control your computer.
  4. Use free and open source software.
  5. The scientific process is enhanced by text-based tools.