diff --git a/nix/sources.json b/nix/sources.json index bf67a38..dae69f1 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -35,10 +35,10 @@ "rev": "3022dbc9166796b644a841a02de8dd1cc1d311fa", "type": "git" }, - "cmp-fuzzy-path": { - "branch": "master", - "repo": "git@github.com:tzachar/cmp-fuzzy-path", - "rev": "9953c11a2510a04111b7b152cf50ae1e83f00798", + "cmp-cmdline": { + "branch": "main", + "repo": "git@github.com:hrsh7th/cmp-cmdline", + "rev": "d250c63aa13ead745e3a40f61fdd3470efde3923", "type": "git" }, "cmp-git": { @@ -53,30 +53,12 @@ "rev": "39e2eda76828d88b773cc27a3f61d2ad782c922d", "type": "git" }, - "cmp-nvim-lsp-signature-help": { - "branch": "main", - "repo": "git@github.com:hrsh7th/cmp-nvim-lsp-signature-help", - "rev": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7", - "type": "git" - }, "cmp-path": { "branch": "main", "repo": "git@github.com:hrsh7th/cmp-path", "rev": "91ff86cd9c29299a64f968ebb45846c485725f23", "type": "git" }, - "cmp-snippy": { - "branch": "master", - "repo": "git@github.com:dcampos/cmp-snippy", - "rev": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3", - "type": "git" - }, - "cmp-under-comparator": { - "branch": "master", - "repo": "git@github.com:lukas-reineke/cmp-under-comparator", - "rev": "6857f10272c3cfe930cece2afa2406e1385bfef8", - "type": "git" - }, "conform.nvim": { "branch": "master", "repo": "git@github.com:stevearc/conform.nvim", @@ -119,12 +101,6 @@ "rev": "a9be4e76c30a128f1e51af448c8321bf8366bcd4", "type": "git" }, - "fuzzy.nvim": { - "branch": "master", - "repo": "git@github.com:tzachar/fuzzy.nvim", - "rev": "68608f6a232f7e73ccf81437bf12108128f15bd4", - "type": "git" - }, "fzf": { "branch": "master", "repo": "git@github.com:junegunn/fzf", @@ -515,12 +491,6 @@ "rev": "6c1584eb76b55629702716995cca4ae2798a9cca", "type": "git" }, - "wilder.nvim": { - "branch": "master", - "repo": "ssh://git@github.com/gelguy/wilder.nvim", - "rev": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf", - "type": "git" - }, "zen-mode.nvim": { "branch": "main", "repo": "git@github.com:folke/zen-mode.nvim", diff --git a/plugins/cmp.lua b/plugins/cmp.lua index 71e2a4c..9731889 100644 --- a/plugins/cmp.lua +++ b/plugins/cmp.lua @@ -1,95 +1,28 @@ return function() - local cmp = require "cmp" - local snippy = require "snippy" - - local cmp_buffer_locality_comparator = function(...) - return require("cmp_buffer"):compare_locality(...) - end - local cmp_clangd_comparator = require "clangd_extensions.cmp_scores" - local cmp_fuzzy_path_comparator = require "cmp_fuzzy_path.compare" - local cmp_under_comparator = require("cmp-under-comparator").under - vim.opt.completeopt = { "menu", "menuone", "noselect" } + vim.opt.shortmess:append "c" - require("cmp_git").setup() - -- TODO: Enable these: - -- require("cmp_shell").setup() - -- require("nix-flake-prefetch.cmp").setup() + local cmp = require "cmp" cmp.setup { - snippet = { - expand = function(args) - snippy.expand_snippet(args.body) - end, + sources = { + { name = "nvim_lsp" }, + { name = "path" }, + { name = "buffer" }, }, mapping = { - [""] = cmp.mapping.scroll_docs(5), - [""] = cmp.mapping.scroll_docs(-5), - [""] = cmp.mapping.close(), - [""] = function(fallback) - if cmp.visible() then - return cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }(fallback) - else - return fallback() - end - end, + [""] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, + [""] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, + [""] = cmp.mapping( + cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + { "i", "c" } + ), [""] = cmp.mapping { - ---@diagnostic disable-next-line: missing-parameter i = cmp.mapping.complete(), }, - -- TODO: vim.snippet? - [""] = cmp.mapping { - i = function(fallback) - if snippy.can_expand_or_advance() then - snippy.expand_or_advance() - elseif cmp.visible() then - return cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }(fallback) - else - return fallback() - end - end, - }, - [""] = cmp.mapping { - i = function(fallback) - if snippy.can_jump(-1) then - snippy.previous() - elseif cmp.visible() then - return cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }(fallback) - else - return fallback() - end - end, - }, - }, - sources = cmp.config.sources({ - { name = "shell" }, - { name = "nix_flake_prefetch" }, - }, { - { name = "nvim_lsp" }, - { name = "nvim_lsp_signature_help" }, - { name = "snippy" }, - -- { name = "cody" }, - }, { - { name = "path" }, - { name = "buffer" }, - }), - sorting = { - priority_weight = 2, - comparators = { - cmp_buffer_locality_comparator, - cmp_fuzzy_path_comparator, - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp_clangd_comparator, - cmp_under_comparator, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, }, formatting = { format = require("lspkind").cmp_format { @@ -103,12 +36,21 @@ return function() nvim_lua = "[nvim]", path = "[path]", shell = "[ sh]", - snippy = "[snip]", }, }, }, } + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + matching = { disallow_symbol_nonprefix_matching = false }, + }) + cmp.setup.filetype("gitcommit", { sources = { { name = "cmp_git" }, diff --git a/plugins/spec.nix b/plugins/spec.nix index acd5244..58b31fa 100644 --- a/plugins/spec.nix +++ b/plugins/spec.nix @@ -1,7 +1,6 @@ { config, inputs', - lib, pkgs, ... }: let @@ -47,20 +46,11 @@ in rec { config = ./cmp.lua; dependencies = { # inherit sg; - cmp-buffer = { - src = sources.cmp-buffer; - }; - cmp-fuzzy-path = { - src = sources.cmp-fuzzy-path; - dependencies = { - fuzzy_nvim = { - src = sources."fuzzy.nvim"; - }; - inherit fzy-lua-native; - }; - }; + cmp-buffer.src = sources.cmp-buffer; + cmp-cmdline.src = sources.cmp-cmdline; cmp-git = { src = sources.cmp-git; + config = true; }; cmp-nvim-lsp = { src = sources.cmp-nvim-lsp; @@ -68,23 +58,7 @@ in rec { inherit lspkind; }; }; - cmp-nvim-lsp-signature-help = { - src = sources.cmp-nvim-lsp-signature-help; - }; - cmp-path = { - src = sources.cmp-path; - }; - cmp-snippy = { - src = sources.cmp-snippy; - dependencies = { - snippy = { - src = sources.nvim-snippy; - }; - }; - }; - cmp-under-comparator = { - src = sources.cmp-under-comparator; - }; + cmp-path.src = sources.cmp-path; }; }; @@ -119,6 +93,7 @@ in rec { src = sources.nvim-dap; config = ./dap.lua; dependencies = { + inherit rapidjson; dapui = { src = sources.nvim-dap-ui; }; @@ -145,7 +120,6 @@ in rec { ]; }; }; - inherit rapidjson; }; paths = with pkgs.haskellPackages; [ haskell-debug-adapter @@ -198,17 +172,6 @@ in rec { package = config.packages.luafun; }; - fzy-lua-native = let - package = pkgs.vimUtils.buildVimPlugin { - name = "fzy-lua-native"; - version = sources.fzy-lua-native.rev; - src = sources.fzy-lua-native; - }; - in { - inherit package; - cpath = "${package}/static/?.so"; - }; - gitsigns = { src = sources."gitsigns.nvim"; config = ./gitsigns.lua; @@ -552,13 +515,24 @@ in rec { }; }; - wilder = { - src = sources."wilder.nvim"; - config = ./wilder.lua; - dependencies = { - cpsm.package = pkgs.vimPlugins.cpsm; - }; - }; + # Gonna give cmp-cmdline another try lol + # wilder = { + # src = sources."wilder.nvim"; + # config = ./wilder.lua; + # dependencies = { + # cpsm.package = pkgs.vimPlugins.cpsm; + # fzy-lua-native = let + # package = pkgs.vimUtils.buildVimPlugin { + # name = "fzy-lua-native"; + # version = sources.fzy-lua-native.rev; + # src = sources.fzy-lua-native; + # }; + # in { + # inherit package; + # cpath = "${package}/static/?.so"; + # }; + # }; + # }; zen-mode = { src = sources."zen-mode.nvim"; diff --git a/plugins/telescope.lua b/plugins/telescope.lua index 4fc24f9..6fd1c9e 100644 --- a/plugins/telescope.lua +++ b/plugins/telescope.lua @@ -95,6 +95,12 @@ return function() end, { desc = "Open Anything™" }, }, + ["f"] = { + function() + require("telescope.builtin").grep_string() + end, + { desc = "Grep CWORD" }, + }, ["k"] = { function() require("telescope").extensions.docsets.find_word_under_cursor { previewer = false }