Agenda
This documentation provides a step-by-step guide for setting up a custom development environment using NeoVim.
Fork this project to get started.
Note:
Because this repository is designed to guide you step by step, I've included comments for all configurations, making it easy for you to immediately see and understand their purpose.
Here are the tools utilized in this development environment.
- NeoVim:
A text editor offering extensive plugin support and limitless customization options.
- WezTerm:
A customizable terminal designed to suit your preferences.
- Fish:
An enhanced alternative to traditional shells, offering extensive customization options.
In this section, you will learn how to set up and personalize the environment to make it your own.
There's a lot of information here, but don’t worry—everything is explained in detail, step by step.
Before getting started, let’s review the structure of this project.
This repository is organized into two main directories: win
(Windows) and wsl
(Windows Subsystem Linux).
The win
directory contains configurations specific to WezTerm, as WezTerm is used within the Windows environment.
The wsl
directory includes tools and settings for the Linux subsystem, such as Fish, NeoVim, and more, since these are part of the Linux subsystem.
Each System has its own .config
file.
On Windows, you can place the repository's wezterm
configuration file in the C:/Users/your_name/.config
directory.
On Linux, you can replace your /root/.config
with the .config
directory from this repository.
GitHub CLI
The hosts.yml file located in /root/.config/gh
is automatically updated whenever you log in to GitHub.
You don't need to modify this file manually.
Git Config
The gitconfig
file must also be updated.
Replace your_name
with your actual name and the placeholder email with your real email address.
This ensures that your commits are attributed to you with the correct name and email.
To proceed, you first need to set up your Linux Subsystem.
- Why do we do that?
Setting up the Linux Subsystem enables you to run Linux tools and applications on Windows, creating a more flexible development environment.
Using NeoVim in Linux is beneficial because Linux offers better compatibility with development tools, native package managers, and scripting environments.
It also provides a more customizable and efficient workflow, especially when working with command-line utilities and managing dependencies.
- How do we do that?
wsl --install -d Debian
Now, all you need to do is create a user for your Linux Subsystem.
First, visit the link and download WezTerm from here.
You know the drill—just run the setup, and you're good to go.
Next, move the repository's wezterm
folder from your forked repository into C:/Users/your_name/.config
.
Congrats! You now have WezTerm.
Now that WezTerm is installed, we need a powerful shell to navigate with.
- Install Fish:
apt install fish
- Install Fisher:
A Plugin Manager for your shell.curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
- Install Tide:
This allows you to Style And customize your shell.fisher install IlanCosman/tide@v6
- Register the Fish shell in the system:
echo /usr/local/bin/fish | sudo tee -a /etc/shells
- Change Fish To Default Shell:
chsh -s /usr/local/bin/fish
- Set Up Tide:
You can also configure the basic appearance usingtide configure
.
This will open a wizard with visual examples to guide you.
Note:
The fish_variables
file is auto-generated.
The fish_plugins
and config.fish
files are either manually created or, if you utilize this repository's configuration, transferred from the repository to your /root/.config/fish
directory.
Info:
The Fisher plugin manages Fish shell plugins, making it easy to install, update, and configure them.
The Tide plugin provides a visually customizable prompt for the Fish shell, enhancing its appearance and functionality.
Of course, we can't forget about the heart of the environment—NeoVim.
NeoVim is entirely configured in Lua, eliminating the need to install any additional packages beyond NeoVim itself.
- Install NeoVim:
apt install neovim
- Run Lazy.nvim:
To install all the defined plugins, you need to run the plugin manager.
Typevi
to enter Neovim, then type:Lazy
and press Enter.
To find more plugins, visit
Now, let's take a look at some useful programs.
- Update Your Packages:
apt update
- Install PNPM:
I use pnpm as a package manager because it is faster and more efficient than traditional package managers like npm.
It uses a unique approach of hard-linking dependencies, which saves disk space and speeds up installation times.curl -fsSL https://get.pnpm.io/install.sh | sh -
- Install Node:
I use Node for my own projects.
If you don’t need it, feel free to skip it.pnpm env use --global latest
- Install LSD:
LSD is an enhanced version of the ls command that provides additional features, such as colorful output, improved file type icons, and a more user-friendly display of directory contents.
It makes navigating the filesystem more visually appealing and informative.apt install lsd
- Install GCC:
GCC (GNU Compiler Collection) is a C compiler that translates C code into machine code, allowing programs to be executed on a computer.
It's essential for compiling C programs and is widely used in development because it supports multiple programming languages, is highly optimized, and works across various platforms.apt install gcc
- Install Neofetch:
Neofetch is a system information tool that displays detailed information about your system in a visually appealing way, including details like the OS, kernel, uptime, memory usage, and more.
It’s useful for quickly checking system stats and for displaying custom system info in a terminal, often used by developers and in system setups.apt install neofetch
- Install A Font:
Quick step outside the Linux Subsystem:
Visit Nerd Fonts and download a font that you feel comfortable with.
Make sure to unzip the font and save the font file underC:\Windows\Fonts
.
Then, update thetypography.lua
WezTerm configuration to reflect the new font.
- Install Clipboard:
A clipboard allows you to copy and paste content both into and out of the Linux Subsystem.apt install xclip
- Install grep:
This tool helps you find specific files and definitions.
Most Linux distributions come withgrep
pre-installed, but if you don't have it, you may want to install it.apt install grep
- Install Make:
This tool is helpful for automating the process of building and managing dependencies in software projects.
- Install Unzip:
This tool is helpful for extracting files from.zip
archives.
- Install Git:
-
apt install git
-
git config --global core.editor "nvim"
-
- Install GitHub CLI:
-
apt install gh
-
gh auth login
-
- Install ripgrep:
apt install ripgrep
To properly work with your Linux Subsystem, you need to add a wsl.conf
and a resolv.conf
.
Follow the steps below to achieve this:
- Create a
wsl.conf
:
Move thewsl.conf
File from this repository into your/etc/
folder.
- Override The
resolv.conf
:
For example, you can use Google's public DNS.bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
- Make the
resolv.conf
Unmodifiable:chattr +i /etc/resolv.conf
This way, your Linux Subsystem will have a DNS that properly resolves your requests.
This section covers essential concepts that are important to understand about WSL.
- Starting WSL:
wsl
- Access Windows Drive From WSL:
This mounts your Windows drives to the Linux Subsystem, allowing you to copy or edit Windows files in Linux.cd /mnt/c/
- Shutting Down WSL:
Simply closing WezTerm won't work; it needs to be shut down separately.wsl --shutdown
This section covers basic operations to ensure your NeoVim journey begins as smoothly as possible, as there are certain shortcuts you'll need to memorize.
- Open A File:
vi file_name
- Save Changes:
- Save
Pressesc
to enter normal mode, then type:w
and hit enter.
- Save and Exit
Pressesc
to enter normal mode, then type:x
and hit enter.
- Save
- Exit a File:
- Exit
Pressesc
to enter normal mode, then type:q
and hit enter.
- Force Exit Without Saving
Pressesc
to enter normal mode, then type:q!
and hit enter.
- Exit
- Undo:
Press
esc
to enter normal mode, then typeu
.
- Redo:
Press
esc
to enter normal mode, then typeCTRL+r
.
- Edit a File:
Press
i
to enter insert mode.
- Copy And Paste:
- Copy
Pressv
to enter visual mode, select the text, then pressy
to yank (copy).
- Paste
Pressp
to paste the copied text after the cursor.
- Copy
- Open Database Tool:
Pressesc
to enter normal mode, then type:Dbee
.
Now, you could configure a database, for example:postgres://user:password@localhost:5432/mydb
.
- Show Documentation:
In Neovim, you can access the documentation by pressingesc
, then typing:h <keyword>
.
For example, if you’re working with a file property likevim.o.title = false
, you can type:h title
to look up its details.
Once you’re done reading, you can close the help window by pressingCTRL + w + q
.
- Open NeoTree:
Press<leader>
, then typeE
.
- Create a File In NeoTree:
Navigate to a specific path, then typea
.
- Rename a File In NeoTree:
Navigate to a specific path, then typer
.
- Delete a File In NeoTree:
Navigate to a specific path, then typed
.
- Switch Between Open Windows:
PressCTRL
, then typew
.
After that, you can usearrow_key
to navigate to another window.
- Change Window Size:
Press<leader>
, then typew
.
After that, you can usearrow_key
to resize a window.
- Show Error
Press<leader>
, then typel
+e
.
If you want others to see your activity in NeoVim through Discord's Rich Presence, there’s both bad and good news.
The bad news: WSL2 doesn't support this feature, so it's not possible to directly link your application to Discord.
The good news: There is a workaround.
With this configuration, Discord will always display NeoVim as your Rich Presence whenever WSL is launched, not just NeoVim.
This implementation was chosen for its smoother performance and user experience.
NeoVim is the primary tool used in most sessions of this development environment, making it a natural fit for the workflow.
- Install CustomRP:
Visit this repository to continue.
Then come back.
- CustomRP Preset:
Create a preset and move the (.crp) file to a location of your choice.
For example,C/Users/your_name/your_preset.crp
- Copy The Start CustomRP Script:
After configuring CustomRP, move the
start_customrp.sh
script from its current location in the repository (/wsl/etc/profile.d/start_customrp.sh
) to your own profile directory at/etc/profile.d
.
Then, modify the path in thestart_customrp.sh
script to reflect the location of your CustomRP preset.
- Make It Executable:
chmod +x /etc/profile.d/start_customrp.sh
- Create a Simlink:
ln -s /mnt/c/Users/name/AppData/Roaming/CustomRP/CustomRP.exe /bin/customrp
- Copy The Start Service:
Relocate thestart_customrp.service
file from the repository to your system's service directory (/etc/systemd/system/start_customrp.service
).
Enable The Service:systemctl enable start_customrp.service
Here is some information that is not specific to any particular topic but is still important to mention.
Health Check
Health checks may display warnings and errors.
These often relate to tools I currently don't utilize, so installing every suggested fix might introduce unnecessary bloat.
However, if you actively use a tool like Python, it's advisable to address the health check hints for optimal performance and security.
To use groovyls
, which requires Java 11 or later, I installed the necessary Java Development Kit (JDK) using the following command:
apt install openjdk-17-jdk
Issues With Groovy
Please note that installing groovyls
and its Java dependency is optional and based on my personal preference.
If you don't require Groovy
, you can safely remove them without affecting the overall system functionality.
LSP Log Errors
The /root/.local/state/nvim/lsp.log
file may contain error messages related to language servers.
For instance, if you encounter issues with the Bash, TypeScript, Tailwind CSS, or VS Code JSON language servers, you can install or reinstall them within Neovim.
Press esc
to enter normal mode, then type :MasonInstall bash-language-server typescript-language-server tailwindcss-language-server vscode-json-language-server
and press Enter.
Installation Issues
Treesitter may face issues during installation because it attempts to install immediately on startup.
To resolve this manually, open NeoVim and run :TSInstall
.
The problem seems related to loading a specific specification.
Menu Select
To select a different launch menu, press CRTL
+ l
while in the shell.
Buffers
It's important to note that when you edit a file from the outside (e.g., git update) and have a buffer open, it won't be updated in the buffer.
So, if you save the open buffer, any changes made from the outside will be overwritten.
Johannes Bausch - Portfolio - [email protected]
Project Link: https://github.com/johannesbausch/dotfiles
This project is licensed under the Unlicense License. See License for more details.
Credit where credit's due.