How to Set Up the Perfect Windows 11 Development Environment (with WezTerm, WSL2, and Neovim)
Boost your Windows 11 coding! This beginner's guide shows you how to set up a powerful dev environment with WSL2, WezTerm, & Neovim. Learn to code like a pro, even if you're just starting out! #Windows11 #WSL2 #WezTerm #Neovim #coding
Introduction:
Are you prepared to start coding on Windows 11? Wonderful! With the correct tools, Windows has developed into a powerful platform, even though it may not be the first choice for many developers. For both novice and experienced programmers, this tutorial will show you how to use WezTerm, WSL2, and Neovim to create an exceptional development environment.
Why Select This Setup?
• Windows Subsystem for Linux 2, or WSL2: This can be thought of as a little Linux computer that runs in addition to your Windows system. It provides you with all the necessary command-line tools that developers depend on and is remarkably quick.
• WezTerm: You will enter your commands in this new command center. It is aesthetically pleasing, incredibly customizable, and jam-packed with features that improve your workflow.
- Neovim: Many programmers love this quick and effective text editor because of its speed and versatility. At first, it may seem overwhelming, but after you get the feel of it, you'll discover that it's a handy tool.
Let's begin!
Step 1: Installing and enabling the Windows Subsystem for Linux (WSL2)
WSL2 makes it simpler to use Linux-based development tools by enabling you to run a complete Linux distribution on your Windows computer.
1. Enabling WSL2
We must first enable the required Windows functionality to begin using WSL2:
• Type "Turn Windows features on or off" into the Start Menu.
• Check the boxes for "Virtual Machine Platform" and "Windows Subsystem for Linux" in the window that displays.
• Press "OK" and restart the computer system.
Setting up WSL2:
-
Launch PowerShell as an administrator.
-
To activate WSL, run the following command:
wsl --install
WSL2 and the default Linux distribution, usually Ubuntu, will be installed by this command.
-
Restart your computer if requested.
-
Launch a terminal window and type:
wsl --list --verbose
Verify that your distribution is set up for WSL2.
Ubuntu is readily available from the Microsoft Store if it isn't already installed.
how to install Windows Ubuntu from the Microsoft Store
Let's then install a Linux distribution from the Microsoft Store, such as Ubuntu, which will function as your Windows "mini-computer":
• Open the Microsoft Store and look for “Ubuntu” (or any other distribution you like, like Debian or Kali) on the Microsoft Store.
• Press "Get" and wait for the installation to finish.
• Open Ubuntu from the Start Menu after installation.
You will need to create a username and password during the initial setup, which will take a few minutes. Be sure to keep them in mind!
Step 2: Installing WezTerm
WezTerm is a state-of-the-art terminal emulator with a wide range of customization options and support for many tabs and panes.
Take these actions to install WezTerm:
-
Visit the official WezTerm website for installation.
-
Download the installer for Windows.
-
Run the installation and follow the instructions on the screen.
For setting up WezTerm:
-
Start WezTerm.
-
Go to %USERPROFILE%.wezterm.lua, to edit the configuration file.
-
Adjust the font, color scheme, and key bindings to your liking. For example:
return { font = wezterm.font("Fira Code"), color_scheme = "Dracula", }
Step 3: Install Neovim
The installation of Neovim, a lightweight and incredibly configurable text editor ideal for coding.
-
Go to the official Neovim website to install Neovim.
-
Get the installer for Windows.
-
To add Neovim to your PATH,
open the Start menu and look up "Environment Variables."
Adding the Neovim installation directory to the PATH variable.
Configuring Neovim:
- Type the following into WezTerm or any other terminal to start Neovim.
nvim
- Use the following command to install a plugin management such as vim-plug:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
- Add a vim-plug section to your Neovim configuration file
call plug#begin() Plug 'nvim-treesitter/nvim-treesitter' Plug 'neovim/nvim-lspconfig' call plug#end()
- Save the file and run :PlugInstall in Neovim to install the plugins
:PlugInstall to install plugins :PlugUpdate to update plugins :PlugDiff to review the changes from the last update :PlugClean to remove plugins no longer in the list
How to install Neovim on your Ubuntu WSL2 system
-
Open WezTerm, which ought to start your Ubuntu environment.
-
Press Enter after each of the commands you enter:
Bash sudo apt update sudo apt upgrade sudo apt install neovim
These instructions will install Neovim, update any existing packages, and refresh the package lists.
- Basic Neovim Configuration (Suggested but Optional)
Neovim can be tailored to your preferences. Here is a basic setup to get you going:
• To launch Neovim, type nvim into WezTerm on Ubuntu and hit Enter.
nvim
• Type:q to exit Neovim for the time being.
:q
• Use mkdir -p ~/.config/nvim to create the Neovim config directory.
mkdir -p ~/.config/nvim
• Type nvim ~/.config/nvim/init.vim to open the configuration file.
nvim ~/.config/nvim/init.vim
• Modify the init.vim file by pasting the following basic configuration:
Vim Script set number relativenumber " Show line numbers set tabstop=4 softtabstop=4 expandtab shiftwidth=4 " Set up tabs set autoindent smartindent " Auto indent :wq
Type:wq to save and quit.
Step 4: How to Link WezTerm and Neovim to WSL2
Configuring WSL2 in WezTerm:
-
Open the configuration file for WezTerm.
-
Include a WSL2 profile:
return { default_prog = {"wsl"}, }
- To implement the modifications, restart WezTerm.
Using Neovim with WSL2:
-
Go to your WSL2 terminal and launch WezTerm.
-
Install Neovim inside WSL2:
sudo apt update sudo apt install neovim nvim
- Type nvim into the WSL2 terminal to launch Neovim.
Step 5: Tailor Your Process
Additional Tools:
fzf: A command-line fuzzy finder for fast file access is called fzf.
sudo apt install fzf
tmux: A terminal multiplexer for controlling several terminal sessions is called tmux.
sudo apt install tmux
Enhancing Neovim
• To improve syntax highlighting, use Treesitter:
:TSInstall python javascript
• Configure Language Server Protocol (LSP) for linting and code completion.
Step 6: Get Your Projects in Order
In WSL2, make a special folder for your projects. As an illustration:
mkdir ~/projects
This folder is easily accessible with Neovim or WezTerm.
Step 7: Acquire Knowledge and Practice
Now that everything is set up, go to work coding! To get better, use tools like Linux tutorials, Neovim documentation, and programming classes.
CONCLUSION:
Using sudo apt update and/or sudo apt upgrade in WSL2, update your tools on a regular basis.
Make a backup of your configuration files to a repository on GitHub.
Try with different terminal settings and plugins to see what suits you best.
These procedures will provide you with a contemporary, effective Windows 11 development environment.