dotfiles/.config/nvim/init.lua

38 lines
1.1 KiB
Lua

local version_required = 'nvim-0.7.0'
-- 0.7.0 features we need:
-- - autocommands in Lua
-- - bind key mappings directly to Lua functions
if vim.fn.has(version_required) == 0 then
print("💥 need " .. version_required .. ", config files will NOT be read!")
return nil
end
require('my/plugins')
require('my.functions')
require('my/settings')
require('my/keymaps')
require('my/filetypes')
require('my/completion')
require('my/lsp')
require('my/tools')
require('my/coding')
require('my/net')
-- reload config file after writing
vim.api.nvim_create_augroup('config_init', { clear = true })
vim.api.nvim_create_autocmd(
{ 'BufWritePost' },
{
group = 'config_init',
pattern = {
vim.fn.stdpath('config') .. '/lua/my/*.lua',
vim.fn.stdpath('config') .. '/init.lua'
},
callback = function()
-- exclude plugins.lua, because it is sourced in another autocmd
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
vim.cmd([[source <afile>]])
end
end
})