The Valuable Dev

A Mouseless Development Environment

building your development environment is important for efficiency

Once upon a time, I was a proud Ubuntu user. It was easy to install, easy to use, and it seemed to answer my needs.

But month after month, my pride decreased as much as my annoyance increased. Ubuntu was letting me down:

  • Weird display bugs were popping from time to time.
  • It was slow.
  • I had to compile manually a lot of applications not available (are outdated).
  • I had to learn a lot of random shortcuts for every tool I was using.

I didn’t know better, so I stuck with it for years. Then, the tragedy: one morning, fresh and motivated, I decided to upgrade my LTS version. My whole system crashed. I couldn’t start Ubuntu anymore. I spent hours trying to fix the whole system, but I didn’t know how Linux-based systems were working. Where to begin? What to do?

The bitterness filling my heart was unstoppable. Ubuntu, my old friend, was a traitor. I couldn’t trust it anymore.

Fast forward a few months, I had the pleasure to meet and work with amazing developers who showed me how to build a very effective Mouseless Development Environment. My whole workflow shifted from there. It was one of the best decision I made in my entire career:

  • I learned a tonne about Linux, thanks to Arch Linux. Improving your Linux skills is important for any web developer: almost everything on Internet is running on Linux-based systems.
  • I can use consistent shortcuts (keystrokes) for every tool I use. If I can remember them, it’s because they make sense, much more than the typical shortcuts for GUIs.
  • I can use 90% of my system with the keyboard only.

When I switched to the tools I use today, I really understood how important it is to have a good, efficient, and scalable Mouseless Development Environment. I was feeling at home. I could customize my system for it to answer my needs. It wasn’t a system I was fighting against day after day. Developing became more enjoyable, and, as a result, my productivity increased.

What’s this Mouseless Development Environment? That’s what we’ll explore in this article. More specifically, we’ll see:

  • Why the Linux shell is the best tool a developer can use.
  • Why using Arch Linux.
  • What a tiling window manager is.
  • How to have a powerful terminal with URxvt, tmux, and tmuxp.
  • Why Vim is so handy.
  • How to improve your Git experience.
  • Better tools to use MySQL (or any database, really) in the shell.

Interested? Come with me. I will introduce you to the fantastic world of Mouseless Development Environments.

Mouseless With the Shell

linux shell Simple et efficient shell

In this article, I will refer to the shell pretty often. The most common are bash and Zsh; I use the second and I highly recommend it.

The Power of Plain Text

Why using a text-based shell?

  • You have access to many applications. Even if you don’t have the very specific tool you need, you can develop it more easily for the shell; no need to design a GUI on top of it.
  • It’s easier to give a lot of optional possibilities to the end user, letting him do exactly what he wants. You can’t put 20 buttons on a graphical interface? With a command line based application, you can have 20 options.
  • The Unix philosophy allows you to use specific tool for a specific need. Using pipes to throw the output from one tool into the input of another give you endless possibilities.
  • You can automate boring tasks easily with a shell. Automation is the key to increase your productivity and saving your mental energy for what you’re creating.
  • Command lines are often really fast. They don’t use heavy graphical interfaces to slow down your computer.

I encourage you to use the shell as much as possible. It can be a bit tough at first, but the benefits are huge.

What about graphical interfaces on top of CLI applications? To me, it has serious disadvantages:

  • It can hide a lot of functionalities you would access easily with a CLI.
  • You won’t be able to solve (or even understand) any bug coming from the CLI layer.

Things get confusing when you need to:

  • Use the tool on a remote server without your graphical interface.
  • Explain to a less experienced developer how the tool really work. You can explain the GUI, not really the application itself, especially if the wording used in the GUI and in the CLI are different. It happens more often than you think.

I have a real life example with sourcetree, a graphical interface for git. I was working with a junior developer who was using it without knowing how git was working. When problems popped up, it was difficult to know what command the GUI was calling under the hood. It was more frustrating than simply using the CLI git in the shell.

A Mouseless Approach

With the shell, you use mainly your keyboard. It might surprise some of you, but I try to avoid my mouse as much as possible. This is one of most important advice about efficiency I can give: keeping your hands on your keyboard might make you faster, but, more importantly, it will make you happier.

Using only keystrokes for common editing operations is more efficient than mouse or menu-driven commands, because your hands never leave the keyboard.

The Pragmatic Programmer

Here are some advantages of the mouseless approach:

  • Moving your hand from your keyboard to your mouse is tiring. You’ll feel it if you stop doing it.
  • It’s more enjoyable to stay on your keyboard. You don’t have to switch constantly between typing and moving a pointer.
  • You will feel like a hacker even if you only write your shopping list! How cool is that?
Speaking of which...
If you want to build a complete Mouseless Development Environment, you might be interested by this book.

Arch Linux: Grab the Latest, Up-To-Date Software

arch linux screenfetch Arch Linux running smoothly on a VM

Arch Linux has a lot of advantages compared to other Linux distribution.

A Rolling Release System

What the heck is a rolling release system? The Arch Linux community update constantly everything for us, the users, from the obscure tool you’re the only one using to the Linux kernel. When you install a new program, you can be sure you have its latest version.

No need to ask yourself if you miss great features and bug fixes for your favorite tools. You’ll have the most up to date system you can find.

What about the applications available? The official repositories of Arch Linux are huge. You will find most of the time what you need there. If you don’t, you have as well access to the AUR (Arch User Repositories) where you can find everything else. I’m not exaggerating. After years using Arch Linux, the AUR still surprise me.

The only downside: the applications from the AUR are not always well tested. Proceed with cautions. It’s easy enough to check their build to know what’s happening if you install them, however.

When you install Arch Linux from scratch, you can choose exactly what application you want to install. Nothing you don’t want will pollute your hard disk. No useless applications will run in the background without your consent. You are the master of your destiny.

The community around Arch Linux is huge, too. They usually know what they are speaking about and don’t throw random shell commands on stack overflow without explanation whatsoever (I look at you, Ubuntu community).

Who needs stack overflow, anyway? The Arch Wiki is the best Linux wiki you can find. Again, this piece of art still surprise me today. There is everything in there.

Now, you might ask yourself: is Arch Linux stable? Will it crash every two weeks, letting you alone and helpless?

You will find many people preaching exactly that on The Internet. My advice? Don’t listen to them. I use it on a daily basis for 5 years now. It never crashed, or very early, when I was playing with the installation process.

If you are careful with the AUR, you can count on a very robust, lightweight, and customizable Linux distribution.

Sometimes pacman (not the yellow cheese addict to pills, but Arch Linux Package Manager) will ask you to do some manual modifications. It’s always documented on the official website of Arch Linux and can be solved in no time.

Manage Your Windows With i3

i3 windows manager i3 windows

Arch Linux doesn’t come with any type of desktop or windows manager. You’ll need to install your own. My choice without hesitations: i3 windows manager.

This is a very light, fast and simple-to-use windows manager. There are no fancy 3D effects with i3. Everything is made for you to be efficient and productive, without being visually repulsive.

With i3 you can create workspaces. They take a whole screen and can be moved from one screen to another. In these workspaces you can open one or multiple windows. They will embed your favorite applications.

Simple, isn’t it? Now the best part: you can do everything with your keyboard easily. You can open, move and close workspaces or windows with simple keystrokes. You can resize windows with other keystrokes. You can open your favorite application using keystrokes.

Everything feels logical. I was able to use i3 efficiently two or three days after installing it the first time. Your muscle memory will work for you here to remember the keystrokes you need.

The configuration possibilities are huge. If you want to try it, I have an article which help you go through a basic i3 config, step by step. After that, you’ll understand i3 enough to customize it as much as you want.

Obviously the Arch Linux wiki has a good documentation about i3.

Urxvt, Tmux and Tmuxp: Your Terminal Is Now a Productivity Beast

tmux Tmux in Urxvt with 4 panes open and two windows

I tried a bunch of terminal emulator and Urxvt was the best choice I found.

It’s a very lightweight and fast terminal, especially if your run Urxvtd, Urxvt daemon. Spawning terminals everywhere becomes easy and painless.

That being said, I’ve rarely more than two or three terminals open at the same time, thanks to Tmux. It’s a powerful terminal multiplexer (like screen on steroids) which allows you to:

  • Create sessions, which include windows and pane.
  • Open as many windows in your terminal as you want. Each window take the whole terminal window, and can be divided into pane. You want 3 windows with 4 pane each (for a total of 12 different shells open)? tmux can handle that easily.
  • Detach and attach your session. Imagine that you close your terminal by mistake: you can recover your whole tmux session by opening a new terminal, and attaching your session.
  • Synchronise your pane. You need to run exactly the same command in three different remote servers? Open three panes, synchronise them with one command, and everything you type in the first will be copied in the others.
  • Many more things I don’t even know about yet.

Do I need to say that everything is manageable with your keyboard? You can use your mouse also, which is useful when you learn how to use it.

With tmuxp, you can even go further to automate your tmux sessions. Indeed, you can write a configuration file to open the windows and panes you want, and automatically launching applications in them.

Let say that in order for you to work on your new cool project (which will make you rich) you need to:

  • Run docker compose in a pane.
  • Run npm run dev inside one of your docker container in another pane.
  • Open a ssh connection to your production server in a different window.

tmuxp allows you to automate all of that with one command line and a simple configuration file.

I wrote another article about tmux which explains the basic configuration you need to get started. You’ll learn as well everything to customize it for your needs.

An IDE Which Fits You

This IDE is Neovim, an incredible fork of Vim, coupled with the shell. Since Neovim and Vim are very similar, I’ll continue speaking about both of them using the word “Vim”.

neovim This article was written in Neovim

Are you afraid? Don’t run away yet! Let me explain why you should really try to rethink everything you know about Vim.

I already write about Vim multiple time, so I’ll only summarize here why it’s great:

  • Coding with Vim is fun.
  • Vim let you leverage the power of your keyboard. Yep. Again.
  • Vanilla Vim has a lot of functionalities. You always learn something new.
  • Vim has a very good community maintaining many plugins. They should cover 99% of your needs. In any language: JavaScript, Golang, PHP, Clojure, you name it.
  • You are not restricted to any language. You want to code in Rust, Go and C with the same editor, with autocompletion, syntax highlighting and all these good stuff? Vim is perfect for that.
  • Everything is highly configurable. Forget bloated preferences; with Vim you can fine tune anything you want.
  • No more notifications appearing out of nowhere to break your flow (I look at you, Intellij IDEs).
  • Instead of having an IDE full of stuff you will never use, you can build your own only for your own workflow.
  • It’s fast.
  • It’s free.

Still suspicious? The best way to find out if I’m totally crazy is to try it. As you might expect, I wrote this article for this exact purpose.

Making Git Even Better: tig and diff-so-fancy

tig tig: on top the branch hierarchy, at the bottom, you can see every change made

diff-so-fancy diff-so-fancy is very nice to see quickly everything you modified

I think git is very easy to use in the shell for the most common tasks we all do every day. The decisions made about the user experience are a bit weird sometimes, but it’s better to be aware of them from the beginning on.

Basically, you need on a daily basis to use:

  • git push
  • git pull
  • git branch
  • git checkout
  • git merge
  • git rebase
  • git diff

Do you really need a whole GUI for that?

The first tool I use with Git is tig. It allows you to go through the hierarchy of git branches and display the details of each commit.

The second one is git-so-fancy. It displays git diff in a very readable way in your terminal. I always use it to verify what I did before doing a commit.

These tools are both available in the official Arch Linux repositories.

Better CLI for MySQL and PostgreSQL

If you need a quick and practical interface in the shell to interact with your database, I would recommend mycli for mysql and pgcli for PostgreSql.

These tools are similar MySQL and PostgreSql CLIs, but on steroids:

  • It auto complete databases, tables, joins, and so on.
  • You can use snippets for the boring operations you do all the time.

In order to install them on Arch Linux you’ll need to fetch them from the AUR.

Do I surprise you if I tell you that I wrote a whole article how to install and use efficiently mycli?

Are You Ready To Be A Mouseless Developer?

linux shell

Productivity, versatility, efficiency, control, and comfort: they are the main reasons why I’ve chosen to build and configure my entire development environment. A couple of months ago (June 2020), I decided to write a whole book explaining step by step how to build a mouseless development environment. It changed my life, as a developer, and I would love to pass on the knowledge I’ve got from this experience.

Don’t listen to people who never tried Vim saying that it’s the most complicated thing on Earth. Don’t listen to them arguing that Arch Linux will crash even more than Windows 95. I used both intensively; I’m sure they didn’t.

This kind of environment asks for a bit of time and efforts to setup and understand. A couple of weeks. Then, you’ll have your own development environment, tailored for your present and future needs. You’ll feel in control. You’ll feel at home.

mouseless development environment My Little House

Share Your Knowledge