DEV Community

Cover image for My developer workflow using WSL, tmux and Neovim
Shoubhit Dash
Shoubhit Dash

Posted on

My developer workflow using WSL, tmux and Neovim

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


Enter fullscreen mode Exit fullscreen mode

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"


Enter fullscreen mode Exit fullscreen mode

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"

Enter fullscreen mode Exit fullscreen mode




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!

Top comments (45)

Collapse
 
almogtzabari profile image
Almog Tzabari

Nice! Thanks!

Collapse
 
nexxeln profile image
Shoubhit Dash

Thanks for reading!

Collapse
 
jakecarpenter profile image
Jake Carpenter

Love the article. Thanks for introducing me to exa. This thing is great.

Collapse
 
nexxeln profile image
Shoubhit Dash

Glad you like it!

Collapse
 
devvsakib profile image
Sakib Ahmed

oww,, awesome article

Collapse
 
rescenic profile image
Muhammad Ridwan Hakim, S.T.

Is that alacritty?
Image description
My alacritty looks bad. Where is the config file location for alacritty?

Collapse
 
nexxeln profile image
Shoubhit Dash

Yeah it is alacritty! The config file in windows is at %APPDATA%\alacritty\alacritty.yml

Collapse
 
moopet profile image
Ben Sinclair

Bash is great but I personally find it harder to customize.

What is it that you find harder to customise in bash compared to zsh?

Also, what features of exa are you using that aren't present in ls?

Collapse
 
nexxeln profile image
Shoubhit Dash

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.

Collapse
 
moopet profile image
Ben Sinclair

ls supports colours and symbols for file metadata (they're things like / and *, not icons, and they don't differentiate between file types, but I've very rarely been bothered about that. Either a directory is so full you're better off asking ls *.png to dig out the pictures or it's small and organised and you don't need help reading it.

Thread Thread
 
nexxeln profile image
Shoubhit Dash

Whatever works for you!

Collapse
 
nexxeln profile image
Shoubhit Dash

I may be wrong here but at least in my experience it was easier to install and configure plugins in zsh.

Not just this but zsh has so many other features too!

Collapse
 
moopet profile image
Ben Sinclair

Plugins are handled through a third-party tool (oh-my-zsh or whatever), they're not part of zsh are they? Most shells have those sort of plugin managers these days.

Collapse
 
kissu profile image
Konstantin BIFERT • Edited

Nice workflow and setup, especially since you're running inside of Windows and not in a barebone Linux! 👍🏻

Collapse
 
masroore profile image
Max Ehsan

nice collection of tools, দাদা. thanks

Collapse
 
yxsh profile image
Yash

looks sick man!

Collapse
 
nexxeln profile image
Shoubhit Dash

Thanks!

Collapse
 
siph profile image
Chris Dawkins

Nice setup but why even use Windows at this point?

Collapse
 
nexxeln profile image
Shoubhit Dash

Because I'm in high school right now and some of the apps we use for school aren't available in linux. Also I can't really afford to get two different systems, one for programming and one for gaming/other work. So this works fine for me.

When I go to college I'll switch to mac or linux.

Collapse
 
siph profile image
Chris Dawkins • Edited

I don't use Windows but it's pretty cool that that's possible.

Collapse
 
gcgbarbosa profile image
George C. G. Barbosa

that is what I thought... it must be such a pain... Recently my computer broke and I hve a desktop for gaming, with windows of course. I thought "i will try to setup a backup enviroment... I only neet emacs, what could possibly go wrong?"... well it I wasted 2 days and failed miserably...

Collapse
 
frackinfamous profile image
FrackinFamous

Windows is great ....if you use WSL and have the extra bit of ram. You can also install it without Docker Desktop, which takes up a decent amount of resources, but they don't make it readily apparent. You can just install Docker engine by itself if you need docker. I use Windows long enough click my terminal and don't leave Linux again. That way I can still have Windows for the things I need it for but get a super fast development experience with Linux. The only thing that people run into is storing files in the Windows system and then working from the Linux side. As long as you stay in Linux and store projects there, you'll never know the difference.

Collapse
 
christodoulos profile image
Christodoulos Fragkoudakis

Thanks so much for your inspiring post!