Restructure neovim config.

main
Joshua Potter 2024-01-04 10:01:01 -07:00
parent a97fddb3b3
commit 7e5b575053
21 changed files with 25 additions and 25 deletions

View File

@ -8,7 +8,7 @@ in
./bash
./git.nix
./lang/bash.nix
./lang/c.nix
./lang/cxx.nix
./lang/elixir.nix
./lang/lean.nix
./lang/lua.nix

View File

@ -7,7 +7,7 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lsp').setup(require('lspconfig').bashls) {}
require('utils.lsp').setup(require('lspconfig').bashls) {}
'';
};
}

View File

@ -15,11 +15,11 @@ in
programs.neovim = {
nvim-dap = ''
require('init.c').nvim_dap()
require('cxx.init').nvim_dap()
'';
nvim-lspconfig = ''
require('init.c').nvim_lspconfig()
require('cxx.init').nvim_lspconfig()
vim.filetype.add({
pattern = {
@ -30,6 +30,6 @@ in
};
xdg.configFile."nvim/after/ftplugin/c.lua".text = ''
require('init.dap').buffer_map()
require('utils.dap').buffer_map()
'';
}

View File

@ -6,7 +6,7 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lsp').setup(require('lspconfig').elixirls) {
require('utils.lsp').setup(require('lspconfig').elixirls) {
cmd = { 'elixir-ls' },
}
'';

View File

@ -8,7 +8,7 @@ let
"Julian/lean.nvim";
config = ''
lua << EOF
require('init.lsp').setup(require('lean')) {
require('utils.lsp').setup(require('lean')) {
abbreviations = { builtin = true },
mappings = true,
}

View File

@ -6,7 +6,7 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lua').nvim_lspconfig()
require('lua.init').nvim_lspconfig()
'';
};
}

View File

@ -6,7 +6,7 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lsp').setup(require('lspconfig').marksman) {}
require('utils.lsp').setup(require('lspconfig').marksman) {}
'';
};
}

View File

@ -6,7 +6,7 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lsp').setup(require('lspconfig').nil_ls) {}
require('utils.lsp').setup(require('lspconfig').nil_ls) {}
'';
};
}

View File

@ -13,15 +13,15 @@
programs.neovim = {
nvim-dap = ''
require('init.python').nvim_dap()
require('python.init').nvim_dap()
'';
nvim-lspconfig = ''
require('init.python').nvim_lspconfig()
require('python.init').nvim_lspconfig()
'';
};
xdg.configFile."nvim/after/ftplugin/python.lua".text = ''
require('init.dap').buffer_map()
require('utils.dap').buffer_map()
'';
}

View File

@ -7,9 +7,9 @@
programs.neovim = {
nvim-lspconfig = ''
require('init.lsp').setup(require('lspconfig').tsserver) {
require('utils.lsp').setup(require('lspconfig').tsserver) {
on_attach = function(client, bufnr)
require('init.lsp').on_attach(client, bufnr)
require('utils.lsp').on_attach(client, bufnr)
-- Override the default formatter in typescript-language-server.
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gq', "<CMD>PrettierAsync<CR>", {
silent = true,

View File

@ -31,7 +31,7 @@ function M.nvim_dap()
end
function M.nvim_lspconfig()
require('init.lsp').setup(require('lspconfig').clangd) {}
require('utils.lsp').setup(require('lspconfig').clangd) {}
end
return M

View File

@ -1,7 +1,7 @@
local M = {}
function M.nvim_lspconfig()
require('init.lsp').setup(require('lspconfig').lua_ls) {
require('utils.lsp').setup(require('lspconfig').lua_ls) {
-- Provide completions, analysis, and location handling for plugins on the
-- vim runtime path.
-- https://github.com/neovim/nvim-lspconfig/blob/48347089666d5b77d054088aa72e4e0b58026e6e/doc/server_configurations.md#lua_ls

View File

@ -24,7 +24,7 @@ function M.nvim_dap()
end
function M.nvim_lspconfig()
require('init.lsp').setup(require('lspconfig').pylsp) {
require('utils.lsp').setup(require('lspconfig').pylsp) {
settings = {
pylsp = {
-- `flake8` currently fails in some cases. Prefer the default set of

View File

@ -18,8 +18,8 @@ let
sections = {
lualine_x = {'encoding', 'filetype'},
lualine_y = {
require('init.statusline').get_active_lsp,
require('init.statusline').get_dap_status,
require('utils.statusline').get_active_lsp,
require('utils.statusline').get_dap_status,
},
lualine_z = {'%c:%l:%%%p'},
},
@ -30,7 +30,7 @@ let
nvim-cmp = {
plugin = pkgs.vimPlugins.nvim-cmp;
config = ''
require('init.cmp').setup()
require('utils.cmp').setup()
'';
};
@ -52,7 +52,7 @@ let
nvim-telescope = {
plugin = pkgs.vimPlugins.telescope-nvim;
config = ''
require('init.telescope').setup()
require('utils.telescope').setup()
'';
};
@ -72,7 +72,7 @@ let
]
));
config = ''
require('init.treesitter').setup()
require('utils.treesitter').setup()
'';
};
in
@ -131,13 +131,13 @@ in
xdg.configFile."nvim/init.lua".text =
let
lua = import ./lua { inherit pkgs; };
config = import ./config { inherit pkgs; };
in
lib.mkMerge [
# Extra Lua configuration to be prepended to `init.lua`. Extend the
# Lua loader to search for our /nix/store/.../?.lua files.
(lib.mkBefore ''
package.path = '${lua}/?.lua;' .. package.path
package.path = '${config}/?.lua;' .. package.path
'')
# Extra Lua configuration to be appended to `init.lua`.
(lib.mkAfter ''