my vim journey

created: 2023-11-30 | updated: 2023-12-08

vim neovim technology linux

First, this is my dotfiles.

An old editor

If you are a person who interests in technology, you probably heard about vi, vim. It’s a really old editor, when people’s PC doesn’t really have a mouse, or it wasn’t that useful. It just happens that the way we edit text using keyboard only and vim motions is so effective that it still being used by people who types and cool kids nowadays.

For me, Vim is not just a text editor but a lifestyle, every aspects of my personal PC system is built around vim key (those h-j-k-l). I might write about How I use my computer in the future.

Vi is a text editor built for Unix by Bill Joy in 1976.

Vim is Vi IMproved by Bram Moolenaar in 1991, wikipedia.

These two are both great and exist in most Unix/Linux distributions nowadays. But I use Neovim (a fork of vim).

The only reason I prefer Neovim over Vim is XDG base directory specification adherence, or the first reason it is.

Over time, I get to love Neovim for more reasons, like Lua, LSP, and the rapid development of it.

How I found Vim

I don’t really remember how I got to use Vim. But I’m sure these two guys inspired me a lot. Luke Smith and Mental Outlaw.

I remember that it’s time when I got in love with plain text, Unix philosophy, and start caring about privacy right. I learned a lot in a short period of time just by ditching windows and using free and open source software.

Oh, I remember now, that is when I watched some videos on how to install a Linux distributions in bare-bones way from Luke and Mental. These cool kids were using Vim to edit text files, so I tried to learn Vim as well. Just simple as that.

How I learn Vim

I believe that the right way to learn a tool is to actually just using it.

Just as Luke said, you can learn vim in one afternoon and be efficient with it in a week. I tried to learn Vim by watching a lot of videos from Luke and Mental like this one. But the actual learning process started when I typed Vim in the command line and tried the Vimtutor.

I keep using Vim and every time I notice I was doing something inefficiently, I would do some research and yeah, there are ways to do that thing efficiently in Vim. This is how I learn Vim. After years of using this software, I still discover cool new things on Vim today.

And I read a book on Vim, named Vim for human.

Vim for human

This book is really good for beginners, it introduces a lot of good defaults options to set and explains them. Though options are all set by defaults on Neovim, or even Vim has them as defaults now.

The book also explain why a lot of people set Capslock key as Ctrl key, just look at this picture.

old keyboard layout

Lsp-Zero

The most confusing about Neovim is how to set up a Lsp server, just because it is still rapidly developing.

lsp-zero.nvim is a cool project help beginners to have a lsp configuration easily and nicely.

And then VonHeikemen also has a guide to teach every details how to set up a lsp without lsp-zero.

NvChad, AstroNvim, LunarVim and others

There are Neovim preconfigured-configuration, and I tried NvChad, AstroNvim, LunarVim. They all are great, really shows what Neovim can do, extends to. I learned a lot from them.

But in the end, I still need to build up my configuration from scratch. Because they preconfigured everything, every details, have a lot of functions, then when you want to change something, it become a hassle really quick. And I have some different opinions about how to use Vim with them.

How I use Vim

Kickstart.nvim

After tried a lot of those preconfigured-configurations, I first tried to configure Neovim by read Kickstart. It is a good starting point to Neovim created by Neovim devs themselves. It is small, single-file (with examples of moving to multi-file), and documented everything.

I built my configuration based on this repo but in multi-file organization and used it for long time just until lately that I want to organize my plugins the way NvChad do.

Kickstart shows me how to split every plugins to a different file in a directory, the file will have plugin’s name and its configuration. This way has some problems. Some plugin has key-binds configuration but can only load it after load the plugin so that I have key-binds configuration in many files, not one. And it is hard to manage all plugins, some needs to load after some.

Cool tricks from NvChad

But lately, I read the source code of NvChad, all of it and I learned some cool tricks to manage plugins and configuration.

Then I re-build my whole Neovim configuration again with these tricks, and it works so nice, easy to manage.

├── init.lua
└── lua
    ├── plugins
    │   ├── configs
    │   │   ├── autopairs.lua
    │   │   ├── gitsigns.lua
    │   │   ├── lazy_nvim.lua
    │   │   ├── lsp-mason-cmp.lua
    │   │   ├── lualine.lua
    │   │   ├── telescope.lua
    │   │   └── treesitter.lua
    │   └── init.lua
    └── sauoi
        ├── init.lua
        ├── makeup.lua
        ├── mappings.lua
        ├── rc.lua
        └── utils.lua

5 directories, 14 files

UI stuff

Most of my custom cmd are about changing the ui. I’m not the type to stick with a colorscheme, I change them frequently, so I set up some functions and keybinds just to change the ui when I’m using Neovim and save the config persistently. The purpose of rc.lua & makeup.lua is for that.

I don’t really understand why some people can only use one theme or colorscheme for life. Don’t they get bored?