Eduardo Aranda Hernández
Posted on July 6, 2022
When migrating your config, it's super boring to check:
- if values are already defaults
- is it vim.opt or vim.g ?
So I made this script
local opts = {
ai = true, -- Auto indent
autoindent = true, -- Auto indent
autoread = true, -- Detect changes
..... your options here .....
}
local function checkopts()
print("Options you can discard because they're default:")
for k, v in pairs(opts) do
if vim.opt[k]:get() == v then
print(k, v)
end
end
end
checkopts()
just paste your options and :source %
the file
Want to make options permanent?
this would be the same as doing vim.opt.youroption = yourvalue
on each value
-- set options
for k, v in pairs(opts) do
vim.opt[k] = v
end
Full example:
This also includes globals like colorscheme
💖 💪 🙅 🚩
Eduardo Aranda Hernández
Posted on July 6, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
neovim Migrating from VSCode to Neovim: A Journey of Learning, Confusion, and Triumph! 🚀
November 10, 2024