My developer workflow using WSL, tmux and Neovim

7 min read

Screenshot of my terminal

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 also known as WSL in short. It lets you run a Linux distribution inside of Windows.

I use Ubuntu, 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, more commonly known as zsh. To manage my zsh configuration, I use Oh My Zsh. It has a huge community and makes it trivial to install and use plugins.

I used to use fish 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 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 for my prompt and it is AMAZING. Written in Rust, 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.

The configuration file for Starship lives in ~/.config/starship.toml. Here's my starship.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 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.

Startship prompt

Having a nice looking terminal always helps!

Persistent Terminal Sessions with tmux

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

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 as my code editor since the first day I started learning programming, but recently I have switched to Neovim. It is a modern version of Vim.

Neovim is the best code editor for me because of its speed and ease of customization. All the configuration is written in Lua, 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. It's just a fork of craftzdog's configuration.

Screenshot of Neovim auto-importing useEffect from React

Screenshot of telescope file finder in Neovim

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. Also written in Rust, 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

The above GIF is from the zoxide GitHub repository. 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

with exa

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 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!