diff --git a/flake.lock b/flake.lock index 348c694..7db9700 100644 --- a/flake.lock +++ b/flake.lock @@ -244,11 +244,11 @@ ] }, "locked": { - "lastModified": 1700900274, - "narHash": "sha256-KWoKDP5I1viHR4bG3ENnJ7H1DD16tXWH4ROvS0IfXw8=", + "lastModified": 1701071203, + "narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=", "owner": "nix-community", "repo": "home-manager", - "rev": "a462e7315deaa8194b0821f726709bb7e51a850c", + "rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86", "type": "github" }, "original": { @@ -287,11 +287,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1700997205, - "narHash": "sha256-g1bsLaUGCahQJX4D64saAPoZKL749F5jiRJrJbzEAmc=", + "lastModified": 1701055024, + "narHash": "sha256-eH/2w7+jVdiLIc5sETq3uDDtCadC4s+w740N5G89LH0=", "owner": "neovim", "repo": "neovim", - "rev": "17d81ac2abc42b75e46d7212f6d8d9c1fe8d4f0a", + "rev": "6343d414369de1f3b259e51438cd4f666d82d3d2", "type": "github" }, "original": { @@ -312,11 +312,11 @@ ] }, "locked": { - "lastModified": 1701000384, - "narHash": "sha256-MlHw8fE4QBFOSJvv/h0WYrCz+3Z/XkfoVyTlAtZmWLc=", + "lastModified": 1701072523, + "narHash": "sha256-rMSwV5RqhzQorvZtvJkkILBxEvwS5zC0dkIXpwK8Rnc=", "ref": "refs/heads/master", - "rev": "bb6b7a74a9b66549b940a37ea0b473aee9ef3e05", - "revCount": 597, + "rev": "115ae9f035cdb0ea0ec7c98d39f9c8b9028d2575", + "revCount": 599, "type": "git", "url": "https://git.kempkens.io/daniel/nix-overlay" }, @@ -347,11 +347,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1700559156, - "narHash": "sha256-gL4epO/qf+wo30JjC3g+b5Bs8UrpxzkhNBBsUYxpw2g=", + "lastModified": 1701020860, + "narHash": "sha256-NwnRn04C8s+hH+KdVtGmVB1FFNIG7DtPJmQSCBDaET4=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c3abafb01cd7045dba522af29b625bd1e170c2fb", + "rev": "b006ec52fce23b1d57f6ab4a42d7400732e9a0a2", "type": "github" }, "original": { @@ -363,11 +363,11 @@ }, "nixos-unstable": { "locked": { - "lastModified": 1700867874, - "narHash": "sha256-0Dk63BLiG9rmfBf8LxFpz8KgpUkepehVzhhVDgfxWSo=", + "lastModified": 1701038920, + "narHash": "sha256-qlEfi8fhKK2oJwX4V6BPEo0qbpWQzQYRU4LrDya/zi0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1b99d72c8b7468def0c633635c469bf828db33a0", + "rev": "28f167a2e998faa5a42896add2a43ff5685832a0", "type": "github" }, "original": { @@ -379,11 +379,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700856099, - "narHash": "sha256-RnEA7iJ36Ay9jI0WwP+/y4zjEhmeN6Cjs9VOFBH7eVQ=", + "lastModified": 1701040486, + "narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0bd59c54ef06bc34eca01e37d689f5e46b3fe2f1", + "rev": "45827faa2132b8eade424f6bdd48d8828754341a", "type": "github" }, "original": { diff --git a/home/config/nvim/plugins/cmp.fnl b/home/config/nvim/plugins/cmp.fnl index 2a607a2..b163ff9 100644 --- a/home/config/nvim/plugins/cmp.fnl +++ b/home/config/nvim/plugins/cmp.fnl @@ -1,10 +1,29 @@ (let [cmp (require :cmp) luasnip (require :luasnip) lspkind (require :lspkind) - npairs (require :nvim-autopairs.completion.cmp) - maybe-tabnine (if (pcall require :cmp_tabnine.config) - [{:name :cmp_tabnine}] - [])] + npairs (require :nvim-autopairs.completion.cmp)] + (fn main-sources [] + (let [maybe-tabnine (if (pcall require :cmp_tabnine.config) + [{:name :cmp_tabnine}] + [])] + (vim.list_extend (vim.list_extend [{:name :nvim_lsp}] maybe-tabnine) + [{:name :async_path} {:name :luasnip}]))) + + (fn comparator-list [] + (let [compare (require :cmp.config.compare) + maybe-tabnine (if (pcall require :cmp_tabnine.compare) + [(require :cmp_tabnine.compare)] + [])] + (vim.list_extend (vim.list_extend [compare.offset + compare.exact + compare.score] + maybe-tabnine) + [compare.recently_used + compare.locality + compare.kind + compare.length + compare.order]))) + (fn has-words-before? [] (let [(line col) (-> 0 (vim.api.nvim_win_get_cursor) (unpack))] (if (not= col 0) @@ -24,14 +43,11 @@ (luasnip.jumpable -1) (luasnip.jump -1) (fallback))) - (cmp.setup {:sources (cmp.config.sources (vim.list_extend [{:name :nvim_lsp} - {:name :luasnip} - {:name :treesitter - :keyword_length 3} - {:name :buffer - :keyword_length 3} - {:name :async_path}] - maybe-tabnine)) + (cmp.setup {:sources (cmp.config.sources (main-sources) + [{:name :treesitter + :keyword_length 3} + {:name :buffer :keyword_length 3}]) + :sorting {:priority_weight 2 :comparators (comparator-list)} :mapping (cmp.mapping.preset.insert {: (cmp.mapping {:i (cmp.mapping.abort) :c (cmp.mapping.close)}) : (cmp.mapping {:i (cmp.mapping.abort)}) @@ -50,7 +66,8 @@ : (cmp.mapping.confirm {:select true})}) :window {:completion {:winhighlight "Normal:Pmenu,FloatBorder:Pmenu,Search:None" :col_offset -3 - :side_padding 0} + :side_padding 0 + :scrollbar true} :documentation (cmp.config.window.bordered)} :view {:entries {:name :custom :selection_order :near_cursor}} :completion {:keyword_length 2 diff --git a/home/config/nvim/plugins/cmp_tabnine.fnl b/home/config/nvim/plugins/cmp_tabnine.fnl new file mode 100644 index 0000000..100b854 --- /dev/null +++ b/home/config/nvim/plugins/cmp_tabnine.fnl @@ -0,0 +1,18 @@ +(let [tabnine (require :cmp_tabnine) + tabnine-config (require :cmp_tabnine.config) + augroup (vim.api.nvim_create_augroup :NifocTabNine {:clear true}) + aucmd vim.api.nvim_create_autocmd] + (tabnine-config:setup {:ignored_file_types {:markdown true :text true}}) + (aucmd :BufRead {:callback #(tabnine:prefetch (vim.fn.expand "%:p")) + :pattern [:*.css + :*.html + :*.java + :*.js + :*.jsx + :*.kt + :*.php + :*.py + :*.rb + :*.ts + :*.tsx] + :group augroup})) diff --git a/home/programs/nvim/default.nix b/home/programs/nvim/default.nix index 48ca310..0dcd15d 100644 --- a/home/programs/nvim/default.nix +++ b/home/programs/nvim/default.nix @@ -315,7 +315,11 @@ in type = "fennel"; } ] ++ optionals isDarwin [ - pkgs.vimPlugins.cmp-tabnine + { + plugin = pkgs.vimPlugins.cmp-tabnine; + config = builtins.readFile ../../config/nvim/plugins/cmp_tabnine.fnl; + type = "fennel"; + } ]; }; diff --git a/home/programs/nvim/plugins.nix b/home/programs/nvim/plugins.nix index 92c1e7f..392e2cb 100644 --- a/home/programs/nvim/plugins.nix +++ b/home/programs/nvim/plugins.nix @@ -40,12 +40,12 @@ in }; nvim-web-devicons = buildVimPlugin { pname = "nvim-web-devicons"; - version = "2023-11-20"; + version = "2023-11-27"; src = fetchFromGitHub { owner = "kyazdani42"; repo = "nvim-web-devicons"; - rev = "cdbcca210cf3655aa9b31ebf2422763ecd85ee5c"; - sha256 = "18bxb2zg55ccjzj7q2kyv3bhyxagf3pm89zqhmwy45n0ng9vmn89"; + rev = "5efb8bd06841f91f97c90e16de85e96d57e9c862"; + sha256 = "1vxc1b51h6ss6h7fcihl6v01v8a8df1i6hz11hq2m46dyqw2n5p9"; fetchSubmodules = false; }; }; @@ -62,12 +62,12 @@ in }; yanky-nvim = buildVimPlugin { pname = "yanky.nvim"; - version = "2023-11-24"; + version = "2023-11-27"; src = fetchFromGitHub { owner = "gbprod"; repo = "yanky.nvim"; - rev = "5ba331de8a8d18e1ec345d26e865bc3a0db2e8be"; - sha256 = "0zv322rybvky8qkzrrbc2nsrh6rfq7awnwlh9ydkkpkm63nphzl8"; + rev = "6bb9ffd3cad4c9876bda54e19d0659de28a4f84f"; + sha256 = "01pd9xgw9wh9xa4sk80g0n61ra4l9xvssqak6vv03kgrpyb1qizw"; fetchSubmodules = false; }; }; @@ -106,12 +106,12 @@ in }; nvim-treesitter = buildVimPlugin { pname = "nvim-treesitter"; - version = "2023-11-26"; + version = "2023-11-27"; src = fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "9d91101f71cc64cdef923a3b14130db82985bac6"; - sha256 = "0k5yi04r9bk5w69n1ivll7jzfs4xkr8fzfy4qpzmv696lp0g0608"; + rev = "482a2f15d37817e1201466d00c6539574ba34554"; + sha256 = "111akj91fzrqlrlnndbvc20ji0ln8m25bhqyb8sva1vmav9q25cb"; fetchSubmodules = false; }; }; @@ -132,8 +132,8 @@ in src = fetchFromGitHub { owner = "HiPhish"; repo = "rainbow-delimiters.nvim"; - rev = "6aaaf119e32ccf707c439aeac67041221359f031"; - sha256 = "0jg4acr3icbaixbfygsj83805rs2bw6b85g6jbacl2n02rcsm276"; + rev = "47404636a34580db1636dc0cf35027bdf77abba5"; + sha256 = "0li17i97h8iyk4pa79n1jgzi3firnjmz88vxx0aadd3x33p45d2r"; fetchSubmodules = false; }; }; @@ -208,12 +208,12 @@ in }; nvim-lspconfig = buildVimPlugin { pname = "nvim-lspconfig"; - version = "2023-11-22"; + version = "2023-11-27"; src = fetchFromGitHub { owner = "neovim"; repo = "nvim-lspconfig"; - rev = "553c4e0e667167640c5398573f6f3a488ff8047a"; - sha256 = "0jm03jrsy1yj293hyimakhxcsak45f55zjc1ch1smy0h0qgr23fm"; + rev = "daaf00a77805e113acf8ccc02dd8c3403d691683"; + sha256 = "1kp7hl5x311a1ysg91dnijxscs3cy3r901zmrv6kqwlh1k5yl0p1"; fetchSubmodules = false; }; }; @@ -483,12 +483,12 @@ in }; fidget-nvim = buildVimPlugin { pname = "fidget.nvim"; - version = "2023-11-20"; + version = "2023-11-27"; src = fetchFromGitHub { owner = "j-hui"; repo = "fidget.nvim"; - rev = "a1493d94ecb3464ab3ae4d5855765310566dace4"; - sha256 = "09hr2l3y0b4j3r308xqmj0pa8nqsx13x1g2ar3bpyj5dz42m8kgg"; + rev = "5eb5bf68bcdcd45940ad3d7155c0630476ee63cc"; + sha256 = "0x3pgghbhysc7ix543zi3w0w3gfjl9z11skx56vjy6gkw1vkd08z"; fetchSubmodules = false; }; };