-- Leo's gemini proxy

-- Connecting to blog.schmidhuberj.de:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Migrating Neovim config to Lua

Posted on 2022-08-21


In the last few days, I decided to migrate my Neovim configuration to Lua, mainly inspired by the following post:


Rust and Neovim - A Thorough Guide and Walkthrough


The migration


The migration was really easy, the main part was just figuring out what Lua-functions to call instead of the vimscript-things. Here is a short overview:


local o = vim.o
local g = vim.g
local map = vim.api.nvim_set_keymap

vim.o.expandtab = true -- set expandtab
vim.g.mapleader = " " -- let g:mapleader = ' '
map('n', '<leader>zf', ":lua require('telekasten').find_notes()<CR>", { noremap = true, silent = false }) -- nnoremap <leader>zf :lua require('telekasten').find_notes()<CR>

While I was at it, I also split up my config into many smaller files, imported into `init.lua` for example via `require('plugins')`. Lua is definitely a great improvement compared to the vimscript way I was doing before. It is also great in that regard that many new neovim plugins this day (e.g. integration with LSP) only show a way to configure it with Lua, which would have required wrapping the configuration in `lua` in the traditional way.


Plugins


I also invested my time (read: got distracted by) searching for some new plugins that might be useful. Here is a short overview of all the new plugins I found:


packer: Package manager, replaces plug.

impatient: Reduces startuptime by ~30 ms (on empty file). Definitely worth it.

lualine: Replaces lightline.

hop: Similar to EasyMotion to jump around the visible screen space quickly.

overseer: A "task runner" to run the code. This pretty much replaces a second terminal I was always using before.

telescope: I have actually had that plugin before, and even had a keybinding for it, but I just rediscovered it in my configuration and now actually use it.


I also removed some plugins:


ultisnips, vim-snippets: Never really used it, found it easier just to type things out

nerdcommenter: Will probably re-introduce or find another plugin for that

onedark: I forgot I even had that theme installed, I basically just use dracula

rainbow: Rainbow brackets, not really useful with good code formatting

vim-which-key: Almost never saw that popup as I remember the keybindings I often use

vim-v: Will probably re-introduce once I re-try the V programming language


Worth it?


Is it worth migrating the config? I would definitely say so. Lua is easier to handle than the old vimscript-way. Furthermore, the migration is really not hard, it maybe takes an hour to migrate (except if you decide to go deeper and find new plugins, new configs, ...). And if you would excuse me now, I have some more programs to rice.



Return to home

-- Response ended

-- Page fetched on Mon May 13 03:31:29 2024