From 7e5b575053e4f66314349eb766d636d90e74f828 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Thu, 4 Jan 2024 10:01:01 -0700 Subject: [PATCH] Restructure neovim config. --- users/jrpotter/default.nix | 2 +- users/jrpotter/lang/bash.nix | 2 +- users/jrpotter/lang/{c.nix => cxx.nix} | 6 +++--- users/jrpotter/lang/elixir.nix | 2 +- users/jrpotter/lang/lean.nix | 2 +- users/jrpotter/lang/lua.nix | 2 +- users/jrpotter/lang/markdown.nix | 2 +- users/jrpotter/lang/nix.nix | 2 +- users/jrpotter/lang/python.nix | 6 +++--- users/jrpotter/lang/typescript.nix | 4 ++-- .../neovim/{lua/init/c.lua => config/cxx/init.lua} | 2 +- users/jrpotter/neovim/{lua => config}/default.nix | 0 .../{lua/init/lua.lua => config/lua/init.lua} | 2 +- .../init/python.lua => config/python/init.lua} | 2 +- .../neovim/{lua/init => config/utils}/cmp.lua | 0 .../neovim/{lua/init => config/utils}/dap.lua | 0 .../neovim/{lua/init => config/utils}/lsp.lua | 0 .../{lua/init => config/utils}/statusline.lua | 0 .../{lua/init => config/utils}/telescope.lua | 0 .../{lua/init => config/utils}/treesitter.lua | 0 users/jrpotter/neovim/default.nix | 14 +++++++------- 21 files changed, 25 insertions(+), 25 deletions(-) rename users/jrpotter/lang/{c.nix => cxx.nix} (82%) rename users/jrpotter/neovim/{lua/init/c.lua => config/cxx/init.lua} (92%) rename users/jrpotter/neovim/{lua => config}/default.nix (100%) rename users/jrpotter/neovim/{lua/init/lua.lua => config/lua/init.lua} (94%) rename users/jrpotter/neovim/{lua/init/python.lua => config/python/init.lua} (94%) rename users/jrpotter/neovim/{lua/init => config/utils}/cmp.lua (100%) rename users/jrpotter/neovim/{lua/init => config/utils}/dap.lua (100%) rename users/jrpotter/neovim/{lua/init => config/utils}/lsp.lua (100%) rename users/jrpotter/neovim/{lua/init => config/utils}/statusline.lua (100%) rename users/jrpotter/neovim/{lua/init => config/utils}/telescope.lua (100%) rename users/jrpotter/neovim/{lua/init => config/utils}/treesitter.lua (100%) diff --git a/users/jrpotter/default.nix b/users/jrpotter/default.nix index 63e9b07..eb99024 100644 --- a/users/jrpotter/default.nix +++ b/users/jrpotter/default.nix @@ -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 diff --git a/users/jrpotter/lang/bash.nix b/users/jrpotter/lang/bash.nix index 8bc3ba7..c06427c 100644 --- a/users/jrpotter/lang/bash.nix +++ b/users/jrpotter/lang/bash.nix @@ -7,7 +7,7 @@ programs.neovim = { nvim-lspconfig = '' - require('init.lsp').setup(require('lspconfig').bashls) {} + require('utils.lsp').setup(require('lspconfig').bashls) {} ''; }; } diff --git a/users/jrpotter/lang/c.nix b/users/jrpotter/lang/cxx.nix similarity index 82% rename from users/jrpotter/lang/c.nix rename to users/jrpotter/lang/cxx.nix index fe77088..445de89 100644 --- a/users/jrpotter/lang/c.nix +++ b/users/jrpotter/lang/cxx.nix @@ -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() ''; } diff --git a/users/jrpotter/lang/elixir.nix b/users/jrpotter/lang/elixir.nix index ab45918..46137cb 100644 --- a/users/jrpotter/lang/elixir.nix +++ b/users/jrpotter/lang/elixir.nix @@ -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' }, } ''; diff --git a/users/jrpotter/lang/lean.nix b/users/jrpotter/lang/lean.nix index e94340a..b28c24c 100644 --- a/users/jrpotter/lang/lean.nix +++ b/users/jrpotter/lang/lean.nix @@ -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, } diff --git a/users/jrpotter/lang/lua.nix b/users/jrpotter/lang/lua.nix index ca60ec4..60561f6 100644 --- a/users/jrpotter/lang/lua.nix +++ b/users/jrpotter/lang/lua.nix @@ -6,7 +6,7 @@ programs.neovim = { nvim-lspconfig = '' - require('init.lua').nvim_lspconfig() + require('lua.init').nvim_lspconfig() ''; }; } diff --git a/users/jrpotter/lang/markdown.nix b/users/jrpotter/lang/markdown.nix index 3cee2aa..18fe1c7 100644 --- a/users/jrpotter/lang/markdown.nix +++ b/users/jrpotter/lang/markdown.nix @@ -6,7 +6,7 @@ programs.neovim = { nvim-lspconfig = '' - require('init.lsp').setup(require('lspconfig').marksman) {} + require('utils.lsp').setup(require('lspconfig').marksman) {} ''; }; } diff --git a/users/jrpotter/lang/nix.nix b/users/jrpotter/lang/nix.nix index 5dcb342..58d94e2 100644 --- a/users/jrpotter/lang/nix.nix +++ b/users/jrpotter/lang/nix.nix @@ -6,7 +6,7 @@ programs.neovim = { nvim-lspconfig = '' - require('init.lsp').setup(require('lspconfig').nil_ls) {} + require('utils.lsp').setup(require('lspconfig').nil_ls) {} ''; }; } diff --git a/users/jrpotter/lang/python.nix b/users/jrpotter/lang/python.nix index 9d9195e..fab4a7a 100644 --- a/users/jrpotter/lang/python.nix +++ b/users/jrpotter/lang/python.nix @@ -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() ''; } diff --git a/users/jrpotter/lang/typescript.nix b/users/jrpotter/lang/typescript.nix index 0abe968..de03a60 100644 --- a/users/jrpotter/lang/typescript.nix +++ b/users/jrpotter/lang/typescript.nix @@ -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', "PrettierAsync", { silent = true, diff --git a/users/jrpotter/neovim/lua/init/c.lua b/users/jrpotter/neovim/config/cxx/init.lua similarity index 92% rename from users/jrpotter/neovim/lua/init/c.lua rename to users/jrpotter/neovim/config/cxx/init.lua index 94e0ed7..08f6e83 100644 --- a/users/jrpotter/neovim/lua/init/c.lua +++ b/users/jrpotter/neovim/config/cxx/init.lua @@ -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 diff --git a/users/jrpotter/neovim/lua/default.nix b/users/jrpotter/neovim/config/default.nix similarity index 100% rename from users/jrpotter/neovim/lua/default.nix rename to users/jrpotter/neovim/config/default.nix diff --git a/users/jrpotter/neovim/lua/init/lua.lua b/users/jrpotter/neovim/config/lua/init.lua similarity index 94% rename from users/jrpotter/neovim/lua/init/lua.lua rename to users/jrpotter/neovim/config/lua/init.lua index 4e6787c..c0096e0 100644 --- a/users/jrpotter/neovim/lua/init/lua.lua +++ b/users/jrpotter/neovim/config/lua/init.lua @@ -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 diff --git a/users/jrpotter/neovim/lua/init/python.lua b/users/jrpotter/neovim/config/python/init.lua similarity index 94% rename from users/jrpotter/neovim/lua/init/python.lua rename to users/jrpotter/neovim/config/python/init.lua index da932a2..f8eaf66 100644 --- a/users/jrpotter/neovim/lua/init/python.lua +++ b/users/jrpotter/neovim/config/python/init.lua @@ -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 diff --git a/users/jrpotter/neovim/lua/init/cmp.lua b/users/jrpotter/neovim/config/utils/cmp.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/cmp.lua rename to users/jrpotter/neovim/config/utils/cmp.lua diff --git a/users/jrpotter/neovim/lua/init/dap.lua b/users/jrpotter/neovim/config/utils/dap.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/dap.lua rename to users/jrpotter/neovim/config/utils/dap.lua diff --git a/users/jrpotter/neovim/lua/init/lsp.lua b/users/jrpotter/neovim/config/utils/lsp.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/lsp.lua rename to users/jrpotter/neovim/config/utils/lsp.lua diff --git a/users/jrpotter/neovim/lua/init/statusline.lua b/users/jrpotter/neovim/config/utils/statusline.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/statusline.lua rename to users/jrpotter/neovim/config/utils/statusline.lua diff --git a/users/jrpotter/neovim/lua/init/telescope.lua b/users/jrpotter/neovim/config/utils/telescope.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/telescope.lua rename to users/jrpotter/neovim/config/utils/telescope.lua diff --git a/users/jrpotter/neovim/lua/init/treesitter.lua b/users/jrpotter/neovim/config/utils/treesitter.lua similarity index 100% rename from users/jrpotter/neovim/lua/init/treesitter.lua rename to users/jrpotter/neovim/config/utils/treesitter.lua diff --git a/users/jrpotter/neovim/default.nix b/users/jrpotter/neovim/default.nix index e119d7d..8b23b20 100644 --- a/users/jrpotter/neovim/default.nix +++ b/users/jrpotter/neovim/default.nix @@ -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 ''