diff --git a/home-manager/opdavies/PW05CH3L.nix b/home-manager/opdavies/PW05CH3L.nix index 5ed05f48..da7d9eeb 100644 --- a/home-manager/opdavies/PW05CH3L.nix +++ b/home-manager/opdavies/PW05CH3L.nix @@ -14,7 +14,6 @@ }; coding = { - neovim.enable = true; phpactor.enable = true; }; }; diff --git a/home-manager/opdavies/t480.nix b/home-manager/opdavies/t480.nix index 9d855bb7..b1766be5 100644 --- a/home-manager/opdavies/t480.nix +++ b/home-manager/opdavies/t480.nix @@ -20,7 +20,6 @@ }; coding = { - neovim.enable = true; phpactor.enable = true; }; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 2308c22b..b29c1831 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -12,7 +12,6 @@ ./gtk.nix ./media/handbrake.nix ./media/mpv.nix - ./neovim ./node.nix ./phpactor ./ranger.nix diff --git a/modules/home-manager/neovim/config/default.nix b/modules/home-manager/neovim/config/default.nix deleted file mode 100644 index b2886b2d..00000000 --- a/modules/home-manager/neovim/config/default.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ pkgs, ... }: - -{ - # TODO: re-add DAP. - # TODO: re-add snippets. - # TODO: re-configure spell. - - imports = [ - ./keymaps.nix - ./options.nix - ./plugins/auto-save.nix - ./plugins/cmp.nix - ./plugins/conform.nix - ./plugins/fidget.nix - ./plugins/fugitive.nix - ./plugins/gitsigns.nix - ./plugins/harpoon.nix - ./plugins/lint.nix - ./plugins/lsp.nix - ./plugins/lualine.nix - ./plugins/luasnip.nix - ./plugins/mini.nix - ./plugins/oil.nix - ./plugins/phpactor.nix - ./plugins/refactoring.nix - ./plugins/telescope.nix - ./plugins/treesitter.nix - ./plugins/undotree.nix - ./plugins/vim-cool.nix - ./plugins/vim-dadbod.nix - ./plugins/vim-highlightedyank.nix - ./plugins/vim-test.nix - ./plugins/web-devicons.nix - ]; - - colorschemes.catppuccin = { - enable = true; - settings.flavour = "mocha"; - }; - - diagnostic.settings = { - signs = true; - underline = false; - update_in_insert = false; - virtual_text = { - enable = true; - spacing = 2; - }; - }; - - extraPackages = with pkgs; [ - nixfmt-rfc-style - stylua - ]; - - filetype = { - extension = { - "neon.dist" = "yaml"; - inc = "php"; - install = "php"; - module = "php"; - neon = "yaml"; - pcss = "scss"; - theme = "php"; - }; - - filename = { - "composer.lock" = "json"; - }; - }; - - globals.mapleader = " "; -} diff --git a/modules/home-manager/neovim/config/plugins/auto-save.nix b/modules/home-manager/neovim/config/plugins/auto-save.nix deleted file mode 100644 index 037f6c42..00000000 --- a/modules/home-manager/neovim/config/plugins/auto-save.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - plugins.auto-save.enable = true; - - plugins.auto-save.settings.condition = '' - function(buf) - local excluded_filetypes = { - "harpoon", - "oil", - } - - local excluded_filenames = {} - - if vim.tbl_contains(excluded_filetypes, vim.fn.getbufvar(buf, "&filetype")) - or vim.tbl_contains(excluded_filenames, vim.fn.expand("%:t")) - then - return false - end - - return true - end - ''; -} diff --git a/modules/home-manager/neovim/config/plugins/conform.nix b/modules/home-manager/neovim/config/plugins/conform.nix deleted file mode 100644 index 50dce5af..00000000 --- a/modules/home-manager/neovim/config/plugins/conform.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - plugins.conform-nvim.enable = true; -} diff --git a/modules/home-manager/neovim/config/plugins/fidget.nix b/modules/home-manager/neovim/config/plugins/fidget.nix deleted file mode 100644 index b18a7175..00000000 --- a/modules/home-manager/neovim/config/plugins/fidget.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - plugins.fidget.enable = true; -} diff --git a/modules/home-manager/neovim/config/plugins/fugitive.nix b/modules/home-manager/neovim/config/plugins/fugitive.nix deleted file mode 100644 index 87c01ce6..00000000 --- a/modules/home-manager/neovim/config/plugins/fugitive.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.fugitive.enable = true; - - keymaps = lib.mkIf config.plugins.fugitive.enable [ - { - key = "gc"; - action = "Git commitK"; - } - - { - # Open the ":Git" window in its own buffer, not a split. - key = "gs"; - action = "0Git"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/gitsigns.nix b/modules/home-manager/neovim/config/plugins/gitsigns.nix deleted file mode 100644 index 7c2d2b0b..00000000 --- a/modules/home-manager/neovim/config/plugins/gitsigns.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.gitsigns.enable = true; - - keymaps = lib.mkIf config.plugins.gitsigns.enable [ - { - action = "Gitsigns prev_hunk"; - key = "[h"; - } - - { - action = "Gitsigns next_hunk"; - key = "]h"; - } - - { - action = "Gitsigns reset_hunk"; - key = "hr"; - } - - { - action = "Gitsigns reset_buffer"; - key = "hR"; - } - - { - action = "Gitsigns stage_hunk"; - key = "hs"; - mode = [ - "n" - "v" - ]; - } - - { - action = "Gitsigns stage_buffer"; - key = "hS"; - mode = "n"; - } - - { - action = "Gitsigns undo_stage_hunk"; - key = "hu"; - mode = "x"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/lint.nix b/modules/home-manager/neovim/config/plugins/lint.nix deleted file mode 100644 index ff65a0d2..00000000 --- a/modules/home-manager/neovim/config/plugins/lint.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - plugins.lint.enable = true; -} diff --git a/modules/home-manager/neovim/config/plugins/lsp.nix b/modules/home-manager/neovim/config/plugins/lsp.nix deleted file mode 100644 index 3f12baed..00000000 --- a/modules/home-manager/neovim/config/plugins/lsp.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - plugins.lsp.enable = true; - - plugins.lsp.keymaps = { - diagnostic = { - "dl" = "setqflist"; - }; - - lspBuf = { - "ca" = "code_action"; - "cr" = "rename"; - K = "hover"; - gD = "declaration"; - gT = "type_definition"; - gd = "definition"; - gr = "references"; - }; - }; - - plugins.lsp.servers.phpactor.enable = true; -} diff --git a/modules/home-manager/neovim/config/plugins/luasnip.nix b/modules/home-manager/neovim/config/plugins/luasnip.nix deleted file mode 100644 index 6dc508db..00000000 --- a/modules/home-manager/neovim/config/plugins/luasnip.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - plugins.luasnip.enable = true; -} diff --git a/modules/home-manager/neovim/config/plugins/oil.nix b/modules/home-manager/neovim/config/plugins/oil.nix deleted file mode 100644 index cbe9645a..00000000 --- a/modules/home-manager/neovim/config/plugins/oil.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.oil = { - enable = true; - - settings = { - delete_to_trash = true; - - keymaps."-" = "actions.parent"; - - skip_confirm_for_simple_edits = true; - view_options.show_hidden = true; - }; - }; - - keymaps = lib.mkIf config.plugins.oil.enable [ - { - action = "Oil"; - key = "-"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/phpactor.nix b/modules/home-manager/neovim/config/plugins/phpactor.nix deleted file mode 100644 index 1c4f6387..00000000 --- a/modules/home-manager/neovim/config/plugins/phpactor.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, ... }: - -{ - extraPlugins = with pkgs.vimPlugins; [ phpactor ]; - - keymaps = [ - { - key = "pm"; - action = "PhpactorContextMenu"; - } - - { - key = "pn"; - action = "PhpactorClassNew"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/refactoring.nix b/modules/home-manager/neovim/config/plugins/refactoring.nix deleted file mode 100644 index fc4c84a1..00000000 --- a/modules/home-manager/neovim/config/plugins/refactoring.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.refactoring = { - enable = true; - enableTelescope = true; - }; - - keymaps = lib.mkIf config.plugins.refactoring.enable ( - [ - { - key = "ri"; - action = "Refactor inline_var"; - mode = "n"; - } - - { - key = "re"; - action = "Refactor extract"; - mode = "x"; - } - - { - key = "ri"; - action = "Refactor inline_var"; - mode = "x"; - } - - { - key = "rv"; - action = "Refactor extract_var"; - mode = "x"; - } - ] - ++ lib.optionals (config.plugins.refactoring.enable && config.plugins.refactoring.enableTelescope) [ - { - mode = "n"; - key = "rR"; - action.__raw = '' - function() - require('telescope').extensions.refactoring.refactors() - end - ''; - options.silent = true; - } - ] - ); -} diff --git a/modules/home-manager/neovim/config/plugins/treesitter.nix b/modules/home-manager/neovim/config/plugins/treesitter.nix deleted file mode 100644 index 34b43940..00000000 --- a/modules/home-manager/neovim/config/plugins/treesitter.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ pkgs, ... }: - -{ - plugins = { - treesitter = { - enable = true; - - grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ - bash - comment - css - csv - dockerfile - gitattributes - gitignore - go - html - javascript - json - kdl - lua - luadoc - make - markdown - markdown_inline - nix - php - phpdoc - query - rst - scss - sql - terraform - twig - typescript - vim - vimdoc - vue - xml - yaml - ]; - - settings.highlight.enable = true; - }; - - treesitter-textobjects.enable = true; - }; -} diff --git a/modules/home-manager/neovim/config/plugins/undotree.nix b/modules/home-manager/neovim/config/plugins/undotree.nix deleted file mode 100644 index 2f523549..00000000 --- a/modules/home-manager/neovim/config/plugins/undotree.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.undotree.enable = true; - - keymaps = lib.mkIf config.plugins.undotree.enable [ - { - action = "UndotreeToggle"; - key = "u"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/vim-cool.nix b/modules/home-manager/neovim/config/plugins/vim-cool.nix deleted file mode 100644 index 07431e87..00000000 --- a/modules/home-manager/neovim/config/plugins/vim-cool.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ pkgs, ... }: - -{ - extraPlugins = with pkgs.vimPlugins; [ vim-cool ]; -} diff --git a/modules/home-manager/neovim/config/plugins/vim-highlightedyank.nix b/modules/home-manager/neovim/config/plugins/vim-highlightedyank.nix deleted file mode 100644 index 2ecb38f3..00000000 --- a/modules/home-manager/neovim/config/plugins/vim-highlightedyank.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, ... }: - -{ - extraPlugins = with pkgs.vimPlugins; [ vim-highlightedyank ]; - - extraConfigVim = '' - let g:highlightedyank_highlight_duration = 100 - ''; -} diff --git a/modules/home-manager/neovim/config/plugins/vim-test.nix b/modules/home-manager/neovim/config/plugins/vim-test.nix deleted file mode 100644 index e35fbdef..00000000 --- a/modules/home-manager/neovim/config/plugins/vim-test.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ config, lib, ... }: - -{ - plugins.vim-test.enable = true; - - keymaps = lib.mkIf config.plugins.vim-test.enable [ - { - key = "tf"; - action = "TestFile"; - } - { - key = "tl"; - action = "TestLast"; - } - { - key = "tn"; - action = "TestNearest"; - } - ]; -} diff --git a/modules/home-manager/neovim/config/plugins/web-devicons.nix b/modules/home-manager/neovim/config/plugins/web-devicons.nix deleted file mode 100644 index 927f85e1..00000000 --- a/modules/home-manager/neovim/config/plugins/web-devicons.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - plugins.web-devicons.enable = false; -} diff --git a/modules/home-manager/neovim/default.nix b/modules/home-manager/neovim/default.nix index 5788cada..f9753152 100644 --- a/modules/home-manager/neovim/default.nix +++ b/modules/home-manager/neovim/default.nix @@ -11,9 +11,9 @@ let cfg = config.features.coding.neovim; in { - imports = [ - inputs.nixvim.homeManagerModules.nixvim - ]; + # imports = [ + # inputs.nixvim.homeManagerModules.nixvim + # ]; options.features.coding.neovim.enable = mkEnableOption "Enable neovim"; diff --git a/modules2/nixvim/aliases.nix b/modules2/nixvim/aliases.nix new file mode 100644 index 00000000..e8f6a389 --- /dev/null +++ b/modules2/nixvim/aliases.nix @@ -0,0 +1,6 @@ +{ + flake.modules.nixvim.custom = { + viAlias = true; + vimAlias = true; + }; +} diff --git a/modules2/nixvim/colorscheme.nix b/modules2/nixvim/colorscheme.nix new file mode 100644 index 00000000..28e04bc8 --- /dev/null +++ b/modules2/nixvim/colorscheme.nix @@ -0,0 +1,6 @@ +{ + flake.modules.nixvim.custom.colorschemes.catppuccin = { + enable = true; + settings.flavour = "mocha"; + }; +} diff --git a/modules2/nixvim/diagnostics.nix b/modules2/nixvim/diagnostics.nix new file mode 100644 index 00000000..a3758ade --- /dev/null +++ b/modules2/nixvim/diagnostics.nix @@ -0,0 +1,12 @@ +{ + flake.modules.nixvim.custom.diagnostic.settings = { + signs = true; + underline = false; + update_in_insert = false; + + virtual_text = { + enable = true; + spacing = 2; + }; + }; +} diff --git a/modules2/nixvim/extra-packages.nix b/modules2/nixvim/extra-packages.nix new file mode 100644 index 00000000..33f7d8f1 --- /dev/null +++ b/modules2/nixvim/extra-packages.nix @@ -0,0 +1,10 @@ +{ + flake.modules.nixvim.custom = + { pkgs, ... }: + { + extraPackages = with pkgs; [ + nixfmt-rfc-style + stylua + ]; + }; +} diff --git a/modules2/nixvim/filetypes.nix b/modules2/nixvim/filetypes.nix new file mode 100644 index 00000000..bfdc4ca9 --- /dev/null +++ b/modules2/nixvim/filetypes.nix @@ -0,0 +1,17 @@ +{ + flake.modules.nixvim.custom.filetype = { + extension = { + "neon.dist" = "yaml"; + inc = "php"; + install = "php"; + module = "php"; + neon = "yaml"; + pcss = "scss"; + theme = "php"; + }; + + filename = { + "composer.lock" = "json"; + }; + }; +} diff --git a/modules2/nixvim/flake-outputs.nix b/modules2/nixvim/flake-outputs.nix new file mode 100644 index 00000000..ed360c10 --- /dev/null +++ b/modules2/nixvim/flake-outputs.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + perSystem = + { inputs', pkgs, ... }: + { + packages.nixvim = inputs'.nixvim.legacyPackages.makeNixvimWithModule { + inherit pkgs; + + module = config.flake.modules.nixvim.custom; + }; + }; +} diff --git a/modules/home-manager/neovim/config/keymaps.nix b/modules2/nixvim/keymaps.nix similarity index 96% rename from modules/home-manager/neovim/config/keymaps.nix rename to modules2/nixvim/keymaps.nix index 7ecaa6ee..dc13def0 100644 --- a/modules/home-manager/neovim/config/keymaps.nix +++ b/modules2/nixvim/keymaps.nix @@ -1,5 +1,5 @@ { - keymaps = [ + flake.modules.nixvim.custom.keymaps = [ { action = "A,"; key = ",,"; diff --git a/modules2/nixvim/leader.nix b/modules2/nixvim/leader.nix new file mode 100644 index 00000000..36b9eff9 --- /dev/null +++ b/modules2/nixvim/leader.nix @@ -0,0 +1,6 @@ +{ + flake.modules.nixvim.custom.globals = { + mapleader = " "; + maplocalleader = " "; + }; +} diff --git a/modules/home-manager/neovim/config/plugins/lualine.nix b/modules2/nixvim/lualine.nix similarity index 75% rename from modules/home-manager/neovim/config/plugins/lualine.nix rename to modules2/nixvim/lualine.nix index d8de83ad..3b2d9ea5 100644 --- a/modules/home-manager/neovim/config/plugins/lualine.nix +++ b/modules2/nixvim/lualine.nix @@ -1,5 +1,5 @@ { - plugins.lualine = { + flake.modules.nixvim.custom.plugins.lualine = { enable = true; settings.options = { diff --git a/modules/home-manager/neovim/config/options.nix b/modules2/nixvim/options.nix similarity index 92% rename from modules/home-manager/neovim/config/options.nix rename to modules2/nixvim/options.nix index eaf2a8de..a1fdf587 100644 --- a/modules/home-manager/neovim/config/options.nix +++ b/modules2/nixvim/options.nix @@ -1,5 +1,5 @@ { - opts = { + flake.modules.nixvim.custom.opts = { expandtab = true; exrc = true; foldlevel = 1; diff --git a/modules2/nixvim/plugins/auto-save.nix b/modules2/nixvim/plugins/auto-save.nix new file mode 100644 index 00000000..0844ec58 --- /dev/null +++ b/modules2/nixvim/plugins/auto-save.nix @@ -0,0 +1,24 @@ +{ + flake.modules.nixvim.custom.plugins.auto-save = { + enable = true; + + settings.condition = '' + function(buf) + local excluded_filetypes = { + "harpoon", + "oil", + } + + local excluded_filenames = {} + + if vim.tbl_contains(excluded_filetypes, vim.fn.getbufvar(buf, "&filetype")) + or vim.tbl_contains(excluded_filenames, vim.fn.expand("%:t")) + then + return false + end + + return true + end + ''; + }; +} diff --git a/modules/home-manager/neovim/config/plugins/cmp.nix b/modules2/nixvim/plugins/cmp.nix similarity index 96% rename from modules/home-manager/neovim/config/plugins/cmp.nix rename to modules2/nixvim/plugins/cmp.nix index 1c31ec3f..cfb4e8fe 100644 --- a/modules/home-manager/neovim/config/plugins/cmp.nix +++ b/modules2/nixvim/plugins/cmp.nix @@ -1,5 +1,5 @@ { - plugins.cmp = { + flake.modules.nixvim.custom.plugins.cmp = { enable = true; autoEnableSources = true; diff --git a/modules2/nixvim/plugins/conform.nix b/modules2/nixvim/plugins/conform.nix new file mode 100644 index 00000000..8e7e5c8d --- /dev/null +++ b/modules2/nixvim/plugins/conform.nix @@ -0,0 +1,3 @@ +{ + flake.modules.nixvim.custom.plugins.conform-nvim.enable = true; +} diff --git a/modules2/nixvim/plugins/fidget.nix b/modules2/nixvim/plugins/fidget.nix new file mode 100644 index 00000000..05124ce7 --- /dev/null +++ b/modules2/nixvim/plugins/fidget.nix @@ -0,0 +1,3 @@ +{ + flake.modules.nixvim.custom.plugins.fidget.enable = true; +} diff --git a/modules2/nixvim/plugins/fugitive.nix b/modules2/nixvim/plugins/fugitive.nix new file mode 100644 index 00000000..ac800972 --- /dev/null +++ b/modules2/nixvim/plugins/fugitive.nix @@ -0,0 +1,18 @@ +{ + flake.modules.nixvim.custom = { + plugins.fugitive.enable = true; + + keymaps = [ + { + key = "gc"; + action = "Git commitK"; + } + + { + # Open the ":Git" window in its own buffer, not a split. + key = "gs"; + action = "0Git"; + } + ]; + }; +} diff --git a/modules2/nixvim/plugins/gitsigns.nix b/modules2/nixvim/plugins/gitsigns.nix new file mode 100644 index 00000000..60609c35 --- /dev/null +++ b/modules2/nixvim/plugins/gitsigns.nix @@ -0,0 +1,48 @@ +{ + flake.modules.nixvim.custom = { + plugins.gitsigns.enable = true; + + keymaps = [ + { + action = "Gitsigns prev_hunk"; + key = "[h"; + } + + { + action = "Gitsigns next_hunk"; + key = "]h"; + } + + { + action = "Gitsigns reset_hunk"; + key = "hr"; + } + + { + action = "Gitsigns reset_buffer"; + key = "hR"; + } + + { + action = "Gitsigns stage_hunk"; + key = "hs"; + mode = [ + "n" + "v" + ]; + } + + { + action = "Gitsigns stage_buffer"; + key = "hS"; + mode = "n"; + } + + { + action = "Gitsigns undo_stage_hunk"; + key = "hu"; + mode = "x"; + } + ]; + }; +} diff --git a/modules/home-manager/neovim/config/plugins/harpoon.nix b/modules2/nixvim/plugins/harpoon.nix similarity index 80% rename from modules/home-manager/neovim/config/plugins/harpoon.nix rename to modules2/nixvim/plugins/harpoon.nix index 95d59718..830b1f42 100644 --- a/modules/home-manager/neovim/config/plugins/harpoon.nix +++ b/modules2/nixvim/plugins/harpoon.nix @@ -1,5 +1,3 @@ -{ config, lib, ... }: - let leaderBinding = key: command: { key = "${key}"; @@ -8,13 +6,13 @@ let }; in { - plugins.harpoon = { - enable = true; - enableTelescope = true; - }; + flake.modules.nixvim.custom = { + plugins.harpoon = { + enable = true; + enableTelescope = true; + }; - keymaps = lib.mkIf config.plugins.harpoon.enable ( - [ + keymaps = [ { key = "a"; action.__raw = "function() require'harpoon':list():add() end"; @@ -42,6 +40,6 @@ in 8 9 ] - ) - ); + ); + }; } diff --git a/modules2/nixvim/plugins/lint.nix b/modules2/nixvim/plugins/lint.nix new file mode 100644 index 00000000..60b766e6 --- /dev/null +++ b/modules2/nixvim/plugins/lint.nix @@ -0,0 +1,3 @@ +{ + flake.modules.nixvim.custom.plugins.lint.enable = true; +} diff --git a/modules2/nixvim/plugins/lsp.nix b/modules2/nixvim/plugins/lsp.nix new file mode 100644 index 00000000..efd9d4d1 --- /dev/null +++ b/modules2/nixvim/plugins/lsp.nix @@ -0,0 +1,23 @@ +{ + flake.modules.nixvim.custom.plugins.lsp = { + enable = true; + + keymaps = { + diagnostic = { + "dl" = "setqflist"; + }; + + lspBuf = { + "ca" = "code_action"; + "cr" = "rename"; + K = "hover"; + gD = "declaration"; + gT = "type_definition"; + gd = "definition"; + gr = "references"; + }; + }; + + servers.phpactor.enable = true; + }; +} diff --git a/modules2/nixvim/plugins/luasnip.nix b/modules2/nixvim/plugins/luasnip.nix new file mode 100644 index 00000000..bec75392 --- /dev/null +++ b/modules2/nixvim/plugins/luasnip.nix @@ -0,0 +1,3 @@ +{ + flake.modules.nixvim.custom.plugins.luasnip.enable = true; +} diff --git a/modules/home-manager/neovim/config/plugins/mini.nix b/modules2/nixvim/plugins/mini.nix similarity index 80% rename from modules/home-manager/neovim/config/plugins/mini.nix rename to modules2/nixvim/plugins/mini.nix index 53176bae..e9b66a30 100644 --- a/modules/home-manager/neovim/config/plugins/mini.nix +++ b/modules2/nixvim/plugins/mini.nix @@ -1,5 +1,5 @@ { - plugins.mini = { + flake.modules.nixvim.custom.plugins.mini = { enable = true; modules = { diff --git a/modules2/nixvim/plugins/oil.nix b/modules2/nixvim/plugins/oil.nix new file mode 100644 index 00000000..2a022eea --- /dev/null +++ b/modules2/nixvim/plugins/oil.nix @@ -0,0 +1,23 @@ +{ + flake.modules.nixvim.custom = { + plugins.oil = { + enable = true; + + settings = { + delete_to_trash = true; + + keymaps."-" = "actions.parent"; + + skip_confirm_for_simple_edits = true; + view_options.show_hidden = true; + }; + }; + + keymaps = [ + { + action = "Oil"; + key = "-"; + } + ]; + }; +} diff --git a/modules2/nixvim/plugins/phpactor.nix b/modules2/nixvim/plugins/phpactor.nix new file mode 100644 index 00000000..d40f8a1f --- /dev/null +++ b/modules2/nixvim/plugins/phpactor.nix @@ -0,0 +1,19 @@ +{ + flake.modules.nixvim.custom = + { pkgs, ... }: + { + extraPlugins = with pkgs.vimPlugins; [ phpactor ]; + + keymaps = [ + { + key = "pm"; + action = "PhpactorContextMenu"; + } + + { + key = "pn"; + action = "PhpactorClassNew"; + } + ]; + }; +} diff --git a/modules2/nixvim/plugins/refactoring.nix b/modules2/nixvim/plugins/refactoring.nix new file mode 100644 index 00000000..f59f9a9c --- /dev/null +++ b/modules2/nixvim/plugins/refactoring.nix @@ -0,0 +1,54 @@ +{ config, lib, ... }: + +{ + flake.modules.nixvim.custom = { + plugins.refactoring = { + enable = true; + enableTelescope = true; + }; + + keymaps = [ + { + key = "ri"; + action = "Refactor inline_var"; + mode = "n"; + } + + { + key = "re"; + action = "Refactor extract"; + mode = "x"; + } + + { + key = "ri"; + action = "Refactor inline_var"; + mode = "x"; + } + + { + key = "rv"; + action = "Refactor extract_var"; + mode = "x"; + } + ]; + # ++ + # lib.optionals + # ( + # config.flake.modules.nixvim.custom.plugins.refactoring.enable + # && config.flake.modules.nixvim.custom.plugins.refactoring.enableTelescope + # ) + # [ + # { + # mode = "n"; + # key = "rR"; + # action.__raw = '' + # function() + # require('telescope').extensions.refactoring.refactors() + # end + # ''; + # options.silent = true; + # } + # ]; + }; +} diff --git a/modules/home-manager/neovim/config/plugins/telescope.nix b/modules2/nixvim/plugins/telescope.nix similarity index 92% rename from modules/home-manager/neovim/config/plugins/telescope.nix rename to modules2/nixvim/plugins/telescope.nix index 86d0bbd3..ee59725e 100644 --- a/modules/home-manager/neovim/config/plugins/telescope.nix +++ b/modules2/nixvim/plugins/telescope.nix @@ -1,5 +1,5 @@ { - plugins.telescope = { + flake.modules.nixvim.custom.plugins.telescope = { enable = true; extensions = { diff --git a/modules2/nixvim/plugins/treesitter.nix b/modules2/nixvim/plugins/treesitter.nix new file mode 100644 index 00000000..02de1492 --- /dev/null +++ b/modules2/nixvim/plugins/treesitter.nix @@ -0,0 +1,50 @@ +{ + flake.modules.nixvim.custom = + { pkgs, ... }: + { + plugins = { + treesitter = { + enable = true; + + grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + bash + comment + css + csv + dockerfile + gitattributes + gitignore + go + html + javascript + json + kdl + lua + luadoc + make + markdown + markdown_inline + nix + php + phpdoc + query + rst + scss + sql + terraform + twig + typescript + vim + vimdoc + vue + xml + yaml + ]; + + settings.highlight.enable = true; + }; + + treesitter-textobjects.enable = true; + }; + }; +} diff --git a/modules2/nixvim/plugins/undotree.nix b/modules2/nixvim/plugins/undotree.nix new file mode 100644 index 00000000..2bfda799 --- /dev/null +++ b/modules2/nixvim/plugins/undotree.nix @@ -0,0 +1,12 @@ +{ + flake.modules.nixvim.custom = { + plugins.undotree.enable = true; + + keymaps = [ + { + action = "UndotreeToggle"; + key = "u"; + } + ]; + }; +} diff --git a/modules2/nixvim/plugins/vim-cool.nix b/modules2/nixvim/plugins/vim-cool.nix new file mode 100644 index 00000000..1a02189e --- /dev/null +++ b/modules2/nixvim/plugins/vim-cool.nix @@ -0,0 +1,7 @@ +{ + flake.modules.nixvim.custom = + { pkgs, ... }: + { + extraPlugins = [ pkgs.vimPlugins.vim-cool ]; + }; +} diff --git a/modules/home-manager/neovim/config/plugins/vim-dadbod.nix b/modules2/nixvim/plugins/vim-dadbod.nix similarity index 72% rename from modules/home-manager/neovim/config/plugins/vim-dadbod.nix rename to modules2/nixvim/plugins/vim-dadbod.nix index 13168c91..1ef2050d 100644 --- a/modules/home-manager/neovim/config/plugins/vim-dadbod.nix +++ b/modules2/nixvim/plugins/vim-dadbod.nix @@ -1,5 +1,5 @@ { - plugins = { + flake.modules.nixvim.custom.plugins = { vim-dadbod.enable = true; vim-dadbod-completion.enable = true; vim-dadbod-ui.enable = true; diff --git a/modules2/nixvim/plugins/vim-highlightedyank.nix b/modules2/nixvim/plugins/vim-highlightedyank.nix new file mode 100644 index 00000000..ee937da9 --- /dev/null +++ b/modules2/nixvim/plugins/vim-highlightedyank.nix @@ -0,0 +1,11 @@ +{ + flake.modules.nixvim.custom = + { pkgs, ... }: + { + extraPlugins = [ pkgs.vimPlugins.vim-highlightedyank ]; + + extraConfigVim = '' + let g:highlightedyank_highlight_duration = 100 + ''; + }; +} diff --git a/modules2/nixvim/plugins/vim-test.nix b/modules2/nixvim/plugins/vim-test.nix new file mode 100644 index 00000000..5ec7a29c --- /dev/null +++ b/modules2/nixvim/plugins/vim-test.nix @@ -0,0 +1,20 @@ +{ + flake.modules.nixvim.custom = { + plugins.vim-test.enable = true; + + keymaps = [ + { + key = "tf"; + action = "TestFile"; + } + { + key = "tl"; + action = "TestLast"; + } + { + key = "tn"; + action = "TestNearest"; + } + ]; + }; +} diff --git a/modules2/nixvim/plugins/web-devicons.nix b/modules2/nixvim/plugins/web-devicons.nix new file mode 100644 index 00000000..56591499 --- /dev/null +++ b/modules2/nixvim/plugins/web-devicons.nix @@ -0,0 +1,3 @@ +{ + flake.modules.nixvim.custom.plugins.web-devicons.enable = false; +} diff --git a/modules2/nixvim/use-in-home.nix b/modules2/nixvim/use-in-home.nix new file mode 100644 index 00000000..aad4ac53 --- /dev/null +++ b/modules2/nixvim/use-in-home.nix @@ -0,0 +1,24 @@ +{ config, inputs, lib, ... }: + +{ + flake.modules.homeManager.base = + hmArgs@{ pkgs, ... }: + let + # Ideally: + # nixvim = self.packages.${pkgs.system}.nixvim; + # but https://github.com/danth/stylix/pull/415#issuecomment-2832398958 + nixvim = inputs.nixvim.legacyPackages.${pkgs.system}.makeNixvimWithModule { + inherit pkgs; + + extraSpecialArgs.homeConfig = hmArgs.config; + + module = config.flake.modules.nixvim.custom; + }; + in + { + home = { + packages = [ nixvim ]; + sessionVariables.EDITOR = lib.mkForce (lib.getExe nixvim); + }; + }; +} diff --git a/modules2/packages.nix b/modules2/packages.nix index 6640cca1..eb17d172 100644 --- a/modules2/packages.nix +++ b/modules2/packages.nix @@ -1,4 +1,4 @@ -{ self, ... }: +{ config, ... }: { perSystem = @@ -10,7 +10,7 @@ neovim = inputs'.nixvim.legacyPackages.makeNixvimWithModule { inherit pkgs; - module = import "${self}/modules/home-manager/neovim/config"; + module = config.flake.modules.nixvim.custom; }; }; };