dotfiles/.config/nvim/init.lua

44 lines
1.3 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
-- - desc in keymaps
if vim.fn.has(version_required) == 0 then
print("💥 need " .. version_required .. ", config files will NOT be read!")
return nil
end
-- use the vim plugins installed via the OS package manager
if vim.fn.isdirectory('/usr/share/vim/vimfiles') == 1 then
vim.opt.runtimepath:append('/usr/share/vim/vimfiles')
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/git')
require('my/net')
require('my/commands')
-- 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
})