diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-04-29 17:29:21 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-04-29 17:30:08 +0300 |
| commit | ed5c4406a97b0e4a0480ef071d1d75efb22cb881 (patch) | |
| tree | f1f25728d651785cb288f544ad7544ccddad2641 /.config/nvim | |
| parent | 0e692de1352504a49b7d84c736880210f2c0365b (diff) | |
Configured nvim blink-cmp plugin, a few notes:
Added nvim-scissors to make snippets easier to configure
Added colorful-menu to make completions cooler (more like
IntelliJ/vsc*de), disabled for now until carbonight has colors for it
Removed nvim-cmp
Installed jq for formatting json snippets
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/lazy-lock.json | 48 | ||||
| -rw-r--r-- | .config/nvim/lua/cmp_helper.lua | 143 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/blink-cmp.lua | 163 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/colorful-menu.lua | 91 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/nvim-cmp.lua | 14 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/nvim-scissors.lua | 27 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/nvim-treesitter.lua | 12 | ||||
| -rw-r--r-- | .config/nvim/snippets/carbonight.nvim/lua.json | 24 | ||||
| -rw-r--r-- | .config/nvim/snippets/lua.json | 15 | ||||
| -rw-r--r-- | .config/nvim/snippets/package.json | 17 |
10 files changed, 338 insertions, 216 deletions
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 2ac357a..d04e965 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,36 +1,33 @@ { "Comment.nvim": { "branch": "fix-inline-visual-linewise-comment", "commit": "01019c2889fa6c63a80a223c55c1d28999b5c959" }, - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, "auto-save.nvim": { "branch": "main", "commit": "29f793a3a7f98129387590269ffe3ad61ab5e509" }, - "auto-session": { "branch": "main", "commit": "7a61d31770bffcf0e31a40781314699b6e66c7ab" }, + "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, "aw-watcher.nvim": { "branch": "master", "commit": "be7b03748f59b6602502baf08e7f7736cc7279a5" }, + "blink-cmp-git": { "branch": "master", "commit": "863e0670217d0dffb9edc6ab41b676a4128f813b" }, "blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" }, "buffer-vacuum": { "branch": "main", "commit": "9ec0ea4ee93bb1faa0419d6890daf9e45c436ea6" }, - "buffer_manager.nvim": { "branch": "main", "commit": "9c8c6c9d0e877920e4814f74cb24537eeac305e3" }, + "buffer_manager.nvim": { "branch": "main", "commit": "d82035f35c3a24aa5b7d13c511890bdcc8c33976" }, "ccc.nvim": { "branch": "main", "commit": "af2cf5a963f401aad868c065222ee13d4bbc9050" }, "clangd_extensions.nvim": { "branch": "main", "commit": "db28f29be928d18cbfb86fbfb9f83f584f658feb" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "code-playground.nvim": { "branch": "main", "commit": "b57abbaadc52c3d79e06c19dad0212774111a796" }, + "code-playground.nvim": { "branch": "main", "commit": "f6c4e9d08c9e3f37796f7470b436aa85fc9759a0" }, + "colorful-menu.nvim": { "branch": "master", "commit": "f80feb8a6706f965321aff24d0ed3849f02a7f77" }, "conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "gitsigns.nvim": { "branch": "main", "commit": "b79047e81f645875e500b4f433d8133bc421446c" }, + "gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" }, "gopher.nvim": { "branch": "main", "commit": "9db5931af1293ae52500921d92c02145d86df02c" }, "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, - "helpview.nvim": { "branch": "main", "commit": "493060153bc99927a64b203ea2ee49bb2884c190" }, + "helpview.nvim": { "branch": "main", "commit": "8df486915a29483c7955067a7c17bffdf3b1e5f5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "leap.nvim": { "branch": "main", "commit": "2b68ddc0802bd295e64c9e2e75f18f755e50dbcc" }, "lsp-progress.nvim": { "branch": "main", "commit": "f3df1df8f5ea33d082db047b5d2d2b83cc01cd8a" }, - "lsp_signature.nvim": { "branch": "master", "commit": "29510730fd3fe10fe0a68eaf7fe5c3d65ab56ec0" }, - "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lsp_signature.nvim": { "branch": "master", "commit": "a793d02b6a5e639fa9d3f2a89a839fa688ab2d0a" }, "lspsaga.nvim": { "branch": "main", "commit": "95201b41b19baa54eaa9a70caee31ae37791d284" }, "lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "markdown-toggle.nvim": { "branch": "main", "commit": "0b9d917c6999672279e6178f76dbfb470e872419" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "neogen": { "branch": "main", "commit": "05d754004da8c89115b291f2a23ca530a8cac8fd" }, @@ -39,31 +36,32 @@ "nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, - "nvim-dap": { "branch": "master", "commit": "98bf130702eaafad8567c0e3ea1171c2552d58bb" }, - "nvim-dap-ui": { "branch": "master", "commit": "851f6f00480dc9366f37b6b91f3aeadb3b6ba04f" }, + "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-dbee": { "branch": "master", "commit": "b4aebcabedbf0f5aa90ca391c87d6095e365ac33" }, "nvim-java": { "branch": "main", "commit": "e552f06d86752edd77aedf50b9b49e59f6de1b65" }, "nvim-java-core": { "branch": "main", "commit": "401bf7683012a25929a359deec418f36beb876e2" }, "nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" }, "nvim-java-refactor": { "branch": "main", "commit": "b51a57d862338999059e1d1717df3bc80a3a15c0" }, "nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" }, - "nvim-lint": { "branch": "master", "commit": "d698d3b6fd7b1b85657d05a2a31d843ddb682c63" }, + "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, - "nvim-lspconfig": { "branch": "master", "commit": "5af60bbb835d5b6efdc64cdff2a5b27cde4120de" }, + "nvim-lspconfig": { "branch": "master", "commit": "641e567f975feab3815b47c7d29e6148e07afa77" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-scissors": { "branch": "main", "commit": "f137284f8ad1aeb5e6d5fecf46957e3757841d05" }, "nvim-scrollbar": { "branch": "main", "commit": "6994eb9f73d5fdc36ee2c8717940e8c853e51a49" }, - "nvim-spectre": { "branch": "master", "commit": "c4abcde7b56574c2dfb7d0137b2481c5b2154372" }, + "nvim-spectre": { "branch": "master", "commit": "4497feffb18db4bab6e698bcb695228c19421282" }, "nvim-surround": { "branch": "main", "commit": "0e62500b98f4513feaaf7425c135472457ea5b7d" }, - "nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "205e3369bc83d8cb83f7409c36120e24611f8c5c" }, + "nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "855c97005c8eebcdd19846f2e54706bffd40ee96" }, - "octo.nvim": { "branch": "master", "commit": "d00dadb7286b0e1c6dd22448477ebb4277707ca9" }, + "nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" }, + "octo.nvim": { "branch": "master", "commit": "2a478f8b264a69f71bbff81b3affa2b1e1178b92" }, "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, "overseer.nvim": { "branch": "master", "commit": "72c68aab0358c92f451168b704c411c4a3e3410e" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "pretty_hover": { "branch": "master", "commit": "620aa2f9b626784efe44f515905181381d167d44" }, - "render-markdown.nvim": { "branch": "main", "commit": "642222acbab66d56727ac0f38d9432649a479ed4" }, + "pretty_hover": { "branch": "master", "commit": "be693c8f32e1b096765bfe4db2ca341cc2f409d4" }, + "render-markdown.nvim": { "branch": "main", "commit": "78ffe3b0500bbc7e37fabde723d96661538e8b32" }, "rustaceanvim": { "branch": "master", "commit": "e9c5aaba16fead831379d5f44617547a90b913c7" }, "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" }, @@ -73,9 +71,9 @@ "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, "vim-be-good": { "branch": "master", "commit": "0ae3de14eb8efc6effe7704b5e46495e91931cc5" }, - "vim-illuminate": { "branch": "master", "commit": "1fa4b23409e22a03823648e344c77f260e2572cb" }, + "vim-illuminate": { "branch": "master", "commit": "f985f5a4fbc410c9e5367f6b5863a8fa502e516d" }, "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, - "vim-tmux-navigator": { "branch": "master", "commit": "791dacfcfc8ccb7f6eb1c853050883b03e5a22fe" }, + "vim-tmux-navigator": { "branch": "master", "commit": "33afa80db65113561dc53fa732b7f5e53d5ecfd0" }, "vim-wakatime": { "branch": "master", "commit": "e46d7c4f98ee0f40782008dd60cb2a79c377fb1d" }, "vscode-codicons": { "branch": "main", "commit": "17ce4c853be20e26901867ab3442c1e353096f6d" }, "wit.nvim": { "branch": "master", "commit": "1d9e1246554711b748fb1c8708f4b4a1631ffbad" } diff --git a/.config/nvim/lua/cmp_helper.lua b/.config/nvim/lua/cmp_helper.lua deleted file mode 100644 index ffa3418..0000000 --- a/.config/nvim/lua/cmp_helper.lua +++ /dev/null @@ -1,143 +0,0 @@ --- Load cmp_opts -for _, ft_path in ipairs(vim.api.nvim_get_runtime_file('lua/snippets/*.lua', true)) do - loadfile(ft_path)() -end - -local luasnip = require('luasnip') -local lspkind = require('lspkind') -local cmp = require('cmp') - --- Enable paretheses for function completions -cmp.event:on('confirm_done', require('nvim-autopairs.completion.cmp').on_confirm_done()) - --- Helper functions -local function snippet_jump(jump_amount) - return cmp.mapping(function(fallback) - if luasnip.locally_jumpable(jump_amount) then - luasnip.jump(jump_amount) - else - fallback() - end - end, { 'i', 's' }) -end - -local function is_enabled() - local context = require('cmp.config.context') - - local is_in_comment = context.in_treesitter_capture('comment') or context.in_syntax_group('Comment') - if is_in_comment then - return false - end - - return true -end - -cmp.setup({ - enabled = is_enabled, - preselect = cmp.PreselectMode.None, - completion = { completeopt = 'menu,menuone,noinsert' }, - sources = cmp.config.sources({ - { name = 'luasnip' }, -- for snippets - { - name = 'nvim_lsp', - option = { - markdown_oxide = { - keyword_pattern = [[\(\k\| \|\/\|#\)\+]], - }, - }, - }, -- for lsp - { name = 'lazydev', group_index = 0 }, -- for lazydev.nvim - { name = 'path' }, -- for filesystem - }, {}), - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - window = { - documentation = cmp.config.window.bordered(), - completion = { - border = 'rounded', - winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,Search:None', - col_offset = -3, - side_padding = 0, - }, - }, - ---@diagnostic disable-next-line: missing-fields - sorting = { - comparators = { - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.recently_used, - require('clangd_extensions.cmp_scores'), - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order, - }, - }, - mapping = { - ['<Tab>'] = snippet_jump(1), - ['<S-Tab>'] = snippet_jump(-1), - ['<C-Space>'] = cmp.mapping.complete(), -- invoke completion - ['<CR>'] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Insert }), - ['<C-u>'] = cmp.mapping.scroll_docs(-4), - ['<C-d>'] = cmp.mapping.scroll_docs(4), - ['<C-c>'] = cmp.mapping.abort(), - ['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - ['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - }, - ---@diagnostic disable-next-line: missing-fields - formatting = { - fields = { 'kind', 'abbr', 'menu' }, - format = function(entry, vim_item) - local kind = lspkind.cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item) - local strings = vim.split(kind.kind, '%s', { trimempty = true }) - kind.kind = ' ' .. (strings[1] or '') .. ' ' -- left (icon) - kind.menu = ' ' .. (strings[2] or '') .. '' -- right (text) - return kind - end, - }, -}) - --- -- Customization for Pmenu --- vim.api.nvim_set_hl(0, 'PmenuSel', { bg = '#282C34', fg = 'NONE' }) --- vim.api.nvim_set_hl(0, 'Pmenu', { fg = '#C5CDD9', bg = '#22252A' }) --- -vim.api.nvim_set_hl(0, 'CmpItemAbbrDeprecated', { fg = '#ff8294', bg = 'NONE', strikethrough = true }) --- vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { fg = '#82AAFF', bg = 'NONE', bold = true }) --- vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { fg = '#82AAFF', bg = 'NONE', bold = true }) --- vim.api.nvim_set_hl(0, 'CmpItemMenu', { fg = '#C792EA', bg = 'NONE', italic = true }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindField', { fg = '#EED8DA', bg = '#B5585F' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindProperty', { fg = '#EED8DA', bg = '#B5585F' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindEvent', { fg = '#EED8DA', bg = '#B5585F' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindText', { fg = '#C3E88D', bg = '#9FBD73' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindEnum', { fg = '#C3E88D', bg = '#9FBD73' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindKeyword', { fg = '#C3E88D', bg = '#9FBD73' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindConstant', { fg = '#FFE082', bg = '#D4BB6C' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindConstructor', { fg = '#FFE082', bg = '#D4BB6C' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindReference', { fg = '#FFE082', bg = '#D4BB6C' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindFunction', { fg = '#EADFF0', bg = '#A377BF' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindStruct', { fg = '#EADFF0', bg = '#A377BF' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindClass', { fg = '#EADFF0', bg = '#A377BF' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindModule', { fg = '#EADFF0', bg = '#A377BF' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindOperator', { fg = '#EADFF0', bg = '#A377BF' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindVariable', { fg = '#C5CDD9', bg = '#7E8294' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindFile', { fg = '#C5CDD9', bg = '#7E8294' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindUnit', { fg = '#F5EBD9', bg = '#D4A959' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindSnippet', { fg = '#F5EBD9', bg = '#D4A959' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindFolder', { fg = '#F5EBD9', bg = '#D4A959' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindMethod', { fg = '#DDE5F5', bg = '#6C8ED4' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindValue', { fg = '#DDE5F5', bg = '#6C8ED4' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindEnumMember', { fg = '#DDE5F5', bg = '#6C8ED4' }) --- --- vim.api.nvim_set_hl(0, 'CmpItemKindInterface', { fg = '#D8EEEB', bg = '#58B5A8' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindColor', { fg = '#D8EEEB', bg = '#58B5A8' }) --- vim.api.nvim_set_hl(0, 'CmpItemKindTypeParameter', { fg = '#D8EEEB', bg = '#58B5A8' }) diff --git a/.config/nvim/lua/plugins/blink-cmp.lua b/.config/nvim/lua/plugins/blink-cmp.lua index 51d910b..85f93c9 100644 --- a/.config/nvim/lua/plugins/blink-cmp.lua +++ b/.config/nvim/lua/plugins/blink-cmp.lua @@ -1,44 +1,151 @@ return { 'saghen/blink.cmp', + event = 'InsertEnter', version = '1.*', + dependencies = { + { + 'Kaiser-Yang/blink-cmp-git', + dependencies = { 'nvim-lua/plenary.nvim' }, + }, + }, ---@module 'blink.cmp' ---@type blink.cmp.Config opts = { - -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) - -- 'super-tab' for mappings similar to vscode (tab to accept) - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- All presets have the following mappings: - -- C-space: Open menu or open docs if already open - -- C-n/C-p or Up/Down: Select next/previous item - -- C-e: Hide menu - -- C-k: Toggle signature help (if signature.enabled = true) - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = 'default' }, + keymap = { + preset = 'enter', + ['<C-e>'] = {}, + ['<C-c>'] = { 'hide', 'fallback' }, - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', + ['<C-b>'] = {}, + ['<C-f>'] = {}, + ['<C-u>'] = { 'scroll_documentation_up', 'fallback' }, + ['<C-d>'] = { 'scroll_documentation_down', 'fallback' }, }, - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, + completion = { + -- Show documentation when selecting a completion item + documentation = { + auto_show = true, -- TODO: turn this to off? once carbonight is ready + auto_show_delay_ms = 0, + window = { border = 'single' }, + }, - -- Default list of enabled providers defined so that you can extend it - -- elsewhere in your config, without redefining it, due to `opts_extend` - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, + keyword = { range = 'full' }, + -- Full seems cool but might be annoying + -- TODO: after a while, did I like this? + -- If so keep, otherwise switch to prefix + + -- Preselect first one, don't complete until confirmation + list = { selection = { preselect = true, auto_insert = false } }, + + menu = { + draw = { + -- TODO: really cool but ugly AF now + -- need to add support for this in carbonight first + -- We don't need label_description now because label and label_description are already + -- combined together in label by colorful-menu.nvim. + -- columns = { { 'kind_icon' }, { 'label', gap = 1 } }, + -- components = { + -- label = { + -- text = function(ctx) + -- return require('colorful-menu').blink_components_text(ctx) + -- end, + -- highlight = function(ctx) + -- return require('colorful-menu').blink_components_highlight(ctx) + -- end, + -- }, + -- }, + }, + }, }, - -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance - -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, - -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` - -- - -- See the fuzzy documentation for more information + -- TODO: configure this when I get to fixing the LSP signature thing + signature = {}, + fuzzy = { implementation = 'prefer_rust_with_warning' }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev', 'git' }, + + providers = { + lazydev = { + name = 'LazyDev', + module = 'lazydev.integrations.blink', + score_offset = 100, -- prioritize lazydev + }, + git = { + module = 'blink-cmp-git', + name = 'Git', + opts = {}, + }, + + snippets = { + score_offset = 200, -- make snippets highest priority + transform_items = function(_, items) + return vim.tbl_filter(function(item) + if item.kind ~= require('blink.cmp.types').CompletionItemKind.Snippet then + return true + end + + local name = item.description + -- vim.print(name) + local parts = vim.split(name, ' ', { trimempty = false }) + local namespace = #parts > 1 and parts[1] or nil + -- vim.print(namespace) + if not namespace then + return true + end + + -- vim.print(vim.fn.getcwd()) + local path = vim.split(vim.fn.getcwd(), '/') + local dir = path[#path] + -- vim.print(dir) + + return dir == namespace + end, items) + end, + }, + }, + }, + + appearance = { + -- TODO: change icons to make more sense to me + kind_icons = { + Text = '', -- + Method = '', + Function = '', + Constructor = '', + + Field = '', + Variable = '', + Property = '', + + Class = '', + Interface = '', + Struct = '', + Module = '', + + Unit = '', + Value = '', + Enum = '', + EnumMember = '', + + Keyword = '', + Constant = '', + + Snippet = '', + Color = '', + File = '', + Reference = '', + Folder = '', + Event = '', + Operator = '', + TypeParameter = '', + }, + }, }, opts_extend = { 'sources.default' }, + + -- TODO: pressing backk (deleting), should re-show completion menu + -- TODO: ghost text only for LLMs? } diff --git a/.config/nvim/lua/plugins/colorful-menu.lua b/.config/nvim/lua/plugins/colorful-menu.lua new file mode 100644 index 0000000..71ef6b9 --- /dev/null +++ b/.config/nvim/lua/plugins/colorful-menu.lua @@ -0,0 +1,91 @@ +return { + "xzbdmw/colorful-menu.nvim", + config = function() + -- You don't need to set these options. + require("colorful-menu").setup({ + ls = { + lua_ls = { + -- Maybe you want to dim arguments a bit. + arguments_hl = "@comment", + }, + gopls = { + -- By default, we render variable/function's type in the right most side, + -- to make them not to crowd together with the original label. + + -- when true: + -- foo *Foo + -- ast "go/ast" + + -- when false: + -- foo *Foo + -- ast "go/ast" + align_type_to_right = true, + -- When true, label for field and variable will format like "foo: Foo" + -- instead of go's original syntax "foo Foo". If align_type_to_right is + -- true, this option has no effect. + add_colon_before_type = false, + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + -- for lsp_config or typescript-tools + ts_ls = { + -- false means do not include any extra info, + -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + extra_info_hl = "@comment", + }, + vtsls = { + -- false means do not include any extra info, + -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + extra_info_hl = "@comment", + }, + ["rust-analyzer"] = { + -- Such as (as Iterator), (use std::io). + extra_info_hl = "@comment", + -- Similar to the same setting of gopls. + align_type_to_right = true, + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + clangd = { + -- Such as "From <stdio.h>". + extra_info_hl = "@comment", + -- Similar to the same setting of gopls. + align_type_to_right = true, + -- the hl group of leading dot of "•std::filesystem::permissions(..)" + import_dot_hl = "@comment", + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + zls = { + -- Similar to the same setting of gopls. + align_type_to_right = true, + }, + roslyn = { + extra_info_hl = "@comment", + }, + dartls = { + extra_info_hl = "@comment", + }, + -- The same applies to pyright/pylance + basedpyright = { + -- It is usually import path such as "os" + extra_info_hl = "@comment", + }, + -- If true, try to highlight "not supported" languages. + fallback = true, + -- this will be applied to label description for unsupport languages + fallback_extra_info_hl = "@comment", + }, + -- If the built-in logic fails to find a suitable highlight group for a label, + -- this highlight is applied to the label. + fallback_highlight = "@variable", + -- If provided, the plugin truncates the final displayed text to + -- this width (measured in display cells). Any highlights that extend + -- beyond the truncation point are ignored. When set to a float + -- between 0 and 1, it'll be treated as percentage of the width of + -- the window: math.floor(max_width * vim.api.nvim_win_get_width(0)) + -- Default 60. + max_width = 60, + }) + end, +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 16b3612..0000000 --- a/.config/nvim/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - -- 'hrsh7th/nvim-cmp', - -- event = 'InsertEnter', - -- dependencies = { - -- 'onsails/lspkind.nvim', -- icons for completion type - -- 'hrsh7th/cmp-path', -- complete filepaths - -- 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp - -- 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp - -- { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin - -- }, - -- config = function() - -- require('cmp_helper') - -- end, -} diff --git a/.config/nvim/lua/plugins/nvim-scissors.lua b/.config/nvim/lua/plugins/nvim-scissors.lua new file mode 100644 index 0000000..8eb3b8b --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-scissors.lua @@ -0,0 +1,27 @@ +return { + 'chrisgrieser/nvim-scissors', + dependencies = 'folke/snacks.nvim', + event = 'VeryLazy', + opts = { + ---@type "yq"|"jq"|"none"|string[] + jsonFormatter = 'jq', + }, + keys = { + { + '<leader>sa', + function() + require('scissors').addNewSnippet() + end, + desc = '[S]nippet [A]dd', + mode = { 'n', 'x' }, + }, + { + '<leader>se', + function() + require('scissors').editSnippet() + end, + desc = '[S]nippet [E]dit', + mode = { 'n', 'x' }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua index 7313054..7ee6a47 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -59,12 +59,12 @@ return { }, swap = { enable = true, - swap_next = { - ['<leader>sa'] = { query = '@parameter.inner', desc = 'Swap Argument (next)' }, - }, - swap_previous = { - ['<leader>sA'] = { query = '@parameter.inner', desc = 'Swap Argument (prev)' }, - }, + -- swap_next = { + -- ['<leader>sa'] = { query = '@parameter.inner', desc = 'Swap Argument (next)' }, + -- }, + -- swap_previous = { + -- ['<leader>sA'] = { query = '@parameter.inner', desc = 'Swap Argument (prev)' }, + -- }, }, }, }) diff --git a/.config/nvim/snippets/carbonight.nvim/lua.json b/.config/nvim/snippets/carbonight.nvim/lua.json new file mode 100644 index 0000000..5697fd2 --- /dev/null +++ b/.config/nvim/snippets/carbonight.nvim/lua.json @@ -0,0 +1,24 @@ +{ + "carbonight.nvim group": { + "body": [ + "--[[", + "Copyright (C) 2024-2025 Kyren223", + "This file is licensed under the GPL-3.0-or-later license, see https://fsf.org/licenses/gpl-3.0", + "--]]", + "", + "local utils = require(\"carbonight.utils\")", + "", + "local M = {}", + "", + "---@param c Colors", + "function M.get(c)", + " return {", + " ${1:}", + " }", + "end", + "", + "return M" + ], + "prefix": "group" + } +} diff --git a/.config/nvim/snippets/lua.json b/.config/nvim/snippets/lua.json new file mode 100644 index 0000000..ca94955 --- /dev/null +++ b/.config/nvim/snippets/lua.json @@ -0,0 +1,15 @@ +{ + "hmmm": { + "body": [ + "for ${1:} in ipairs(${2:}, ${3:}) do", + " ${4:}", + "end", + "", + "What about inside: ${5:${6:${7:}}}", + "", + "$0", + "^ END" + ], + "prefix": "hmmm" + } +} diff --git a/.config/nvim/snippets/package.json b/.config/nvim/snippets/package.json new file mode 100644 index 0000000..69cd58e --- /dev/null +++ b/.config/nvim/snippets/package.json @@ -0,0 +1,17 @@ +{ + "name": "personal-snippets", + "contributes": { + "snippets": [ + { + "path": "./lua.json", + "language": [ + "lua" + ] + }, + { + "language": "lua", + "path": "./carbonight.nvim/lua.json" + } + ] + } +} |
