From d36853d3d76ecb0745a8403f5a8140f08a48503c Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Sun, 8 Oct 2023 20:57:17 +0200 Subject: [PATCH] nvim: Replace some plugins with mini.nvim --- flake.lock | 16 ++--- home/config/nvim/init.fnl | 2 + home/config/nvim/nifoc/keymap.fnl | 6 +- home/config/nvim/plugins/autopairs.fnl | 5 -- home/config/nvim/plugins/comment.fnl | 2 - home/config/nvim/plugins/mini.fnl | 17 +++++ home/config/nvim/plugins/surround.fnl | 3 - home/config/nvim/plugins/treesitter.fnl | 2 - home/programs/nvim/default.nix | 48 +++----------- home/programs/nvim/plugins.nix | 87 ++++--------------------- home/programs/nvim/plugins.yaml | 12 +--- 11 files changed, 49 insertions(+), 151 deletions(-) delete mode 100644 home/config/nvim/plugins/autopairs.fnl delete mode 100644 home/config/nvim/plugins/comment.fnl create mode 100644 home/config/nvim/plugins/mini.fnl delete mode 100644 home/config/nvim/plugins/surround.fnl diff --git a/flake.lock b/flake.lock index 7054143..9c6503a 100644 --- a/flake.lock +++ b/flake.lock @@ -13,11 +13,11 @@ ] }, "locked": { - "lastModified": 1695384796, + "lastModified": 1696775529, "narHash": "sha256-TYlE4B0ktPtlJJF9IFxTWrEeq+XKG8Ny0gc2FGEAdj0=", "owner": "ryantm", "repo": "agenix", - "rev": "1f677b3e161d3bdbfd08a939e8f25de2568e0ef4", + "rev": "daf42cb35b2dc614d1551e37f96406e4c4a2d3e4", "type": "github" }, "original": { @@ -417,11 +417,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1696693680, - "narHash": "sha256-PH0HQTkqyj7DmdPKPwrrXwVURLBqzZs4nqnDw9q8mhg=", + "lastModified": 1696725822, + "narHash": "sha256-B7uAOS7TkLlOg1aX01rQlYbydcyB6ZnLJSfaYbKVww8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "945559664c1dc5836173ee12896ba421d9b37181", + "rev": "5aabb5780a11c500981993d49ee93cfa6df9307b", "type": "github" }, "original": { @@ -492,11 +492,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1696516544, - "narHash": "sha256-8rKE8Je6twTNFRTGF63P9mE3lZIq917RAicdc4XJO80=", + "lastModified": 1696773021, + "narHash": "sha256-JzjKl1h96cM5iSrkNvZX7Fgo+e3lisv2tn+uIMnXmD4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "66c352d33e0907239e4a69416334f64af2c685cc", + "rev": "8edf336c5ca85efe20004d076747f91b85a6d087", "type": "github" }, "original": { diff --git a/home/config/nvim/init.fnl b/home/config/nvim/init.fnl index 0e54373..b317eb6 100644 --- a/home/config/nvim/init.fnl +++ b/home/config/nvim/init.fnl @@ -64,6 +64,8 @@ (let [theme (require :nifoc.theme)] (theme.setup)) ;; Plugins + (set g.mapleader " ") ; Some plugins need this, so set it before the keymap is loaded + (set o.timeoutlen 400) (set g.loaded_python_provider 0) ; Disable built-in providers (set g.loaded_ruby_provider 0) (set g.loaded_node_provider 0) diff --git a/home/config/nvim/nifoc/keymap.fnl b/home/config/nvim/nifoc/keymap.fnl index 7034787..c0ac742 100644 --- a/home/config/nvim/nifoc/keymap.fnl +++ b/home/config/nvim/nifoc/keymap.fnl @@ -7,14 +7,11 @@ telescope-toggleterm (require :telescope-toggleterm) telescope-ivy (telescope-themes.get_ivy) telescope-dropdown (telescope-themes.get_dropdown) - npairs (require :nvim-autopairs) gitsigns (require :gitsigns) repl (require :nifoc.repl) formatting (require :nifoc.formatting)] (fn mod.setup [] (keymap.set :n : : {:noremap true}) - (set vim.g.mapleader " ") - (set vim.opt.timeoutlen 400) ;; Leader Mappings (keymap.set :n :o telescope-nifoc.find-files {:desc "Find Files"}) (keymap.set :n :s #(telescope-builtin.live_grep telescope-ivy) @@ -58,8 +55,7 @@ ; (keymap.set :n :dn #(noice.cmd :telescope) ; {:desc "Display Notifications"}) ;; Other Mappings - (keymap.set :n : ":nohlsearch" {:silent true}) - (keymap.set :i : npairs.autopairs_cr {:expr true :silent true}) + ; (keymap.set :n : ":nohlsearch" {:silent true}) (keymap.set :n :F formatting.maybe-format-buffer {:desc "Format Buffer"}) (keymap.set :n : :b) (keymap.set :n : :w) diff --git a/home/config/nvim/plugins/autopairs.fnl b/home/config/nvim/plugins/autopairs.fnl deleted file mode 100644 index 3338c38..0000000 --- a/home/config/nvim/plugins/autopairs.fnl +++ /dev/null @@ -1,5 +0,0 @@ -(let [npairs (require :nvim-autopairs)] - (npairs.setup {:check_ts true - :ts_config {:javascript [:string :template_string] - :elixir [:string] - :lua [:string :source]}})) diff --git a/home/config/nvim/plugins/comment.fnl b/home/config/nvim/plugins/comment.fnl deleted file mode 100644 index a535b61..0000000 --- a/home/config/nvim/plugins/comment.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(let [cmt (require :Comment)] - (cmt.setup {:padding true})) diff --git a/home/config/nvim/plugins/mini.fnl b/home/config/nvim/plugins/mini.fnl new file mode 100644 index 0000000..d0aad10 --- /dev/null +++ b/home/config/nvim/plugins/mini.fnl @@ -0,0 +1,17 @@ +(let [miniclue (require :mini.clue)] + ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-clue.md + (miniclue.setup {:triggers [; Leader + {:mode :n :keys :} + {:mode :x :keys :} + ; Built-in + {:mode :i :keys :}] + :clues [(miniclue.gen_clues.builtin_completion)]}) + ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-comment.md + ((. (require :mini.comment) :setup) {}) + ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-jump2d.md + ((. (require :mini.jump2d) :setup) {:hooks {:before_start (fn [] + (vim.cmd :nohlsearch))}}) + ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-surround.md + ((. (require :mini.surround) :setup) {}) + ;; https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-pairs.md + ((. (require :mini.pairs) :setup) {})) diff --git a/home/config/nvim/plugins/surround.fnl b/home/config/nvim/plugins/surround.fnl deleted file mode 100644 index e677d8d..0000000 --- a/home/config/nvim/plugins/surround.fnl +++ /dev/null @@ -1,3 +0,0 @@ -(let [surround (require :nvim-surround)] - (surround.setup {})) - diff --git a/home/config/nvim/plugins/treesitter.fnl b/home/config/nvim/plugins/treesitter.fnl index 6a44885..13ec892 100644 --- a/home/config/nvim/plugins/treesitter.fnl +++ b/home/config/nvim/plugins/treesitter.fnl @@ -14,8 +14,6 @@ :ac "@conditional.outer" :ic "@conditional.inner"}}} :matchup {:enable true :disable disable-parsers} - :autopairs {:enable true :disable disable-parsers} - :autotag {:enable true :disable disable-parsers} :playground {:enable true} :nifoc_hooks {:enable true :disable disable-parsers}})) diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index 438796e..d6e246e 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -106,6 +106,13 @@ in # Utils popup-nvim plenary-nvim + + { + plugin = mini-nvim; + config = builtins.readFile ../../config/nvim/plugins/mini.fnl; + type = "fennel"; + } + nvim-web-devicons { @@ -139,15 +146,6 @@ in type = "fennel"; } - { - plugin = leap-nvim; - config = /* fennel */ '' - (let [leap (require :leap)] - (leap.set_default_keymaps)) - ''; - type = "fennel"; - } - # Themes dracula-nvim @@ -195,12 +193,12 @@ in # Completion { - plugin = coq_nvim; + plugin = pkgs.vimPlugins.coq_nvim; config = builtins.readFile ../../config/nvim/plugins/coq.fnl; type = "fennel"; } - coq-artifacts + pkgs.vimPlugins.coq-artifacts # LSP { @@ -230,13 +228,6 @@ in type = "fennel"; } - # Comments - { - plugin = comment-nvim; - config = builtins.readFile ../../config/nvim/plugins/comment.fnl; - type = "fennel"; - } - # Formatting core-nvim @@ -248,21 +239,6 @@ in } # Pairs - { - plugin = nvim-autopairs; - config = builtins.readFile ../../config/nvim/plugins/autopairs.fnl; - type = "fennel"; - } - - { - plugin = nvim-ts-autotag; - config = /* fennel */ '' - (let [ts-autotag (require :nvim-ts-autotag)] - (ts-autotag.setup)) - ''; - type = "fennel"; - } - { plugin = vim-matchup; config = builtins.readFile ../../config/nvim/plugins/matchup.fnl; @@ -272,12 +248,6 @@ in # Textobjects nvim-treesitter-textobjects - { - plugin = nvim-surround; - config = builtins.readFile ../../config/nvim/plugins/surround.fnl; - type = "fennel"; - } - # UI { plugin = heirline-nvim; diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index d689b8b..7e0c418 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -28,6 +28,17 @@ in fetchSubmodules = false; }; }; + mini-nvim = buildVimPlugin { + pname = "mini.nvim"; + version = "2023-10-03"; + src = fetchFromGitHub { + owner = "echasnovski"; + repo = "mini.nvim"; + rev = "25c4bf4efac51aad5393e37949e68ac3e672a73c"; + sha256 = "115s6wjd7c0y2fcc0wnzdp2gp1qmwzy417jqzjmlb1rphj7kn2hz"; + fetchSubmodules = false; + }; + }; nvim-web-devicons = buildVimPlugin { pname = "nvim-web-devicons"; version = "2023-10-08"; @@ -94,17 +105,6 @@ in fetchSubmodules = false; }; }; - leap-nvim = buildVimPlugin { - pname = "leap.nvim"; - version = "2023-07-23"; - src = fetchFromGitHub { - owner = "ggandor"; - repo = "leap.nvim"; - rev = "5efe985cf68fac3b6a6dfe7a75fbfaca8db2af9c"; - sha256 = "093fzf1bki2ll3lrqbnrw9w7i7aajbma4zq83c2nkxwi5gj5jqgl"; - fetchSubmodules = false; - }; - }; dracula-nvim = buildVimPlugin { pname = "dracula.nvim"; version = "2023-07-29"; @@ -295,38 +295,6 @@ in fetchSubmodules = false; }; }; - comment-nvim = buildVimPlugin { - pname = "comment.nvim"; - version = "2023-08-07"; - src = fetchFromGitHub { - owner = "numtostr"; - repo = "comment.nvim"; - rev = "0236521ea582747b58869cb72f70ccfa967d2e89"; - sha256 = "1mvi7c6n9ybgs6lfylzhkidifa6jkgsbj808knx57blvi5k7blgr"; - fetchSubmodules = false; - }; - }; - coq_nvim = pkgs.vimPlugins.coq_nvim.overrideAttrs (_: { - version = "2023-10-07"; - src = fetchFromGitHub { - owner = "ms-jpq"; - repo = "coq_nvim"; - rev = "d4a58fa7ab20c928f88e416b3fcf6ada965bf314"; - sha256 = "0jk3gz1rbq1zwzly66gcxhkxqn2im45lr5q5vjg2idpvbn6y8zpf"; - fetchSubmodules = false; - }; - }); - coq-artifacts = buildVimPlugin { - pname = "coq.artifacts"; - version = "2023-09-07"; - src = fetchFromGitHub { - owner = "ms-jpq"; - repo = "coq.artifacts"; - rev = "469c27eb84a91fe2721b6c0af57703ffa1e785e9"; - sha256 = "0v902lf7l0590nif3g45c5ad0s1wr9v7bz0g733aji9hh3fcxl8i"; - fetchSubmodules = false; - }; - }; core-nvim = buildVimPlugin { pname = "core.nvim"; version = "2023-09-09"; @@ -349,28 +317,6 @@ in fetchSubmodules = false; }; }; - nvim-autopairs = buildVimPlugin { - pname = "nvim-autopairs"; - version = "2023-10-07"; - src = fetchFromGitHub { - owner = "windwp"; - repo = "nvim-autopairs"; - rev = "748e72c05495a3d30e88a6ef04b21697019a9aa9"; - sha256 = "11hf5j4khafg1gddkd98xb94077vswlwxdm077gyrwa4pifc7cnw"; - fetchSubmodules = false; - }; - }; - nvim-ts-autotag = buildVimPlugin { - pname = "nvim-ts-autotag"; - version = "2023-06-16"; - src = fetchFromGitHub { - owner = "windwp"; - repo = "nvim-ts-autotag"; - rev = "6be1192965df35f94b8ea6d323354f7dc7a557e4"; - sha256 = "1j47gcybag2qk87qc4karwdvzhvi485x7m80n2sj27rrh1fyv972"; - fetchSubmodules = false; - }; - }; vim-matchup = buildVimPlugin { pname = "vim-matchup"; version = "2023-09-02"; @@ -393,17 +339,6 @@ in fetchSubmodules = false; }; }; - nvim-surround = buildVimPlugin { - pname = "nvim-surround"; - version = "2023-08-18"; - src = fetchFromGitHub { - owner = "kylechui"; - repo = "nvim-surround"; - rev = "1c2ef599abeeb98e40706830bcd27e90e259367a"; - sha256 = "06j190qns6fscxp7mnr6zl5bipzbc4w478z5x5g2awghc0iwzkcr"; - fetchSubmodules = false; - }; - }; heirline-nvim = buildVimPlugin { pname = "heirline.nvim"; version = "2023-09-03"; diff --git a/home/programs/nvim/plugins.yaml b/home/programs/nvim/plugins.yaml index c0e443a..bb3b0c7 100644 --- a/home/programs/nvim/plugins.yaml +++ b/home/programs/nvim/plugins.yaml @@ -1,6 +1,7 @@ # Utils - src: nvim-lua/popup.nvim - src: nvim-lua/plenary.nvim +- src: echasnovski/mini.nvim - src: kyazdani42/nvim-web-devicons - src: willothy/wezterm.nvim # Keybindings @@ -8,7 +9,6 @@ - src: gbprod/yanky.nvim - src: gbprod/cutlass.nvim - src: gbprod/substitute.nvim -- src: ggandor/leap.nvim # Themes - src: Mofiqul/dracula.nvim # Syntax @@ -33,23 +33,13 @@ - src: RRethy/vim-illuminate # Linter - src: mfussenegger/nvim-lint -# Comments -- src: numtostr/comment.nvim -# Completion -- src: ms-jpq/coq_nvim - branch: coq -- src: ms-jpq/coq.artifacts - branch: artifacts # Formatting - src: niuiic/core.nvim - src: niuiic/format.nvim # Pairs -- src: windwp/nvim-autopairs -- src: windwp/nvim-ts-autotag - src: andymass/vim-matchup # Textobjects - src: nvim-treesitter/nvim-treesitter-textobjects -- src: kylechui/nvim-surround # UI - src: rebelot/heirline.nvim - src: lukas-reineke/indent-blankline.nvim