I recently posted about using Lua to configure my neovim setup. This has been altogether a big improvement. One thing that is easier is having separate .lua
configuration files for each file type that I work with in vim.
At first, this seemed useful for minor quality-of-life improvements, like setting differing default tabs for Python and JavaScript files. This would mean cleaner code with less fiddling; so that was a win.
But then it became clearer that there were more powerful possibilities. I found a Reddit post[1] about Lua configuration for markdown files that would let me use neovim more like a word processor when working with .md
files. So my markdown.lua
file now looks like this:
vim.opt.wrap = true -- Wrap text
vim.opt.breakindent = true -- Match indent on line break
vim.opt.linebreak = true -- Line break on whole words
-- Spell check
vim.opt.spelllang = 'en_us'
vim.opt.spell = true
-- alter up and down arrows for better text navigation
vim.keymap.set("n", "<Down>", "gj")
vim.keymap.set("n", "<Up>", "gk")
-- disable GitHub copilot
vim.cmd(':Copilot disable')
And now I have a minimal word processor where I can use vim commands! I am very happy about this. The last pleasing bit about this is that I can turn off GitHub Copilot. My paranoid side worries that what I write in Microsoft365 of Google Docs will just go to train LLMs, which is not what I want. I am more confident that neovim is not going to do this.
[1] I would link to this here, but I can’t find it again :/