Hacker News new | ask | show | jobs
by rjzzleep 1158 days ago
I mean it's a matter of preference, I personally find vimscript a lot more readable for vim configuration. Maybe not for more advanced stuff, I don't know, but how is the following:

vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = buffnr, desc = "vim.lsp.buf.hover" })

vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>")

better than

nmap K :lua vim.lsp.buf.hover()<CR>

It's like the javafication of vim configuration.

1 comments

While I wholeheartedly agree, you don't have to sprinkle Lua everywhere, you can use both. As a matter of fact, I do[0]. And when I want to enable a setting on the fly in the editor, I still use the vimscript version. But Lua is way nicer to work with the moment you do something non trivial. For example, I've never been able to make sense out of vimscript string interpolation.

0: https://github.com/RMPR/dotfiles/blob/master/.config/nvim/in...