diff --git a/extra.nix b/extra.nix index 1cdeda2..bbb2943 100644 --- a/extra.nix +++ b/extra.nix @@ -159,6 +159,11 @@ inputs: let vim.gestures = { gesture-nvim.enable = false; }; + + vim.comments = { + comment-nvim.enable = true; + kommentary = builtins.trace "WARNING: kommentary is deprecated and will be removed in the future, use comment-nvim instead" {enable = true;}; + }; }; }; in { diff --git a/flake.lock b/flake.lock index 6a6a1da..506588a 100644 --- a/flake.lock +++ b/flake.lock @@ -208,6 +208,22 @@ "type": "github" } }, + "comment-nvim": { + "flake": false, + "locked": { + "lastModified": 1676528587, + "narHash": "sha256-SwN67ILsNJk0bNkcfQFiipAULaDxTfnCDHSC/+XKeLA=", + "owner": "numToStr", + "repo": "Comment.nvim", + "rev": "6821b3ae27a57f1f3cf8ed030e4a55d70d0c4e43", + "type": "github" + }, + "original": { + "owner": "numToStr", + "repo": "Comment.nvim", + "type": "github" + } + }, "copilot-lua": { "flake": false, "locked": { @@ -1045,6 +1061,7 @@ "cmp-vsnip": "cmp-vsnip", "codewindow-nvim": "codewindow-nvim", "colorizer": "colorizer", + "comment-nvim": "comment-nvim", "copilot-lua": "copilot-lua", "crates-nvim": "crates-nvim", "dashboard-nvim": "dashboard-nvim", diff --git a/flake.nix b/flake.nix index 7a51bfb..2d0ace8 100644 --- a/flake.nix +++ b/flake.nix @@ -201,6 +201,11 @@ url = "github:b3nj5m1n/kommentary"; flake = false; }; + comment-nvim = { + url = "github:numToStr/Comment.nvim"; + flake = false; + }; + todo-comments = { url = "github:folke/todo-comments.nvim"; flake = false; diff --git a/lib/types-plugin.nix b/lib/types-plugin.nix index 9e31823..8b3506d 100644 --- a/lib/types-plugin.nix +++ b/lib/types-plugin.nix @@ -66,6 +66,8 @@ with lib; let "tabnine-nvim" "nvim-session-manager" "gesture-nvim" + "comment-nvim" + "kommentary" ]; # You can either use the name of the plugin or a package. pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); diff --git a/modules/comments/comment-nvim.nix b/modules/comments/comment-nvim.nix new file mode 100644 index 0000000..1139b3c --- /dev/null +++ b/modules/comments/comment-nvim.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.comments.comment-nvim; +in { + options.vim.comments.comment-nvim = { + enable = mkEnableOption "comment-nvim"; + }; + + config = mkIf cfg.enable { + vim.startPlugins = [ + "comment-nvim" + ]; + + vim.luaConfigRC.comment-nvim = nvim.dag.entryAnywhere '' + require('Comment').setup() + ''; + }; +} diff --git a/modules/comments/default.nix b/modules/comments/default.nix new file mode 100644 index 0000000..8efe564 --- /dev/null +++ b/modules/comments/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./comment-nvim.nix + ./kommentary.nix + ]; +} diff --git a/modules/comments/kommentary.nix b/modules/comments/kommentary.nix new file mode 100644 index 0000000..5c05cba --- /dev/null +++ b/modules/comments/kommentary.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.comments.kommentary; +in { + options.vim.comments.kommentary = { + enable = mkEnableOption "kommentary"; + }; + + config = mkIf cfg.enable { + vim.startPlugins = [ + "kommentary" + ]; + + vim.luaConfigRC.kommentary = nvim.dag.entryAnywhere '' + require('kommentary.config').use_extended_mappings() + ''; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index fe2b19e..da02dcf 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -29,6 +29,7 @@ ./ui ./assistant ./session + ./comments ]; pkgsModule = {config, ...}: {