My developer workflow using WSL, tmux and Neovim
Tags: productivity, vim
Published: 2022-08-16 15:53:54

![Screenshot of my terminal](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_fpyOEGTmBd.png)

Hi! Today I'm gonna talk about my daily developer workflow and all the tools I use to set up a productive enviroment for coding. I think having a nice looking terminal and some tools to save time are really helpful to keep you productive in daily coding sessions.

### Operating System

I use Windows and it's pretty much unusable for programming. Thankfully Microsoft understood that and made [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/) also known as `WSL` in short. It lets you run a Linux distribution inside of Windows.

I use [Ubuntu](https://ubuntu.com/), it's the default distribution that is installed with `WSL`. Ubuntu is really simple to use and has a huge community so getting support is very easy. I highly recommend it for anyone who wants to start using Linux and get familiar with basic Linux commands.

### Shell

Ubuntu by default comes with the bash shell. Bash is great but I personally find it harder to customize. That is why I use [Z shell](https://zsh.org/), more commonly known as `zsh`. To manage my `zsh` configuration, I use [Oh My Zsh](https://ohmyz.sh/). It has a huge community and makes it trivial to install and use plugins.

I used to use [fish](https://fishshell.com/) which is also a great shell. It has very sensible defaults and comes with a lot of cool features like autosuggestions, tab completions, etc. out of the box without the need to set up anything. The only problem with fish is that it is not `POSIX-compliant`. [POSIX](https://en.wikipedia.org/wiki/POSIX) is a set of standards that define how to develop programs for UNIX based operating systems. So in fish, things like bash scripts do not work. They have their own scripting language.

`zsh` on the other hand is fully POSIX-compliant. This is why I switched to `zsh` and I'm quite happy with it so far.

### Prompt

I use [Starship](https://starship.rs/) for my prompt and it is AMAZING. Written in [Rust](https://rust-lang.org/), Starship is a minimal, highly customizable and super fast prompt. The default look of it is really good but literally every little detail is customizable to your liking. To install Starship refer to these [docs](https://starship.rs/guide/#%F0%9F%9A%80-installation). 

The configuration file for Starship lives in `~/.config/starship.toml`. Here's my `starship.toml`.

```toml
# ~/.config/starship.toml

[aws]
symbol = "  "

[conda]
symbol = " "

[dart]
symbol = " "
format = "via [$symbol]($style)"

[directory]
read_only = " "
truncation_length = 1

[docker_context]
symbol = " "

[elixir]
symbol = " "
format = 'via [$symbol]($style)'

[elm]
symbol = " "

[git_branch]
symbol = " "

[golang]
symbol = " "
format = 'via [$symbol]($style)'

[hg_branch]
symbol = " "

[java]
symbol = " "
format = 'via [$symbol]($style)'

[julia]
symbol = " "

[memory_usage]
symbol = " "

[nim]
symbol = " "

[nix_shell]
symbol = " "

[nodejs]
symbol = " "
format = 'via [$symbol]($style)'

[package]
symbol = " "

[perl]
symbol = " "

[php]
symbol = " "

[python]
symbol = " "
format = 'via [$symbol]($style)'

[ruby]
symbol = " "

[rust]
format = 'via [$symbol]($style)'

[scala]
symbol = " "

[shlvl]
symbol = " "

[swift]
symbol = "ﯣ "
format = 'via [$symbol]($style)'

[git_status]
disabled = true
```

The icons aren't showing up here because you need a [nerd font](https://github.com/ryanoasis/nerd-fonts) for that. If you set up a Nerd Font (I recommend JetBrains Mono), and copy this configuration, you'll get a very minimal looking prompt like this. For more information on configuring Starship, you can look at the docs [here](https://starship.rs/config/).

![Startship prompt](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_jS3SFqMm0V.png)

Having a nice looking terminal always helps!

### Persistent Terminal Sessions with tmux

[tmux](https://en.wikipedia.org/wiki/Tmux) is a terminal multiplexer. It lets you have multiple persistent terminal sessions and come back to them without terminating the existing running processes. So you can return to a workspace, exactly where you left it. It also allows you to manage multiple windows and panes inside a session.

For example, to go to my website's workspace, I just have to type `website` and I'm there.

![Typed website and I'm in my tmux workspace](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_4o6jA67dhy.gif)

Here `website` is an alias I've set up to open the `website` tmux session.

```
# .zshrc

alias website="tmux attach-session -t website"
```

This way I can jump into any one of my workspaces really quickly and start coding. It also helps that I'm exactly where I left off. I highly recommend tmux for local development, it has changed how I work and increased my productivity by a massive amount.

### Neovim

I had been using [VSCode](https://code.visualstudio.com/) as my code editor since the first day I started learning programming, but recently I have switched to [Neovim](https://neovim.io/). It is a modern version of [Vim](https://www.vim.org/). 

Neovim is the best code editor for me because of its speed and ease of customization. All the configuration is written in [Lua](https://www.lua.org/), which is very easy to learn and write. It helps me be really fast and productive because I never have to take my hands off of my keyboard.

You can find my Neovim configuration [here](https://github.com/nexxeln/nvim). It's just a fork of [craftzdog's configuration](https://github.com/craftzdog/dotfiles-public).

![Screenshot of Neovim auto-importing useEffect from React](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_QbDZP3dZbv.png)

![Screenshot of telescope file finder in Neovim](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_c2klZUhRLU.png)

### zoxide

You might have seen in some of the screenshots that I just have to run `z license-generator` to jump to that directory. That is [`zoxide`](https://github.com/ajeetdsouza/zoxide). Also written in [Rust](https://rust-lang.org/), it's a smarted `cd` command that remembers which directories you visit frequently, so you can jump to those directories with just one command.

![Demonstration of zoxide](https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/contrib/tutorial.webp)

The above GIF is from the [`zoxide` GitHub repository](https://github.com/ajeetdsouza/zoxide). Use `zoxide` to never go back to `cd` hell again.

### exa

`exa` is a modern replacement of the `ls` command. I always find myself using `exa` to get familiar with the files in a new codebase.

![ls -la command](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_es6V6y6yIo.png)

![with exa](https://us-east-1.tixte.net/uploads/nexxel.needs.rest/brave_qNXvN9cMHy.png)

As you can see in the screenshot, `exa` has a more readable output with colors and icons which you can look at and instantly know the filetypes of different files. It is also noticeably faster than `ls`.

It also has a [lot of flags](https://github.com/ogham/exa#command-line-options) which display the data is different formats. Here are the aliases I've set up for `exa`.

```
# .zshrc

alias ll="exa -l -g --icons --git"
alias llt="exa -1 --icons --tree --git-ignore"
```

### Conclusion

That was a quick overview of all the tools I use on a day-to-day basis for coding. I think it's really important to spend some time working on your workflow and coding setup, it will make you faster over time. I hope you found the tools I listed useful and will incorporate them in your workflow too!

Thanks for reading!