From 4f8abcd9c43666475ab7ab98269f55a33525e03b Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 15 Apr 2022 22:43:51 +0200 Subject: [PATCH] nvim: Update configuration --- config/nvim/plugins/cmp.fnl | 10 ++--- config/nvim/plugins/luasnip.fnl | 2 + flake.lock | 12 +++--- programs/nvim/default.nix | 15 +++++-- programs/nvim/plugins.nix | 70 ++++++++++++++++----------------- programs/nvim/plugins.yaml | 6 ++- 6 files changed, 64 insertions(+), 51 deletions(-) create mode 100644 config/nvim/plugins/luasnip.fnl diff --git a/config/nvim/plugins/cmp.fnl b/config/nvim/plugins/cmp.fnl index 5ed8006..3d7b735 100644 --- a/config/nvim/plugins/cmp.fnl +++ b/config/nvim/plugins/cmp.fnl @@ -1,5 +1,5 @@ (let [cmp (require :cmp) - snippy (require :snippy) + luasnip (require :luasnip) lspkind (require :lspkind) npairs (require :nvim-autopairs.completion.cmp)] (fn has-words-before? [] @@ -12,17 +12,17 @@ (fn map-tab [fallback] (if (cmp.visible) (cmp.select_next_item) - (snippy.can_expand_or_advance) (snippy.expand_or_advance) + (luasnip.expand_or_jumpable) (luasnip.expand_or_jump) (has-words-before?) (cmp.complete) (fallback))) (fn map-stab [fallback] (if (cmp.visible) (cmp.select_prev_item) - (snippy.can_jump -1) (snippy.previous) + (luasnip.jumpable -1) (luasnip.jump -1) (fallback))) (cmp.setup {:sources (cmp.config.sources [{:name :nvim_lsp} - {:name :snippy} + {:name :luasnip} {:name :nvim_lua}] [{:name :treesitter} {:name :buffer} @@ -53,7 +53,7 @@ "╰" "│"]}} :snippet {:expand (fn [args] - (snippy.expand_snippet args.body))} + (luasnip.lsp_expand args.body))} :formatting {:format (lspkind.cmp_format)}}) (cmp.setup.cmdline "/" {:sources (cmp.config.sources [{:name :nvim_lsp_document_symbol}] diff --git a/config/nvim/plugins/luasnip.fnl b/config/nvim/plugins/luasnip.fnl new file mode 100644 index 0000000..4f21f32 --- /dev/null +++ b/config/nvim/plugins/luasnip.fnl @@ -0,0 +1,2 @@ +(let [luasnip-vscode (require :luasnip.loaders.from_vscode)] + (luasnip-vscode.lazy_load)) diff --git a/flake.lock b/flake.lock index 275d188..243581a 100644 --- a/flake.lock +++ b/flake.lock @@ -73,11 +73,11 @@ ] }, "locked": { - "lastModified": 1649887921, - "narHash": "sha256-h2LZzn5LLwIFvVFLCdR8+VWluEP3U1I5y+0mDZjFjAk=", + "lastModified": 1649984295, + "narHash": "sha256-55dgKGs7W8eC3s9GYewll9y4IlP/KAlSinjQwshNpxM=", "owner": "nix-community", "repo": "home-manager", - "rev": "92f58b6728e7c631a7ea0ed68cd21bb29a4876ff", + "rev": "d49d68f4196d32c5039cb9e91d730cee894f6f14", "type": "github" }, "original": { @@ -186,11 +186,11 @@ ] }, "locked": { - "lastModified": 1649897071, - "narHash": "sha256-KX3hG1+pPK2ESIT4914SfNIOLaZ4LvPsSK0hOBAnqGE=", + "lastModified": 1649983175, + "narHash": "sha256-7TUy8tF/Kgebozx0gnwmHUQz9bWk9UrMsdxdgMtUvCs=", "owner": "arqv", "repo": "zig-overlay", - "rev": "03fa63d355c9b82f19303fd8b944b895e62adf44", + "rev": "40b26de1698b2b1734c127b22db2beaa043fd1ee", "type": "github" }, "original": { diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index b2ff3fb..defedbc 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -148,6 +148,13 @@ in type = "fennel"; } + # Snippets + { + plugin = LuaSnip; + config = builtins.readFile ../../config/nvim/plugins/luasnip.fnl; + type = "fennel"; + } + # cmp { plugin = nvim-cmp; @@ -157,8 +164,7 @@ in cmp-nvim-lsp cmp-nvim-lsp-signature-help - nvim-snippy - cmp-snippy + cmp_luasnip cmp-nvim-lua cmp-path cmp-buffer @@ -288,6 +294,9 @@ in type = "fennel"; } + # Snippets + friendly-snippets + # Textobjects vim-surround @@ -303,7 +312,7 @@ in }; xdg.configFile."nvim" = { - source = pkgs.runCommandLocal "nvim-fennel-files" + source = pkgs.runCommand "nvim-fennel-files" { nativeBuildInputs = [ pkgs.fennel pkgs.stylua ]; } '' diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 7a7cd3a..231bf91 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -39,12 +39,12 @@ }; legendary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "legendary.nvim"; - version = "1649956876"; + version = "1650043687"; src = pkgs.fetchFromGitHub { owner = "mrjones2014"; repo = "legendary.nvim"; - rev = "170ecf60b417907bade27e30e3f628c389ab3fe2"; - sha256 = "bhTuZWYSLEawA9C9TMYAfuP3+53+sCmIC0OFj6IaxdQ="; + rev = "8ab6ba601a5ff2baa54e44d3e81bd31413bf63d6"; + sha256 = "EWewlioREzNJ9gvueqjlorrLM3dIy3Ex1vEBNUuS66Q="; fetchSubmodules = true; }; meta.homepage = "https://github.com/mrjones2014/legendary.nvim"; @@ -111,12 +111,12 @@ }; nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter"; - version = "1649961252"; + version = "1650041891"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "0fc170120a5ca69164f6bd4da3b26fd01aa41592"; - sha256 = "DnPov+oOJwINpqyvqvtemwhRyfQTn45I+kLtn20KhVU="; + rev = "d9cc414e693b6421c8e0d79835e7d30d835338bd"; + sha256 = "TuaQ/zeKvfIr7cRQfiEBWuUyo45/Qdj49CnOthAhrGA="; fetchSubmodules = true; }; meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter"; @@ -190,12 +190,12 @@ }; nvim-lspconfig = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-lspconfig"; - version = "1649567599"; + version = "1649985901"; src = pkgs.fetchFromGitHub { owner = "neovim"; repo = "nvim-lspconfig"; - rev = "fd7843ad04cbc8ee2181bed9c3e83839b0d0b285"; - sha256 = "xq0OLYEVWIYAMo+oKZl6pNzDhLZVCVsFt/OoSSkVjAQ="; + rev = "99596a8cabb050c6eab2c049e9acde48f42aafa4"; + sha256 = "qU9D2bGRS6gDIxY8pgjwTVEwDTa8GXHUUQkXk9pBK/U="; fetchSubmodules = true; }; meta.homepage = "https://github.com/neovim/nvim-lspconfig"; @@ -236,6 +236,18 @@ }; meta.homepage = "https://github.com/lukas-reineke/lsp-format.nvim"; }; + LuaSnip = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "LuaSnip"; + version = "1650006023"; + src = pkgs.fetchFromGitHub { + owner = "L3MON4D3"; + repo = "LuaSnip"; + rev = "6b67cb12747225a6412d8263bb97d6d2b8d9366a"; + sha256 = "w73j+QzR+qriRplGP56TePaGUCAkQgBbMZjV8dGcQSE="; + fetchSubmodules = true; + }; + meta.homepage = "https://github.com/L3MON4D3/LuaSnip"; + }; nvim-cmp = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-cmp"; version = "1649936528"; @@ -272,29 +284,17 @@ }; meta.homepage = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help"; }; - nvim-snippy = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "nvim-snippy"; - version = "1649802147"; + cmp_luasnip = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "cmp_luasnip"; + version = "1648846007"; src = pkgs.fetchFromGitHub { - owner = "dcampos"; - repo = "nvim-snippy"; - rev = "4dd4f1146248c0986d3fa6e22e6a31f591b903e9"; - sha256 = "5Rids2bDRaK1EfRglCnhfKxCgZJl3qBStglq6jbPPn0="; + owner = "saadparwaiz1"; + repo = "cmp_luasnip"; + rev = "b10829736542e7cc9291e60bab134df1273165c9"; + sha256 = "1JiDa7fK9AEMUxLOFD3SSsxKEVLfd5xR8vfUlLRqz+M="; fetchSubmodules = true; }; - meta.homepage = "https://github.com/dcampos/nvim-snippy"; - }; - cmp-snippy = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "cmp-snippy"; - version = "1632148155"; - src = pkgs.fetchFromGitHub { - owner = "dcampos"; - repo = "cmp-snippy"; - rev = "9af1635fe40385ffa3dabf322039cb5ae1fd7d35"; - sha256 = "vseoNZtB8jPGAJD8zFJigwKn11rXsNy04ipg0fYM46k="; - fetchSubmodules = true; - }; - meta.homepage = "https://github.com/dcampos/cmp-snippy"; + meta.homepage = "https://github.com/saadparwaiz1/cmp_luasnip"; }; cmp-nvim-lua = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "cmp-nvim-lua"; @@ -442,12 +442,12 @@ }; indent-blankline-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "indent-blankline.nvim"; - version = "1649663069"; + version = "1649991995"; src = pkgs.fetchFromGitHub { owner = "lukas-reineke"; repo = "indent-blankline.nvim"; - rev = "db7d3ad34e020f1cc30e06bab9dd4e98ebde5643"; - sha256 = "d0Celb62TSecMJGb5MckQk5JerurXxFdH5Y0Jf/3o64="; + rev = "045d9582094b27f5ae04d8b635c6da8e97e53f1d"; + sha256 = "pMVby6w7UTR2f1Nxp0ZPlV+KrdXNJ+jEQeQe30Pfs3M="; fetchSubmodules = true; }; meta.homepage = "https://github.com/lukas-reineke/indent-blankline.nvim"; @@ -478,12 +478,12 @@ }; gitsigns-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "gitsigns.nvim"; - version = "1649949249"; + version = "1650039181"; src = pkgs.fetchFromGitHub { owner = "lewis6991"; repo = "gitsigns.nvim"; - rev = "dd60a8845d0e701321c6352376e38c68d3693a0b"; - sha256 = "JNzYxUOi9rEnJZabfWBGb4kIXQaUYKAbP+SD7/+GaD4="; + rev = "e899189c362d856b9229aaa339a48549dd0cef39"; + sha256 = "xf47/cEsWk6sYPRHc7Y9MCH4OKLN8I7Y9pEBbQYDwj8="; fetchSubmodules = true; }; meta.homepage = "https://github.com/lewis6991/gitsigns.nvim"; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml index e1eb2c0..733a71f 100644 --- a/programs/nvim/plugins.yaml +++ b/programs/nvim/plugins.yaml @@ -39,12 +39,14 @@ - src: jubnzv/virtual-types.nvim - src: lukas-reineke/lsp-format.nvim +# Snippets +- src: L3MON4D3/LuaSnip + # cmp - src: hrsh7th/nvim-cmp - src: hrsh7th/cmp-nvim-lsp - src: hrsh7th/cmp-nvim-lsp-signature-help -- src: dcampos/nvim-snippy -- src: dcampos/cmp-snippy +- src: saadparwaiz1/cmp_luasnip - src: hrsh7th/cmp-nvim-lua - src: hrsh7th/cmp-path - src: hrsh7th/cmp-buffer