From a5930c5393ce9f1a41d62f972040d0078b304d47 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Tue, 12 Dec 2023 20:05:42 +0100 Subject: [PATCH] nvim: Update configuration --- flake.lock | 6 ++-- home/config/nvim/nifoc/theme.fnl | 2 ++ home/config/nvim/plugins/cmp.fnl | 4 +-- home/config/nvim/plugins/treesitter.fnl | 32 +++++++++++++++----- home/programs/nvim/default.nix | 12 ++++++-- home/programs/nvim/plugins.nix | 40 ++++++++++++------------- home/programs/nvim/plugins.yaml | 2 +- 7 files changed, 62 insertions(+), 36 deletions(-) diff --git a/flake.lock b/flake.lock index ca67806..42ad528 100644 --- a/flake.lock +++ b/flake.lock @@ -549,11 +549,11 @@ ] }, "locked": { - "lastModified": 1702281974, - "narHash": "sha256-OX6umqmLlRKKX0yEfQBmMx8pDNHtxp+sGTLyFh8kLG8=", + "lastModified": 1702396052, + "narHash": "sha256-mN/PF3B3/L+nTQWhq0cC4+RFS4zIDN/o4v7j7flV8uM=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "5ff2cdbe0db6a6f3445f7d878cb87d121d914d83", + "rev": "8af5563aa9971a96af7fbbf8830be602869278f3", "type": "github" }, "original": { diff --git a/home/config/nvim/nifoc/theme.fnl b/home/config/nvim/nifoc/theme.fnl index e86583a..b7f9e99 100644 --- a/home/config/nvim/nifoc/theme.fnl +++ b/home/config/nvim/nifoc/theme.fnl @@ -48,6 +48,8 @@ (highlight :CmpItemAbbrMatch {:fg mod.colors.cyan :bg :NONE :bold true}) (highlight :CmpItemAbbrMatchFuzzy {:fg mod.colors.cyan :bg :NONE :bold true}) + (highlight :CmpItemAbbrDeprecated + {:fg mod.colors.white :bg :NONE :strikethrough true}) (highlight :CmpItemMenu {:fg mod.colors.purple :bg :NONE :italic true}) (let [cmp-groups [:CmpItemKindField :CmpItemKindProperty diff --git a/home/config/nvim/plugins/cmp.fnl b/home/config/nvim/plugins/cmp.fnl index bc9c1e7..0cb190d 100644 --- a/home/config/nvim/plugins/cmp.fnl +++ b/home/config/nvim/plugins/cmp.fnl @@ -7,9 +7,7 @@ [{:name :cmp_tabnine}] [])] (vim.list_extend (vim.list_extend [{:name :nvim_lsp}] maybe-tabnine) - [{:name :async_path} - {:name :luasnip} - {:name :cmp_yanky :option {:minLength 3}}]))) + [{:name :async_path} {:name :luasnip}]))) (fn comparator-list [] (let [compare (require :cmp.config.compare) diff --git a/home/config/nvim/plugins/treesitter.fnl b/home/config/nvim/plugins/treesitter.fnl index 9e18fae..bafc1c4 100644 --- a/home/config/nvim/plugins/treesitter.fnl +++ b/home/config/nvim/plugins/treesitter.fnl @@ -7,14 +7,32 @@ :auto_install false :highlight {:enable true :disable disable-parsers} :indent {:enable true :disable disable-parsers} - :textobjects {:select {:enable true - :disable disable-parsers - :keymaps {:af "@function.outer" - :if "@function.inner" - :ac "@conditional.outer" - :ic "@conditional.inner"}}} :matchup {:enable true :disable disable-parsers} :autopairs {:enable true :disable disable-parsers} :playground {:enable true} :nifoc_hooks {:enable true - :disable disable-parsers}})) + :disable disable-parsers} + :textobjects {:select {:enable true + :lookahead true + :keymaps {:af {:query "@function.outer" + :desc "Select outer part of a function"} + :if {:query "@function.inner" + :desc "Select inner part of a function"} + :ac {:query "@class.outer" + :desc "Select outer part of a class"} + :ic {:query "@class.inner" + :desc "Select inner part of a class"} + :as {:query "@scope" + :desc "Select language scope"}}} + :swap {:enable true + :swap_next {:a {:query "@parameter.inner" + :desc "Swap function parameter with the next one"}} + :swap_previous {:A {:query "@parameter.inner" + :desc "Swap function parameter with the previous one"}}} + :lsp_interop {:enable true + :border :rounded + :floating_preview_opts {} + :peek_definition_code {:lpf {:query "@function.outer" + :desc "Peek outer function definition"} + :lpF {:query "@class.outer" + :desc "Peek outer class definition"}}}}})) diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index 29a3185..f042f7a 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -56,15 +56,21 @@ in treesitter-parsers = pkgs.symlinkJoin { name = "treesitter-parsers"; paths = (pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ + p.angular p.bash #p.comment # slow p.css + p.diff p.dockerfile p.eex p.elixir p.erlang p.fennel p.fish + p.git_rebase + p.gitattributes + p.gitcommit + p.gitignore p.graphql p.heex p.html @@ -77,8 +83,9 @@ in p.lua p.make p.markdown - p.markdown-inline + p.markdown_inline p.nix + p.python p.query p.regex p.ruby @@ -244,7 +251,6 @@ in cmp-buffer cmp-cmdline cmp-nvim-lsp-document-symbol - cmp_yanky # Formatting @@ -268,6 +274,8 @@ in } # Textobjects + nvim-treesitter-textobjects + { plugin = nvim-surround; config = builtins.readFile ../../config/nvim/plugins/surround.fnl; diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index d18e741..7f113a7 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -117,12 +117,12 @@ in }; nvim-treesitter = buildVimPlugin { pname = "nvim-treesitter"; - version = "2023-12-11"; + version = "2023-12-12"; src = fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "a6c655629cad421e432aa84af32cbfe35375113a"; - sha256 = "0cpnn155y1ygqkk18929mn7iq4hd0naxxdb8nh5z7621w0w8nanf"; + rev = "78d75bce03f218ee30aedb6e24e3ec1189a3e9ff"; + sha256 = "0c8ybynj7z7z88nlw15rq7vzqzv5vnx83cyf0rksy8xlkz5vrsdv"; fetchSubmodules = false; }; }; @@ -230,12 +230,12 @@ in }; nvim-lspconfig = buildVimPlugin { pname = "nvim-lspconfig"; - version = "2023-12-10"; + version = "2023-12-12"; src = fetchFromGitHub { owner = "neovim"; repo = "nvim-lspconfig"; - rev = "bd405e45c5fb122c16af8f87fa2dd7ab1981b243"; - sha256 = "1jfjy8j91b66i2kkzikkybl56b62ybj8kshxyjjwlvlz9vaqd06j"; + rev = "f451052bd6804e9e5ccd0ac874d7df8d3d4c55b9"; + sha256 = "1cf0vzdk2jmj63x7cg9p5m2lhi5ch7p8mrsidclx9h4qpf4vl0ns"; fetchSubmodules = false; }; }; @@ -404,17 +404,6 @@ in fetchSubmodules = false; }; }; - cmp_yanky = buildVimPlugin { - pname = "cmp_yanky"; - version = "2023-11-16"; - src = fetchFromGitHub { - owner = "chrisgrieser"; - repo = "cmp_yanky"; - rev = "c3d089186ccead26eba01023502f3eeadd7a92d2"; - sha256 = "19197b4all82qzm80ms9h7aj1a4yp04b3jgy2j7r3irl6qmnhqwd"; - fetchSubmodules = false; - }; - }; conform-nvim = buildVimPlugin { pname = "conform.nvim"; version = "2023-12-11"; @@ -448,6 +437,17 @@ in fetchSubmodules = false; }; }; + nvim-treesitter-textobjects = buildVimPlugin { + pname = "nvim-treesitter-textobjects"; + version = "2023-12-01"; + src = fetchFromGitHub { + owner = "nvim-treesitter"; + repo = "nvim-treesitter-textobjects"; + rev = "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a"; + sha256 = "1kdfwihk8ci827aq4w6xv7vn2740qpmh6dk892cd6yi0ab4zxvxn"; + fetchSubmodules = false; + }; + }; nvim-surround = buildVimPlugin { pname = "nvim-surround"; version = "2023-12-04"; @@ -516,12 +516,12 @@ in }; gitsigns-nvim = buildVimPlugin { pname = "gitsigns.nvim"; - version = "2023-12-10"; + version = "2023-12-12"; src = fetchFromGitHub { owner = "lewis6991"; repo = "gitsigns.nvim"; - rev = "6e05045fb1a4845fe44f5c54aafe024444c422ba"; - sha256 = "0wj7cbh9rf77zzzylnx6fahvs7ygnjmqpkm95vaixbg5v5f0hdwj"; + rev = "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9"; + sha256 = "0n1pdil0di93sfmlxnw80xvwxgz36m3hllhzg16bmlcjwgagwclp"; fetchSubmodules = false; }; }; diff --git a/home/programs/nvim/plugins.yaml b/home/programs/nvim/plugins.yaml index 18fc704..1942ba4 100644 --- a/home/programs/nvim/plugins.yaml +++ b/home/programs/nvim/plugins.yaml @@ -46,13 +46,13 @@ - src: hrsh7th/cmp-buffer - src: hrsh7th/cmp-cmdline - src: hrsh7th/cmp-nvim-lsp-document-symbol -- src: chrisgrieser/cmp_yanky # Formatting - src: stevearc/conform.nvim # Pairs - src: windwp/nvim-autopairs - src: andymass/vim-matchup # Textobjects +- src: nvim-treesitter/nvim-treesitter-textobjects - src: kylechui/nvim-surround # UI - src: stevearc/oil.nvim