Switching To LazyVim
I wanted lazy, I got lazy.
I have been using Neovim for quite some time now — mainly for coding, but also for minor file editing. Previously, I always had my own configuration (see here for my previous setup), however, recently I found myself disliking its bugginess. Moreover, my desires to keep configuring and maintaining it were dimming, favoring a more “just work” mentality. I could have fixed these annoying issues at some times, however, as they kept becoming more and more prevalent, I was fed up. I decided to switch. And it was by far the better decision.
What is LazyVim?
LazyVim is an exceptionally fast Neovim setup with countless features. Many of these features are built-in and require minimal configuration. LazyVim uses lazy.nvim as the package manager (see my article for more information). LazyVim has also been rapidly increasing in users and its community base is quite large, making it easy to ask questions and solve problems.
It includes prebuild configurations for various languages, including C variants using Clangd, Go, Python, and Rust. All of the ones I’ve tried have worked exceptionally well, but there is somewhat of a lack of languages — bash.
Moreover, the config can function as a normal lazy.nvim config, adding plugins, and keybinds are the same.
LazyVim Config
Current config: GitHub
There are a few parts to my config. The first is lazy.lua
— this is the place I add all preconfigured plugins. Mainly it is where I put the language-specific packages.
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{ import = "lazyvim.plugins.extras.ui.mini-animate" },
{ import = "lazyvim.plugins.extras.lang.clangd" },
{ import = "lazyvim.plugins.extras.lang.java" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.lang.python" },
{ import = "lazyvim.plugins.extras.lang.tailwind" },
{ import = "lazyvim.plugins.extras.lang.tex" },
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.yaml" },
{ import = "lazyvim.plugins.extras.coding.copilot" },
-- import/override with your plugins
{ import = "plugins" },
},
...
})
Then there is the plugins
directory, where I disable plugins and make slight tweaks to my personal taste. The tweaks are very minor and are mostly taken from my previous config.
Lastly, is my ftplugin
directory that includes my file type-specific tweaks. The main use case for it is to help me run and compile my files. For example, for C++, I include the following (see GitHub):
local Util = require("lazyvim.util")
local map = Util.safe_keymap_set
map(
"n",
"<leader>rr",
":w | :TermExec cmd='cr \"%\"' size=50 direction=tab go_back=0<CR>",
{ desc = "Compile and Run C++ File" }
)
map(
"n",
"<leader>rd",
":w | :TermExec cmd='cr \"%\" -d' size=50 direction=tab go_back=0<CR>",
{ desc = "Compile and Run C++ File with Debug" }
)
I use it for competitive programming, for more information see this article.
My current config has significant improvements and cleanliness compared to my previous config, leading to close to a 3x speed improvement. Even though both speeds are “fast” the difference is noticeable.
Final Thoughts
While there are fewer bugs, I also don’t tend to my config as much. This could both be considered a pro or a con, depending on the perspective. I personally consider it a pro, as it saves me immense amounts of time and allows me to focus on producing high-quality code. However, my configs aren’t as personalized, but they are close enough to my liking to be comfortable and cozy.