From 0f11ababe4468995f65ff288a8bd7aa227d7afde Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 2 Jan 2024 23:23:23 -0500 Subject: [PATCH] rearrange some stuff, switch themes --- modules/home-manager/common/all-cli.nix | 2 +- .../config/{keymaps.lua => vim-options.lua} | 3 + .../{plugins => disabled/themes}/dracula.lua | 2 +- .../files/nvim/lua/plugins/alpha.lua | 1 - .../themes => plugins}/catppuccin.lua | 2 +- .../files/nvim/lua/plugins/lsp-config.lua | 58 +++++++++++++++++++ .../files/nvim/lua/plugins/lualine.lua | 18 +++--- .../nvim/lua/plugins/mason-lspconfig.lua | 14 ----- .../files/nvim/lua/plugins/mason-null-ls.lua | 17 ------ .../files/nvim/lua/plugins/mason.lua | 1 - .../files/nvim/lua/plugins/neo-tree.lua | 17 +++--- .../files/nvim/lua/plugins/none-ls.lua | 58 +++++++++++++------ .../files/nvim/lua/plugins/nvim-lspconfig.lua | 38 ------------ .../nvim/lua/plugins/nvim-web-devicons.lua | 5 +- .../nvim/lua/plugins/telescope-cheat.lua | 7 --- .../nvim/lua/plugins/telescope-symbols.lua | 1 - .../nvim/lua/plugins/telescope-ui-select.lua | 3 - .../files/nvim/lua/plugins/telescope.lua | 57 ++++++++++-------- .../files/nvim/lua/plugins/todo-comments.lua | 9 +++ .../files/nvim/lua/plugins/treesitter.lua | 12 ++-- .../files/nvim/lua/plugins/trouble.lua | 6 +- .../nvim/lua/plugins/vim-tmux-navigator.lua | 2 +- .../files/nvim/lua/plugins/which-key.lua | 5 +- 23 files changed, 183 insertions(+), 155 deletions(-) rename modules/home-manager/files/nvim/lua/config/{keymaps.lua => vim-options.lua} (91%) rename modules/home-manager/files/nvim/lua/{plugins => disabled/themes}/dracula.lua (74%) rename modules/home-manager/files/nvim/lua/{disabled/themes => plugins}/catppuccin.lua (82%) create mode 100644 modules/home-manager/files/nvim/lua/plugins/lsp-config.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/mason-lspconfig.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/mason-null-ls.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/mason.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/nvim-lspconfig.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/telescope-cheat.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/telescope-symbols.lua delete mode 100644 modules/home-manager/files/nvim/lua/plugins/telescope-ui-select.lua create mode 100644 modules/home-manager/files/nvim/lua/plugins/todo-comments.lua diff --git a/modules/home-manager/common/all-cli.nix b/modules/home-manager/common/all-cli.nix index 44cff71..ec6f0de 100644 --- a/modules/home-manager/common/all-cli.nix +++ b/modules/home-manager/common/all-cli.nix @@ -119,7 +119,7 @@ in { end -- load additional settings - require("config.keymaps") + require("config.vim-options") require("lazy").setup("plugins") -- tell sqlite.lua where to find the bits it needs diff --git a/modules/home-manager/files/nvim/lua/config/keymaps.lua b/modules/home-manager/files/nvim/lua/config/vim-options.lua similarity index 91% rename from modules/home-manager/files/nvim/lua/config/keymaps.lua rename to modules/home-manager/files/nvim/lua/config/vim-options.lua index 0a1e7e2..7c9bcc5 100644 --- a/modules/home-manager/files/nvim/lua/config/keymaps.lua +++ b/modules/home-manager/files/nvim/lua/config/vim-options.lua @@ -12,3 +12,6 @@ vim.opt.shiftwidth = 2 vim.opt.shiftround = true vim.keymap.set("n", "h", ":nohlsearch") + +vim.wo.relativenumber = true + diff --git a/modules/home-manager/files/nvim/lua/plugins/dracula.lua b/modules/home-manager/files/nvim/lua/disabled/themes/dracula.lua similarity index 74% rename from modules/home-manager/files/nvim/lua/plugins/dracula.lua rename to modules/home-manager/files/nvim/lua/disabled/themes/dracula.lua index 4634bbf..59a11d2 100644 --- a/modules/home-manager/files/nvim/lua/plugins/dracula.lua +++ b/modules/home-manager/files/nvim/lua/disabled/themes/dracula.lua @@ -3,6 +3,6 @@ return { lazy = false, priority = 1000, config = function() - vim.cmd.colorscheme "dracula" + vim.cmd.colorscheme("dracula") end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/alpha.lua b/modules/home-manager/files/nvim/lua/plugins/alpha.lua index a8c25f5..d6638ae 100644 --- a/modules/home-manager/files/nvim/lua/plugins/alpha.lua +++ b/modules/home-manager/files/nvim/lua/plugins/alpha.lua @@ -29,4 +29,3 @@ return { alpha.setup(dashboard.opts) end, } - diff --git a/modules/home-manager/files/nvim/lua/disabled/themes/catppuccin.lua b/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua similarity index 82% rename from modules/home-manager/files/nvim/lua/disabled/themes/catppuccin.lua rename to modules/home-manager/files/nvim/lua/plugins/catppuccin.lua index 124a53e..8c163ce 100644 --- a/modules/home-manager/files/nvim/lua/disabled/themes/catppuccin.lua +++ b/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua @@ -5,6 +5,6 @@ return { lazy = false, priority = 1000, config = function() - vim.cmd.colorscheme "catppuccin" + vim.cmd.colorscheme("catppuccin") end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua b/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..1a3adb5 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,58 @@ +return { + { + "williamboman/mason.nvim", + config = true, + }, + { + "williamboman/mason-lspconfig.nvim", + config = function() + require("mason-lspconfig").setup({ + ensure_installed = { + "lua_ls", -- lua + "nil_ls", -- nix + "puppet", -- puppet + "ruff_lsp", -- python + }, + }) + end, + }, + { + "neovim/nvim-lspconfig", + config = function() + local on_attach = function(_, _) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {}) + vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, {}) + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + end + + local lspconfig = require("lspconfig") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + lspconfig.lua_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { Lua = { diagnostics = { globals = { "vim" } } } }, + }) + + lspconfig.nil_ls.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + local puppet_languageserver = vim.fn.expand( + "$HOME/.local/share/nvim/mason/packages/puppet-editor-services/libexec/puppet-languageserver" + ) + + lspconfig.puppet.setup({ + capabilities = capabilities, + on_attach = on_attach, + cmd = { puppet_languageserver }, + }) + lspconfig.ruff_lsp.setup({ on_attach = on_attach }) + end, + }, +} diff --git a/modules/home-manager/files/nvim/lua/plugins/lualine.lua b/modules/home-manager/files/nvim/lua/plugins/lualine.lua index bbf0077..757df1f 100644 --- a/modules/home-manager/files/nvim/lua/plugins/lualine.lua +++ b/modules/home-manager/files/nvim/lua/plugins/lualine.lua @@ -1,19 +1,19 @@ return { "nvim-lualine/lualine.nvim", - config = function () - require('lualine').setup { + config = function() + require("lualine").setup({ options = { icons_enabled = true, - theme = 'dracula-nvim', + -- theme = "dracula-nvim", }, sections = { lualine_a = { { - 'filename', + "filename", path = 1, - } - } - } - } - end + }, + }, + }, + }) + end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/mason-lspconfig.lua b/modules/home-manager/files/nvim/lua/plugins/mason-lspconfig.lua deleted file mode 100644 index 1b5dfba..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/mason-lspconfig.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - "williamboman/mason-lspconfig.nvim", - config = function() - require("mason-lspconfig").setup({ - ensure_installed = { - "lua_ls", -- lua - "nil_ls", -- nix - "puppet", -- puppet - "ruff_lsp", -- python - } - }) - end -} - diff --git a/modules/home-manager/files/nvim/lua/plugins/mason-null-ls.lua b/modules/home-manager/files/nvim/lua/plugins/mason-null-ls.lua deleted file mode 100644 index 25a2812..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/mason-null-ls.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "jay-babu/mason-null-ls.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "williamboman/mason.nvim", - "nvimtools/none-ls.nvim", - }, - config = function() - require("mason-null-ls").setup({ - ensure_installed = { - "prettier", -- HTML, JS, JSON, etc. - "ruff", -- Pyhton - "stylua", -- LUA - }, - }) - end, -} diff --git a/modules/home-manager/files/nvim/lua/plugins/mason.lua b/modules/home-manager/files/nvim/lua/plugins/mason.lua deleted file mode 100644 index 9d5d40a..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/mason.lua +++ /dev/null @@ -1 +0,0 @@ -return { "williamboman/mason.nvim", config = true } diff --git a/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua b/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua index fa0bdf3..bb2b2d1 100644 --- a/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua +++ b/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua @@ -7,19 +7,22 @@ return { "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", }, - config = function () + config = function() vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 - vim.keymap.set('n', '', ':Neotree toggle', {}) + vim.keymap.set("n", "", ":Neotree toggle", {}) require("neo-tree").setup({ filesystem = { - hijack_netrw_behavior = "open_default" + follow_current_file = { + enabled = true, + }, + hijack_netrw_behavior = "open_default", }, - follow_current_file = { enabled = true }, + follow_current_file = { enabled = true }, source_selector = { winbar = true, - statusline = false - } + statusline = false, + }, }) - end + end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/none-ls.lua b/modules/home-manager/files/nvim/lua/plugins/none-ls.lua index 0c831fa..f8b97d2 100644 --- a/modules/home-manager/files/nvim/lua/plugins/none-ls.lua +++ b/modules/home-manager/files/nvim/lua/plugins/none-ls.lua @@ -1,23 +1,43 @@ return { - "nvimtools/none-ls.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - local null_ls = require("null-ls") + { + "jay-babu/mason-null-ls.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "williamboman/mason.nvim", + "nvimtools/none-ls.nvim", + }, + config = function() + require("mason-null-ls").setup({ + ensure_installed = { + "prettier", -- HTML, JS, JSON, etc. + "ruff", -- Pyhton + "stylua", -- LUA + }, + }) + end, + }, + { + -- none-ls replaces null_ls... it's weird + "nvimtools/none-ls.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.completion.spell, - null_ls.builtins.diagnostics.puppet_lint, - null_ls.builtins.diagnostics.rubocop, - null_ls.builtins.diagnostics.ruff, - null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.puppet_lint, - null_ls.builtins.formatting.rubocop, - null_ls.builtins.formatting.ruff_format, - null_ls.builtins.formatting.stylua, - }, - }) + null_ls.setup({ + sources = { + null_ls.builtins.completion.spell, + null_ls.builtins.diagnostics.puppet_lint, + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.diagnostics.ruff, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.puppet_lint, + null_ls.builtins.formatting.rubocop, + null_ls.builtins.formatting.ruff_format, + null_ls.builtins.formatting.stylua, + }, + }) - vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) - end, + vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + end, + }, } diff --git a/modules/home-manager/files/nvim/lua/plugins/nvim-lspconfig.lua b/modules/home-manager/files/nvim/lua/plugins/nvim-lspconfig.lua deleted file mode 100644 index 0eed65b..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/nvim-lspconfig.lua +++ /dev/null @@ -1,38 +0,0 @@ -return { - "neovim/nvim-lspconfig", - config = function() - local on_attach = function(_, _) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, {}) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) - - vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {}) - vim.keymap.set("n", "gr", require("telescope.builtin").lsp_references, {}) - vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) - end - - local lspconfig = require("lspconfig") - local capabilities = require("cmp_nvim_lsp").default_capabilities() - - lspconfig.lua_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = { Lua = { diagnostics = { globals = { "vim" } } } }, - }) - - lspconfig.nil_ls.setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - - local puppet_languageserver = - vim.fn.expand("$HOME/.local/share/nvim/mason/packages/puppet-editor-services/libexec/puppet-languageserver") - - lspconfig.puppet.setup({ - capabilities = capabilities, - on_attach = on_attach, - cmd = { puppet_languageserver }, - }) - lspconfig.ruff_lsp.setup({ on_attach = on_attach }) - end, -} diff --git a/modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua b/modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua index ed57733..952c910 100644 --- a/modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua +++ b/modules/home-manager/files/nvim/lua/plugins/nvim-web-devicons.lua @@ -1 +1,4 @@ -return { "nvim-tree/nvim-web-devicons", config = true } +return { + "nvim-tree/nvim-web-devicons", + config = true, +} diff --git a/modules/home-manager/files/nvim/lua/plugins/telescope-cheat.lua b/modules/home-manager/files/nvim/lua/plugins/telescope-cheat.lua deleted file mode 100644 index 263ea37..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/telescope-cheat.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "nvim-telescope/telescope-cheat.nvim", - dependencies = { - "kkharji/sqlite.lua", - "nvim-telescope/telescope.nvim", - }, -} diff --git a/modules/home-manager/files/nvim/lua/plugins/telescope-symbols.lua b/modules/home-manager/files/nvim/lua/plugins/telescope-symbols.lua deleted file mode 100644 index 322ccc0..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/telescope-symbols.lua +++ /dev/null @@ -1 +0,0 @@ -return { "nvim-telescope/telescope-symbols.nvim" } diff --git a/modules/home-manager/files/nvim/lua/plugins/telescope-ui-select.lua b/modules/home-manager/files/nvim/lua/plugins/telescope-ui-select.lua deleted file mode 100644 index 5458189..0000000 --- a/modules/home-manager/files/nvim/lua/plugins/telescope-ui-select.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "nvim-telescope/telescope-ui-select.nvim", -} diff --git a/modules/home-manager/files/nvim/lua/plugins/telescope.lua b/modules/home-manager/files/nvim/lua/plugins/telescope.lua index 7ced43b..8fb81ae 100644 --- a/modules/home-manager/files/nvim/lua/plugins/telescope.lua +++ b/modules/home-manager/files/nvim/lua/plugins/telescope.lua @@ -1,29 +1,40 @@ return { - "nvim-telescope/telescope.nvim", - tag = "0.1.5", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - -- This is your opts table - require("telescope").setup({ - extensions = { - ["ui-select"] = { - require("telescope.themes").get_dropdown({ - -- even more opts - }), + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + -- This is your opts table + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + }, }, - }, - }) + }) - -- load_extension, somewhere after setup function: - require("telescope").load_extension("cheat") - require("telescope").load_extension("ui-select") + -- load_extension, somewhere after setup function: + require("telescope").load_extension("cheat") + require("telescope").load_extension("ui-select") - local builtin = require("telescope.builtin") + local builtin = require("telescope.builtin") - vim.keymap.set("n", "ts", ":Telescope") - vim.keymap.set("n", "", builtin.find_files, {}) - vim.keymap.set("n", "", builtin.oldfiles, {}) - vim.keymap.set("n", "fg", builtin.live_grep, {}) - vim.keymap.set("n", "fh", builtin.help_tags, {}) - end, + vim.keymap.set("n", "ts", ":Telescope") + vim.keymap.set("n", "", builtin.find_files, {}) + vim.keymap.set("n", "", builtin.oldfiles, {}) + vim.keymap.set("n", "fg", builtin.live_grep, {}) + vim.keymap.set("n", "fh", builtin.help_tags, {}) + end, + }, + { + "nvim-telescope/telescope-cheat.nvim", + dependencies = { + "kkharji/sqlite.lua", + "nvim-telescope/telescope.nvim", + }, + }, + { "nvim-telescope/telescope-symbols.nvim" }, + { "nvim-telescope/telescope-ui-select.nvim" }, } diff --git a/modules/home-manager/files/nvim/lua/plugins/todo-comments.lua b/modules/home-manager/files/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..52e52b6 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,9 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +} diff --git a/modules/home-manager/files/nvim/lua/plugins/treesitter.lua b/modules/home-manager/files/nvim/lua/plugins/treesitter.lua index f732616..7a7cc8b 100644 --- a/modules/home-manager/files/nvim/lua/plugins/treesitter.lua +++ b/modules/home-manager/files/nvim/lua/plugins/treesitter.lua @@ -1,9 +1,9 @@ -return { +return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", - config = function () - local config = require('nvim-treesitter.configs') - config.setup { + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ auto_install = true, highlight = { enable = true }, indent = { enable = true }, @@ -48,6 +48,6 @@ return { "xml", "yaml", }, - } - end + }) + end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/trouble.lua b/modules/home-manager/files/nvim/lua/plugins/trouble.lua index be3f6f1..de1f2e4 100644 --- a/modules/home-manager/files/nvim/lua/plugins/trouble.lua +++ b/modules/home-manager/files/nvim/lua/plugins/trouble.lua @@ -1,5 +1,5 @@ return { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = true, + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = true, } diff --git a/modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua b/modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua index d0865ab..07ec90a 100644 --- a/modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua +++ b/modules/home-manager/files/nvim/lua/plugins/vim-tmux-navigator.lua @@ -1,3 +1,3 @@ return { - "christoomey/vim-tmux-navigator" + "christoomey/vim-tmux-navigator", } diff --git a/modules/home-manager/files/nvim/lua/plugins/which-key.lua b/modules/home-manager/files/nvim/lua/plugins/which-key.lua index ce78289..60cf348 100644 --- a/modules/home-manager/files/nvim/lua/plugins/which-key.lua +++ b/modules/home-manager/files/nvim/lua/plugins/which-key.lua @@ -1 +1,4 @@ -return { "folke/which-key.nvim", config = true } +return { + "folke/which-key.nvim", + config = true, +}