refactor(nvim): split up init.lua

This commit is contained in:
Michael Mandl 2024-07-29 13:13:03 +02:00
parent 5a01031a10
commit 4d111dd744
Signed by: mandlm
GPG key ID: 088ED38F036C7AF2
3 changed files with 73 additions and 46 deletions

View file

@ -132,43 +132,32 @@
vimwiki-markdown
];
extraLuaPackages = luaPackages: [
luaPackages.lua-utils-nvim
luaPackages.pathlib-nvim
];
extraLuaConfig = ''
${builtins.readFile ./keymaps.lua }
${builtins.readFile ./options.lua }
${builtins.readFile ./commands.lua }
${builtins.readFile ./treesitter.lua }
${builtins.readFile ./lspconfig.lua }
${builtins.readFile ./auto-session.lua }
${builtins.readFile ./toggleterm.lua }
${builtins.readFile ./notify.lua }
${builtins.readFile ./comment.lua }
${builtins.readFile ./lualine.lua }
${builtins.readFile ./tabline.lua }
${builtins.readFile ./indent-blankline.lua }
${builtins.readFile ./gitsigns.lua }
${builtins.readFile ./luasnip.lua }
${builtins.readFile ./nvim-cmp.lua }
${builtins.readFile ./telescope.lua }
require("local_keymaps")
require("local_options")
require("local_commands")
require("local_treesitter")
require("local_lspconfig")
require("local_auto-session")
require("local_toggleterm")
require("local_notify")
require("local_comment")
require("local_lualine")
require("local_tabline")
require("local_indent-blankline")
require("local_gitsigns")
require("local_luasnip")
require("local_nvim-cmp")
require("local_telescope")
do
local vim_theme = "${theme}";
${builtins.readFile ./themes.lua }
end
require("local_themes").setup("${theme}")
${builtins.readFile ./project-nvim.lua }
${builtins.readFile ./dap.lua }
${builtins.readFile ./illuminate.lua }
${builtins.readFile ./wilder.lua }
require("local_project-nvim")
require("local_dap")
require("local_illuminate")
require("local_wilder")
do
local vimwiki_path = "${vimwikiPath}"
${builtins.readFile ./vimwiki.lua }
end
require("local_vimwiki").setup("${vimwikiPath}")
vim.g.gitblame_date_format = "%r"
@ -177,4 +166,29 @@
'';
};
};
home.file.".config/nvim/lua/local_keymaps.lua".source = ./keymaps.lua;
home.file.".config/nvim/lua/local_options.lua".source = ./options.lua;
home.file.".config/nvim/lua/local_commands.lua".source = ./commands.lua;
home.file.".config/nvim/lua/local_treesitter.lua".source = ./treesitter.lua;
home.file.".config/nvim/lua/local_lspconfig.lua".source = ./lspconfig.lua;
home.file.".config/nvim/lua/local_auto-session.lua".source = ./auto-session.lua;
home.file.".config/nvim/lua/local_toggleterm.lua".source = ./toggleterm.lua;
home.file.".config/nvim/lua/local_notify.lua".source = ./notify.lua;
home.file.".config/nvim/lua/local_comment.lua".source = ./comment.lua;
home.file.".config/nvim/lua/local_lualine.lua".source = ./lualine.lua;
home.file.".config/nvim/lua/local_tabline.lua".source = ./tabline.lua;
home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua;
home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua;
home.file.".config/nvim/lua/local_luasnip.lua".source = ./luasnip.lua;
home.file.".config/nvim/lua/local_nvim-cmp.lua".source = ./nvim-cmp.lua;
home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua;
home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua;
home.file.".config/nvim/lua/local_vimwiki.lua".source = ./vimwiki.lua;
home.file.".config/nvim/lua/local_project-nvim.lua".source = ./project-nvim.lua;
home.file.".config/nvim/lua/local_dap.lua".source = ./dap.lua;
home.file.".config/nvim/lua/local_illuminate.lua".source = ./illuminate.lua;
home.file.".config/nvim/lua/local_wilder.lua".source = ./wilder.lua;
}

View file

@ -1,2 +1,8 @@
vim.cmd("colorscheme solarized")
vim.opt.background = vim_theme
local module = {}
function module.setup(theme)
vim.cmd("colorscheme solarized")
vim.opt.background = theme
end
return module

View file

@ -1,12 +1,19 @@
vim.g.vimwiki_list = {
{
path = vimwiki_path,
syntax = "markdown",
ext = ".md",
path_html = "~/vimwiki_html",
custom_wiki2html = "vimwiki_markdown",
}
}
local mymodule = {}
-- disable global markdown hijacking
vim.g.vimwiki_global_ext = 0
function mymodule.setup(path)
vim.g.vimwiki_list = {
{
path = path,
syntax = "markdown",
ext = ".md",
path_html = "~/vimwiki_html",
custom_wiki2html = "vimwiki_markdown",
diary_frequency = "monthly",
}
}
-- disable global markdown hijacking
vim.g.vimwiki_global_ext = 0
end
return mymodule