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 (40)

Collapse
 
almogtzabari profile image
Almog Tzabari

Nice! Thanks!

Collapse
 
nexxeln profile image
Shoubhit Dash Author

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 Author

Glad you like it!

Collapse
 
devvsakib profile image
Sakib Ahmed

oww,, awesome article

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 Author

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 Author

Whatever works for you!

Collapse
 
nexxeln profile image
Shoubhit Dash Author

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 on

Nice workflow and setup, especially since you're running inside of Windows and not in a barebone Linux! πŸ‘πŸ»

Collapse
 
rescenic profile image
Muhammad Ridwan Hakim

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

Collapse
 
nexxeln profile image
Shoubhit Dash Author

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

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 Author

Thanks!

Collapse
 
siph profile image
Chris Dawkins

Nice setup but why even use Windows at this point?

Collapse
 
nexxeln profile image
Shoubhit Dash Author

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 on

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
 
lakshitsomani profile image
Lakshit Somani

Hello, I am having some problems when I tried to copy your configuration. First one is colorscheme not found, I tried to do as suggested on github repo of shaunsingh, but not worked. Second, I use cpp, and have clangd installed as language server, how to set that. Thank You fot the amazing article.

Collapse
 
defman profile image
Sergey Kislyakov

So in fish, things like bash scripts do not work. They have their own scripting language.

As long as the script have the shellbang, it should work fine in fish. The only "downside" is that you can't copy bash commands and expect them to work, though, but I'm against copying commands at all.

Collapse
 
nexxeln profile image
Shoubhit Dash Author

A lot of third party stuff use bash scripts and assume your shell is POSIX compliant. I had some trouble with a few neovim plugins etc. Plus a lot of installation scripts don't support fish.

I really love fish though

Collapse
 
georgeanderson profile image
George GuimarΓ£es

We have very similar setups. Which plugins do you use in your tmux?

Collapse
 
nexxeln profile image
Shoubhit Dash Author

I use just tmux-resurrect to store tmux sessions even after rebooting.

Collapse
 
fiqrisr profile image
Fiqri Syah Redha

Hi, can you share your Tmux config? Thanks

Collapse
 
nexxeln profile image
Shoubhit Dash Author

Its just oh-my-tmux

Collapse
 
feibrix profile image
Fabrizio Rapelli

I use Windows and it's pretty much unusable for programming.

That was enough for me to understand the type of article I was about to read.

Collapse
 
hodolomax profile image
hodolomax

I recommend to use ubuntu or mint. I tried to use windows after 4 years :S I switch back to linux 3 days later :))

Collapse
 
nexxeln profile image
Shoubhit Dash Author

Def looking to switch to endeavour os when I go to college!

Collapse
 
haxnet profile image
HaxNet

don't do endeavour. try to install Arch from scratch so you can learn the in and out of setting all the configs. After you are done, then go with whatever distro of arch.

Thread Thread
 
nexxeln profile image
Shoubhit Dash Author

I've installed arch before on a very old laptop. It wasn't fun to say the least 🀣

Collapse
 
v3ss0n profile image
Phyo Arkar Lwin

Time to switch to Linux. Btw I use arch.

Collapse
 
nexxeln profile image
Shoubhit Dash Author

I agree, I wanna switch to endeavour os when i go to college

Collapse
 
felopater profile image
ε‡ γ„šδΉ‚ • Edited on

the only reason i see u use wsl for is tmux?

what does tmux do that windows terminal can't do tho?

Powershell is good I use this exact same setup and I don't feel I am missing anything

Collapse
 
defman profile image
Sergey Kislyakov

I'm pretty sure they are using WSL because they are comfortable with linux. Learning PowerShell is not something many people consider now having WSL.

Collapse
 
nexxeln profile image
Shoubhit Dash Author • Edited on

Good for you if you feel you're productive with your current setup!

I just like using linux more.

Collapse
 
msanchex profile image
Miguel Sanchez

Windows is better for gaming and other tools linux doesn't have ... However, for setup developer environment it's better to use linux ... We could have both OS, but it's required create hard disk partitions ... and there are a couple of ways to use linux inside windows and using both of them at the same time ... Virtual machine, WSL, containers (docker), etc

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.