From Ubuntu + VSCode to Arch + Neovim
Tags: linux, vim, archlinux, neovim
Published: 2024-01-29 07:15:00

There are various motivations for ditching Ubuntu for Arch Linux, whether it's the thrill of distro hopping or the noble quest to vanquish bloatware. Having made the leap myself an year ago, I aim to guide potential Arch adventurers through this process.

## Why?
Before you embark on the Arch Linux journey, ask yourself "why?" Your reason will fuel your determination when things get tricky. For me, the switch stemmed from three desires:

1. A better understanding of my operating system, I wanted to know how packages on my system work together to give me my final experience.

2. More skills with Linux, as my job envolves working a lot with Linux servers, I wanted to have more skills with bare-skin Linux systems.

3. A lighter system, my 4-years Ubuntu installation was now idling at 1.1GB RAM usage with tens of packages that I don't even remember installing or ever using and I felt that needed to change.

The following parts of this article are steps crafted out from my personal experience, some of them I've tried and worked best for me, some are things I wish I had done, follow whatever makes sense to you, in the end this is your personal journey.

## Step 1: Getting your feet wet
Going ahead and installing Arch Linux on your main PC right away is of course a foolish move, you'll need to install Arch Linux on a virtual machine first, and I recommend following the [Offical Arch Linux Installation Guide ](https://wiki.archlinux.org/title/installation_guide), the process might seem tidious at first, specially that it's a terminal-based installation process rather than a graphical one, but following this process you will make you understand a lot about the underlying parts of the Linux operating system.

I recommend that you install Arch Linux 2 or 3 times on a virtual machine first, taking notes each time of the packages you installed and the problems you faced.

I would also recommend installing and trying different [desktop environments](https://wiki.archlinux.org/title/desktop_environment) during this phase, this will help you understand how different DEs work and you will find what suits you better.

At this point, install the programs and packages you are already familiar with, try changing only the parts that make your operating system (desktop environments, wifi control interface, etc) but keep using the same programs (browser, text editor, etc) you're already using, this way you can test your workflow against the amalgamation of an OS that you have made.

Start shifting some of your workload from your main PC to your Arch Linux virtual machine, I recommend you start with simple tasks like browsing the web or coding side projects. Move at a pace that suits you, and when you feel accustomed to your OS then take a leap of faith and install Arch Linux on your rig.

## Step 2: Harnessing the power of Linux
Linux, or I should say GNU/Linux is a very powerful operating system, and it has a lot of "built-in" features and tools that you can use, since you've come to Arch Linux land, you might as well dedicate some time into learning how to use the operating system to a good extend.

You've probably used the terminal a lot by now, but if you're using the terminal only when needed or when there is no other option, I would recommend starting to use it more, start using the terminal for file managment, use the basic commands `ls`, `cd`, `mkdir`, `touch`, `rm`, `mv` and `cp` as your main method of dealing with files, also start using commands like `grep` and `find` for searching, you can keep a GUI file explorer just in case you get stuck, but try to rely on the terminal more, and you might be intersted to read about the [Linux File Permissions](https://www.linuxfoundation.org/blog/blog/classic-sysadmin-understanding-linux-file-permissions) as well.

I would also recommend learning more about [systemd](https://wiki.archlinux.org/title/systemd) and how you may use it to create your own services.

Linux comes bundled with great utilities that might come in handy to do a lot of simple tasks that occurs a lot in one's workflow, for example:

- You might have a `csv` file called `data.csv` that contains data about the employees at your company: _ID_, _Name_, _Department_, _Deductions_ and _Salary_, and you want to generate another file called `processed.csv` that contains only the _ID_ and _Total_ in which _Total_ is the calculated amount from the equation `Salary - Deductions`. You could do this manually using a spread sheet program, or even better by writing a python script since this would be a monthly problem, both ways work, but if you know your Linux, you can solve this problem with a single line command:
```
$ awk -F',' 'NR == 1 {print "ID,Total"} NR != 1 {print $1 "," $5-$4}' data.csv > processed.csv
```
Although this might seem bizarre, it's a really simple [Awk](https://www.gnu.org/software/gawk/manual/gawk.html) command that you yourself would be able to fully understand after watching a 20 minute video on YouTube, and what's great about it (beside it's literally one line) is that it can be ran on virtually any Linux machine without installing any new packages or dependencies!

- Another great example of using Linux tools is dealing with `baseUrl` in CI/CD pipelines. If you're responsible of making a CI/CD pipeline for a web project that involve dealing with the website running on sub-path you may find yourself in a position to deal with a `baseUrl` or a `basePath` variable that could be different in production than in the developers' local environment, and you might solve this issue in serveral ways that may include setting a policy to never checkout the file containing the `baseUrl` variable (Spoiler alert: someone will) or you might set a script to change the variable in production, another easy way to do so is using the Linux [sed](https://www.gnu.org/software/sed/manual/sed.html) command to do an inline change to the file during the CI/CD pipeline, something like this:
```
$ sed -i "s;baseUrl='/';baseUrl='/some-path';" index.html
```

There's a lot of amazing Linux commands and utilities, I recommend exploring them as they might come in handy.

I recommend reading the [Linux man-pages](https://www.kernel.org/doc/man-pages/) and the [Arch Wiki](https://wiki.archlinux.org/) as those are two of the greatest sources of Linux knowledge ever, I've personally learned more from reading the Arch Wiki for one day than I have learned from googling my way through Ubuntu for four years.

# Step 3: The Dungeons of Vim
Now a few weeks have passed since you switched to Arch Linux and things are looking great, maybe it is time to start using the ultimate text editor.. Vim (or more precisely Neovim).

The transition from a text editor like VS Code to Vim might seem hard, and rightfully it is, but it's not imposible!

I would recommend a few steps that will help you make this transition as smoothly as possible:

Start with bare-skin Vim: don't install Neovim yet, start by learning the basics of Vim specially Vim Motions, I recommend checking out the `vimtutor` to get used to everything.

Moving away from the GUI: A lot of people will recommend using your text editor (aka VS Code) with a vim motions plugin to learn vim motions better, while this is true, vim has a lot more to offer than just motions, so I would recommend using vim to write readme files or for taking notes just to get familiar with the entire program.

After a week or so from using vim you will feel great! you will have this burning desire to use vim motions everywhere! on your browser, on your email client, just everywhere!. Althought some people seek that path _(Looking at you ThePrimeagen)_ I would recommend you refrain from it, at the end you are propably the "Tech-support guy" of your family and friends, so you still need to know how to use a computer like a normal human being.

When you feel that the only thing holding you from using vim as your primary text editor is the tooling (auto-compelete, error messages, etc.) that would be the perfect time to `sudo pacman -Syu neovim`.

Neovim is basically Vim on steroids. To start with Neovim some people might recommend using pre-made configuration like [NvChad](https://nvchad.com/) or [LazyVim](https://www.lazyvim.org/), but I would recommend the opposite, start configuring Neovim on your own, you will need a little bit of Lua and a tutorial, it might feel overwhelming at first, but don't worry, it gets easier with time and you will learn a lot throughout the process.

One great tutorial on how to setup NeoVim is [this one](https://youtu.be/w7i4amO_zaE?si=rCOJbWT-iVhZhnUv) by ThePrimeagen, I highly recommend that you watch it.

After you setup Neovim the way you like it, start moving all your work to NeoVim, it might be a little bit difficult at first but once you get the grip of it you will wonder how have you been living without it before.

### Epilogue
This journey is not an easy one, it took me one year to feel comfortable about my system and setup, it can take you longer or shorter depending on how you like this system to be, but always remember that you need to make it yours, and that's the only thing that matters.