From 2e4025345720985a5f69cd0b3efee529dedd6c9a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 7 Jun 2023 14:28:27 +0300 Subject: [PATCH] feat: nvim-surround --- extra.nix | 3 ++- flake.lock | 17 +++++++++++++++++ flake.nix | 5 +++++ lib/types/plugins.nix | 1 + modules/utility/default.nix | 1 + modules/utility/surround/config.nix | 19 +++++++++++++++++++ modules/utility/surround/default.nix | 6 ++++++ modules/utility/surround/surround.nix | 7 +++++++ 8 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 modules/utility/surround/config.nix create mode 100644 modules/utility/surround/default.nix create mode 100644 modules/utility/surround/surround.nix diff --git a/extra.nix b/extra.nix index 01d4282..70ccbfb 100644 --- a/extra.nix +++ b/extra.nix @@ -155,6 +155,7 @@ inputs: let ccc.enable = isMaximal; vim-wakatime.enable = isMaximal; icon-picker.enable = isMaximal; + surround.enable = isMaximal; diffview-nvim.enable = true; motion = { hop.enable = true; @@ -179,7 +180,7 @@ inputs: let vim.ui = { noice.enable = true; colorizer.enable = true; - modes-nvim.enable = true; + modes-nvim.enable = false; # the theme looks terrible with catppuccin illuminate.enable = true; smartcolumn = { enable = true; diff --git a/flake.lock b/flake.lock index 5d222ac..1650abd 100644 --- a/flake.lock +++ b/flake.lock @@ -1092,6 +1092,22 @@ "type": "github" } }, + "nvim-surround": { + "flake": false, + "locked": { + "lastModified": 1685464327, + "narHash": "sha256-r3D5WTqEnIL1T3p7cmkRmBY8qgwFFJptM7BKNNsCT8k=", + "owner": "kylechui", + "repo": "nvim-surround", + "rev": "10b20ca7d9da1ac8df8339e140ffef94f9ab3b18", + "type": "github" + }, + "original": { + "owner": "kylechui", + "repo": "nvim-surround", + "type": "github" + } + }, "nvim-tree-lua": { "flake": false, "locked": { @@ -1349,6 +1365,7 @@ "nvim-neoclip": "nvim-neoclip", "nvim-notify": "nvim-notify", "nvim-session-manager": "nvim-session-manager", + "nvim-surround": "nvim-surround", "nvim-tree-lua": "nvim-tree-lua", "nvim-treesitter-context": "nvim-treesitter-context", "nvim-ts-autotag": "nvim-ts-autotag", diff --git a/flake.nix b/flake.nix index 00631bd..6a635b1 100644 --- a/flake.nix +++ b/flake.nix @@ -419,6 +419,11 @@ flake = false; }; + nvim-surround = { + url = "github:kylechui/nvim-surround"; + flake = false; + }; + # Note-taking obsidian-nvim = { url = "github:epwalsh/obsidian.nvim"; diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 6267dc7..310fdaa 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -83,6 +83,7 @@ with lib; let "elixir-tools" "nvim-colorizer-lua" "vim-illuminate" + "nvim-surround" ]; # You can either use the name of the plugin or a package. pluginsType = with types; diff --git a/modules/utility/default.nix b/modules/utility/default.nix index ca4730c..50ec048 100644 --- a/modules/utility/default.nix +++ b/modules/utility/default.nix @@ -9,5 +9,6 @@ _: { ./telescope ./diffview ./wakatime + ./surround ]; } diff --git a/modules/utility/surround/config.nix b/modules/utility/surround/config.nix new file mode 100644 index 0000000..bcd1f51 --- /dev/null +++ b/modules/utility/surround/config.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.utility.surround; +in { + config = mkIf (cfg.enable) { + vim.startPlugins = [ + "nvim-surround" + ]; + + vim.luaConfigRC.surround = nvim.dag.entryAnywhere '' + require('nvim-surround').setup() + ''; + }; +} diff --git a/modules/utility/surround/default.nix b/modules/utility/surround/default.nix new file mode 100644 index 0000000..4f6d265 --- /dev/null +++ b/modules/utility/surround/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./surround.nix + ]; +} diff --git a/modules/utility/surround/surround.nix b/modules/utility/surround/surround.nix new file mode 100644 index 0000000..a29b19b --- /dev/null +++ b/modules/utility/surround/surround.nix @@ -0,0 +1,7 @@ +{lib, ...}: +with lib; +with builtins; { + options.vim.utility.surround = { + enable = mkEnableOption "nvim-surround: add/change/delete surrounding delimiter pairs with ease"; + }; +}