diff --git a/lazy-lock.json b/lazy-lock.json index 6a97cf511..435b59775 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,16 +1,16 @@ { "Comment.nvim": { "branch": "master", "commit": "e1fe53117aab24c378d5e6deaad786789c360123" }, - "LuaSnip": { "branch": "master", "commit": "ec7fba1d119fb5090a901eb616145450ffb95e31" }, + "LuaSnip": { "branch": "master", "commit": "a83e4b1ba7edc6fecdad09e39753a7d5eee1d01c" }, "accelerated-jk.nvim": { "branch": "main", "commit": "8fb5dad4ccc1811766cebf16b544038aeeb7806f" }, "alpha-nvim": { "branch": "main", "commit": "1838ae926e8d49fe5330d1498ee8289ae2c340bc" }, "ascii.nvim": { "branch": "master", "commit": "f4d165c7384aade71d828fb08502d8ceda7dca89" }, - "auto-session": { "branch": "main", "commit": "8a7dbcd718086877c7d75d6f36615b34674cad4b" }, - "autoclose.nvim": { "branch": "main", "commit": "c4db42ffc0edbd244502be951c142df0c8a7e582" }, + "auto-session": { "branch": "main", "commit": "e3234c489397b46a2b7949d6169d61b69a30c015" }, + "autoclose.nvim": { "branch": "main", "commit": "2321727fd10a6b34624723bc4747d8c09c10b7a4" }, "ayu": { "branch": "master", "commit": "762ff24bd429fbb1c1e20b13043b4c8f0266bcf1" }, "better-escape.nvim": { "branch": "master", "commit": "7031dc734add47bb71c010e0551829fa5799375f" }, "bigfile.nvim": { "branch": "main", "commit": "a34e42616c20bfd52943ed5d6632bb28d22b057e" }, - "bufferline.nvim": { "branch": "main", "commit": "1952c33e425ede785d26aa9e250addfe304a8510" }, - "catppuccin": { "branch": "main", "commit": "8338b02e9a8ffcb999520de7f15943712618760f" }, + "bufferline.nvim": { "branch": "main", "commit": "32d74d5d044f7cc89892d4781a83d55ee4ed552a" }, + "catppuccin": { "branch": "refactor/syntax-highlighting", "commit": "c0f7432052a837c6295a7770e39fdc07ede3305c" }, "clever-f.vim": { "branch": "master", "commit": "6a3ac5e3688598af9411ab741737f98c47370c22" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" }, @@ -19,62 +19,64 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, "cmp-tmux": { "branch": "main", "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" }, - "cmp-treesitter": { "branch": "master", "commit": "389eadd48c27aa6dc0e6b992644704f026802a2e" }, + "cmp-treesitter": { "branch": "master", "commit": "c8e3a74b51597d69d240085a258636972ce98e15" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "copilot-cmp": { "branch": "master", "commit": "c2cdb3c0f5078b0619055af192295830a7987790" }, - "copilot.lua": { "branch": "master", "commit": "653bbdc44cd569a5fd0617e5a9d3df2b1359e230" }, - "copilot.vim": { "branch": "release", "commit": "1358e8e45ecedc53daf971924a0541ddf6224faf" }, + "copilot.lua": { "branch": "master", "commit": "77e3a4907928f0813024e573b882dc879dfc0c6b" }, "crates.nvim": { "branch": "main", "commit": "3648f8787656d7572740560331553abdaa8cb982" }, "csv.vim": { "branch": "master", "commit": "15ff93edf5b26c466affbb356e0696b7d6a3b499" }, - "diffview.nvim": { "branch": "main", "commit": "15861892ce62d8f4ab6e72bc4ff5b829f994430a" }, + "diffview.nvim": { "branch": "main", "commit": "bff58a6ea3e081ca50049700f9848b2f84ea57be" }, "edge": { "branch": "master", "commit": "358cb6688ac577470a4eafcb53bdd63899dfc937" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "1d0dac346de7c6895ac72528df3276386c6b149b" }, + "friendly-snippets": { "branch": "main", "commit": "8875cccf779160303bf2bed7d422717676f214fd" }, "fzy-lua-native": { "branch": "master", "commit": "45148b3f70d244e8b8b5db60df447a2b7ac2de9d" }, - "gitsigns.nvim": { "branch": "main", "commit": "c18b7ca0b5b50596722f3a1572eb9b8eb520c0f1" }, - "go.nvim": { "branch": "master", "commit": "b119217e8324f13a2be12935f5d2d15a1df09b09" }, + "gitsigns.nvim": { "branch": "main", "commit": "f868d82a36f7f7f5e110eb0a9659993984f59875" }, + "go.nvim": { "branch": "master", "commit": "9fc0312c1ae08c24ca730c6f7f836965be5c1922" }, "guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" }, "hop.nvim": { "branch": "v2", "commit": "90db1b2c61b820e230599a04fedcd2679e64bd07" }, - "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, - "kanagawa": { "branch": "master", "commit": "42c33239b0460cbbcdb67bc9c7f0c420a95208e6" }, - "lazy.nvim": { "branch": "main", "commit": "91564cb0a6d038d7e0eeaf68d505ed2627de625b" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7075d7861f7a6bbf0de0298c83f8a13195e6ec01" }, + "kanagawa": { "branch": "master", "commit": "14a7524a8b259296713d4d77ef3c7f4dec501269" }, + "lazy.nvim": { "branch": "main", "commit": "e6bf3a0d9c4899dcf832270f79bb1cee8fbc506e" }, "lsp_signature.nvim": { "branch": "master", "commit": "7a26ebaa7e36aa2aefa6c1994b2b866c96de32e6" }, - "lspsaga.nvim": { "branch": "main", "commit": "01b9633aefd010f272d6c7e3d8293c44fcfe7696" }, + "lspsaga.nvim": { "branch": "main", "commit": "c4e6259dda346babc71970bd00e03e211b44614d" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c55d18f3947562e699d34d89681edbf9f0e250d3" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "f0ce33f4794a2364eb08d09d09380e8b04ec5e6a" }, "mason-null-ls.nvim": { "branch": "main", "commit": "54d702020bf94e4eefd357f0b738317af30217eb" }, - "mason.nvim": { "branch": "main", "commit": "08b2fd308e0107eab9f0b59d570b69089fd0b522" }, + "mason.nvim": { "branch": "main", "commit": "7d7efc738e08fc5bee822857db45cb6103f0b0c1" }, + "navigator.lua": { "branch": "master", "commit": "b9931d5c01c323a8c5dd619a6bb9aebb3aa88b56" }, "neodim": { "branch": "master", "commit": "89c16fccccfdb5b7e6ad3a6e8286736debc11705" }, "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, "nightfox": { "branch": "main", "commit": "77aa7458d2b725c2d9ff55a18befe1b891ac473e" }, "nord.nvim": { "branch": "master", "commit": "fab04b2dd4b64f4b1763b9250a8824d0b5194b8f" }, "nordic.nvim": { "branch": "main", "commit": "bd4cf4e4ca8b6a8b63e2e6e38d2112a59be45494" }, - "nui.nvim": { "branch": "main", "commit": "698e75814cd7c56b0dd8af4936bcef2d13807f3c" }, - "null-ls.nvim": { "branch": "main", "commit": "77e53bc3bac34cc273be8ed9eb9ab78bcf67fa48" }, + "nui.nvim": { "branch": "main", "commit": "2b2732528e4a79eb8542568bd51d25f710395bd6" }, + "null-ls.nvim": { "branch": "main", "commit": "c89333e034a8daba654ebfcf9a4ec9f87765f01e" }, "nvim-bufdel": { "branch": "main", "commit": "96c4f7ab053ddab0025bebe5f7c71e4795430e47" }, - "nvim-cmp": { "branch": "main", "commit": "3ac8d6cd29c74ff482d8ea47d45e5081bfc3f5ad" }, + "nvim-cmp": { "branch": "main", "commit": "fc0f694af1a742ada77e5b1c91ff405c746f4a26" }, "nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" }, "nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" }, - "nvim-dap-ui": { "branch": "master", "commit": "4ce7b97dd8f50b4f672948a34bf8f3a56214fdb8" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "ab988dbb7d20cdaebf9b3ef7554a89f6895de042" }, - "nvim-jdtls": { "branch": "master", "commit": "355de7458fd63ccef9c6485d952ea118ba2cb46a" }, - "nvim-lspconfig": { "branch": "master", "commit": "6f1d124bbcf03c4c410c093143a86415f46d16a0" }, + "nvim-dap-ui": { "branch": "master", "commit": "c020f660b02772f9f3d11f599fefad3268628a9e" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, + "nvim-jdtls": { "branch": "master", "commit": "365811ecf97a08d0e2055fba210d65017344fd15" }, + "nvim-lspconfig": { "branch": "master", "commit": "9166622781a39a829878d1fd24c174529d996838" }, + "nvim-metals": { "branch": "main", "commit": "51cd9fabe8ba7ff9abafd0c1ec4292f3a2eb1a31" }, "nvim-notify": { "branch": "master", "commit": "f3024b912073774111202f5fa6518b0cd2a74432" }, "nvim-scrollview": { "branch": "main", "commit": "4a04039b80c270f6bd2075935cd3c7943f6ad140" }, - "nvim-tree.lua": { "branch": "master", "commit": "736c7ff59065275f0483af4b7f07a9bc41449ad0" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "543f090a45cef28156162883d2412fffecb6b750" }, + "nvim-tree.lua": { "branch": "master", "commit": "e2a4c9d09d205ebe5f071264f43f73a0077c43a3" }, "nvim-treehopper": { "branch": "master", "commit": "5a28bff46c05d28bdb4bcaef67e046eb915a9390" }, - "nvim-treesitter": { "branch": "master", "commit": "dad1b7cd6606ffaa5c283ba73d707b4741a5f445" }, - "nvim-treesitter-context": { "branch": "master", "commit": "c8f3a62c64bf6f9fed11260a424207f780505f83" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "35a60f093fa15a303874975f963428a5cd24e4a0" }, + "nvim-treesitter": { "branch": "master", "commit": "23dfae4db84f71e2ddb56c024845b322035182ee" }, + "nvim-treesitter-context": { "branch": "master", "commit": "24535437a9b62b9ec503c545f35e2ac298cd29df" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "95b76b95eff25e1e64f363938cd853852355d70a" }, "nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" }, - "nvim-ts-rainbow": { "branch": "master", "commit": "840039440e012ad798ef31349b93a5d4365023ff" }, - "nvim-web-devicons": { "branch": "master", "commit": "986875b7364095d6535e28bd4aac3a9357e91bbe" }, + "nvim-ts-rainbow": { "branch": "master", "commit": "85279555783702b4bed6518e4494ec96d1ae1dfe" }, + "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, "paint.nvim": { "branch": "main", "commit": "6ce64212804f425073c61ab0d9c2b034f0435260" }, "papercolor": { "branch": "master", "commit": "9051480ad9129ff4ab4fffb38b44779b9081626f" }, - "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, + "plenary.nvim": { "branch": "master", "commit": "52544825d6b8be677eb395983515ad5e30ae1f2e" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, "smartyank.nvim": { "branch": "master", "commit": "7e3905578f646503525b2f7018b8afd17861018c" }, @@ -86,20 +88,20 @@ "sweetie": { "branch": "master", "commit": "4d938ccce2bcc4fb9846c06cd309b0a0488836b7" }, "tabout.nvim": { "branch": "master", "commit": "0d275c8d25f32457e67b5c66d6ae43f26a61bce5" }, "telescope-frecency.nvim": { "branch": "master", "commit": "0a4a521471141ae3c94ff0ebcffcaff3c3aad147" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, "telescope-live-grep-args.nvim": { "branch": "master", "commit": "0f75ea809c46af8997c64f49c52e3c641d887885" }, "telescope-undo.nvim": { "branch": "main", "commit": "231b5ebb4328d2768c830c9a8d1b9c696116848d" }, "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, - "telescope.nvim": { "branch": "master", "commit": "40c31fdde93bcd85aeb3447bb3e2a3208395a868" }, - "toggleterm.nvim": { "branch": "main", "commit": "26f16d3bab1761d0d11117a8e431faba11a1b865" }, - "tokyonight": { "branch": "main", "commit": "df13e3268a44f142999fa166572fe95a650a0b37" }, - "trouble.nvim": { "branch": "main", "commit": "2173dffe91fc0914b3b833c6a2f6fe1d3fac2e17" }, + "telescope.nvim": { "branch": "master", "commit": "6d3fbffe426794296a77bb0b37b6ae0f4f14f807" }, + "toggleterm.nvim": { "branch": "main", "commit": "cf146a267a6a7db62b1e2aff40414b20081048a1" }, + "tokyonight": { "branch": "main", "commit": "161114bd39b990995e08dbf941f6821afbdcd666" }, + "trouble.nvim": { "branch": "main", "commit": "324c977cfeacb8498ca9ba1c74cc35bd18858a8d" }, "vim-cool": { "branch": "master", "commit": "80536b9f2e23292708a64f2e7bcf5e596f9faf24" }, "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, "vim-fugitive": { "branch": "master", "commit": "5f0d280b517cacb16f59316659966c7ca5e2bea2" }, "vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" }, "vim-jsonnet": { "branch": "master", "commit": "4ebc6619ddce5d032a985b42a9864154c3d20e4a" }, - "vim-matchup": { "branch": "master", "commit": "b8eca3b588e41e0bb1b3ae200fae88183b91a76d" }, - "which-key.nvim": { "branch": "main", "commit": "5a6c954a5a46023c19acc03a8b6d7c3e57964fc5" }, + "vim-matchup": { "branch": "master", "commit": "02b906cf772811a6845f2d5caaa81152beb65d6b" }, + "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } \ No newline at end of file diff --git a/lua/modules/configs/completion/cmp.lua b/lua/modules/configs/completion/cmp.lua index 6c2cc7d12..867473174 100644 --- a/lua/modules/configs/completion/cmp.lua +++ b/lua/modules/configs/completion/cmp.lua @@ -10,13 +10,13 @@ return function() local border = function(hl) return { - { "╭", hl }, + { "┌", hl }, { "─", hl }, - { "╮", hl }, + { "┐", hl }, { "│", hl }, - { "╯", hl }, + { "┘", hl }, { "─", hl }, - { "╰", hl }, + { "└", hl }, { "│", hl }, } end @@ -32,149 +32,134 @@ return function() return (diff < 0) end - local function cmp_format(opts) - opts = opts or {} + local cmp = require("cmp") + cmp.setup({ + preselect = cmp.PreselectMode.Item, + window = { + completion = { + border = border("PmenuBorder"), + winhighlight = "Normal:Pmenu,CursorLine:PmenuSel,Search:PmenuSel", + scrollbar = false, + }, + documentation = { + border = border("CmpDocBorder"), + winhighlight = "Normal:CmpDoc", + }, + }, + sorting = { + priority_weight = 2, + comparators = { + require("copilot_cmp.comparators").prioritize, + require("copilot_cmp.comparators").score, + -- require("cmp_tabnine.compare"), + compare.offset, -- Items closer to cursor will have lower priority + compare.exact, + -- compare.scopes, + compare.lsp_scores, + compare.sort_text, + compare.score, + compare.recently_used, + -- compare.locality, -- Items closer to cursor will have higher priority, conflicts with `offset` + require("cmp-under-comparator").under, + compare.kind, + compare.length, + compare.order, + }, + }, + formatting = { + fields = { "abbr", "kind", "menu" }, + format = function(entry, vim_item) + local lspkind_icons = vim.tbl_deep_extend("force", icons.kind, icons.type, icons.cmp) + -- load lspkind icons + vim_item.kind = + string.format(" %s %s", lspkind_icons[vim_item.kind] or icons.cmp.undefined, vim_item.kind or "") - return function(entry, vim_item) - if opts.before then - vim_item = opts.before(entry, vim_item) - end + vim_item.menu = setmetatable({ + cmp_tabnine = "[TN]", + copilot = "[CPLT]", + buffer = "[BUF]", + orgmode = "[ORG]", + nvim_lsp = "[LSP]", + nvim_lua = "[LUA]", + path = "[PATH]", + tmux = "[TMUX]", + treesitter = "[TS]", + luasnip = "[SNIP]", + spell = "[SPELL]", + }, { + __index = function() + return "[BTN]" -- builtin/unknown source names + end, + })[entry.source.name] - local kind_symbol = opts.symbol_map[vim_item.kind] or icons.kind.Undefined - local source_symbol = opts.symbol_map[entry.source.name] or icons.cmp.undefined - - vim_item.menu = " " .. source_symbol .. " |" - vim_item.kind = string.format(" 〔 %s %s 〕", kind_symbol, vim_item.kind) + local label = vim_item.abbr + local truncated_label = vim.fn.strcharpart(label, 0, 80) + if truncated_label ~= label then + vim_item.abbr = truncated_label .. "..." + end - if opts.maxwidth ~= nil then - if opts.ellipsis_char == nil then - vim_item.abbr = string.sub(vim_item.abbr, 1, opts.maxwidth) + return vim_item + end, + }, + matching = { + disallow_partial_fuzzy_matching = false, + }, + performance = { + async_budget = 1, + max_view_entries = 300, + }, + -- You can set mappings if you want + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace }), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.close(), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_locally_jumpable() then + vim.fn.feedkeys(t("luasnip-expand-or-jump")) else - local label = vim_item.abbr - local truncated_label = vim.fn.strcharpart(label, 0, opts.maxwidth) - if truncated_label ~= label then - vim_item.abbr = truncated_label .. opts.ellipsis_char - end + fallback() end - end - return vim_item - end - end - - local cmp = require("cmp") - cmp.setup({ - preselect = cmp.PreselectMode.Item, - window = { - completion = { - border = border("Normal"), - max_width = 80, - max_height = 20, - scrollbar = false, - }, - documentation = { - border = border("CmpDocBorder"), - }, - }, - sorting = { - priority_weight = 2, - comparators = { - require("copilot_cmp.comparators").prioritize, - require("copilot_cmp.comparators").score, - -- require("cmp_tabnine.compare"), - compare.offset, -- Items closer to cursor will have lower priority - compare.exact, - -- compare.scopes, - compare.lsp_scores, - compare.sort_text, - compare.score, - compare.recently_used, - -- compare.locality, -- Items closer to cursor will have higher priority, conflicts with `offset` - require("cmp-under-comparator").under, - compare.kind, - compare.length, - compare.order, - }, - }, - formatting = { - fields = { "menu", "abbr", "kind" }, - format = function(entry, vim_item) - local kind_map = vim.tbl_deep_extend("force", icons.kind, icons.type, icons.cmp) - local kind = cmp_format({ - maxwidth = 50, - symbol_map = kind_map, - })(entry, vim_item) - return kind - end, - }, - matching = { - disallow_partial_fuzzy_matching = false, - }, - performance = { - async_budget = 1, - max_view_entries = 300, - }, - -- You can set mappings if you want - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.confirm({ select = true, behavior = cmp.ConfirmBehavior.Replace }), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.close(), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_locally_jumpable() then - vim.fn.feedkeys(t("luasnip-expand-or-jump")) - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - vim.fn.feedkeys(t("luasnip-jump-prev"), "") - else - fallback() - end - end, { "i", "s" }), - }), - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - -- You should specify your *installed* sources. - sources = { - { name = "nvim_lsp" }, - { name = "nvim_lua" }, - { name = "luasnip" }, - { name = "path" }, - { - name = "treesitter", - entry_filter = function(entry) - local ignore_list = { - "Error", - "Comment", - } - local kind = entry:get_completion_item().cmp.kind_text - return not vim.tbl_contains(ignore_list, kind) - end, - }, - { name = "spell" }, - { name = "tmux" }, - { name = "orgmode" }, - { name = "buffer" }, - { name = "latex_symbols" }, - { name = "copilot" }, - -- { name = "codeium" }, - -- { name = "cmp_tabnine" }, - }, - experimental = { - ghost_text = { - hl_group = "Whitespace", - }, - }, - }) + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(t("luasnip-jump-prev"), "") + else + fallback() + end + end, { "i", "s" }), + }), + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + -- You should specify your *installed* sources. + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "luasnip" }, + { name = "path" }, + { name = "treesitter" }, + { name = "spell" }, + { name = "tmux" }, + { name = "orgmode" }, + { name = "buffer" }, + { name = "latex_symbols" }, + { name = "copilot" }, + -- { name = "codeium" }, + -- { name = "cmp_tabnine" }, + }, + experimental = { + ghost_text = { + hl_group = "Whitespace", + }, + }, + }) end diff --git a/lua/modules/configs/completion/lsp.lua b/lua/modules/configs/completion/lsp.lua index 226b78dbc..2d92f8460 100644 --- a/lua/modules/configs/completion/lsp.lua +++ b/lua/modules/configs/completion/lsp.lua @@ -3,7 +3,7 @@ return function() local mason = require("mason") local mason_lspconfig = require("mason-lspconfig") - require("lspconfig.ui.windows").default_options.border = "single" + require("lspconfig.ui.windows").default_options.border = "rounded" local icons = { ui = require("modules.utils.icons").get("ui", true), diff --git a/lua/modules/configs/completion/servers/clangd.lua b/lua/modules/configs/completion/servers/clangd.lua index 5f90a7320..4d0b4a5bc 100644 --- a/lua/modules/configs/completion/servers/clangd.lua +++ b/lua/modules/configs/completion/servers/clangd.lua @@ -49,45 +49,45 @@ end -- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua return function(options) - require("lspconfig").clangd.setup({ - on_attach = options.on_attach, - capabilities = vim.tbl_deep_extend("keep", { offsetEncoding = { "utf-16", "utf-8" } }, options.capabilities), - single_file_support = true, - cmd = { - "clangd", - "-j=12", - "--enable-config", - "--background-index", - "--pch-storage=memory", - -- You MUST set this arg ↓ to your c/cpp compiler location (if not included)! - "--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }), - "--clang-tidy", - "--all-scopes-completion", - "--completion-style=detailed", - "--header-insertion-decorators", - "--header-insertion=iwyu", - "--limit-references=3000", - "--limit-results=350", - }, - commands = { - ClangdSwitchSourceHeader = { - function() - switch_source_header_splitcmd(0, "edit") - end, - description = "Open source/header in current buffer", - }, - ClangdSwitchSourceHeaderVSplit = { - function() - switch_source_header_splitcmd(0, "vsplit") - end, - description = "Open source/header in a new vsplit", - }, - ClangdSwitchSourceHeaderSplit = { - function() - switch_source_header_splitcmd(0, "split") - end, - description = "Open source/header in a new split", - }, - }, - }) + require("lspconfig").clangd.setup({ + on_attach = options.on_attach, + capabilities = vim.tbl_deep_extend("keep", { offsetEncoding = { "utf-16", "utf-8" } }, options.capabilities), + single_file_support = true, + cmd = { + "clangd", + "-j=12", + "--enable-config", + "--background-index", + "--pch-storage=memory", + -- You MUST set this arg ↓ to your c/cpp compiler location (if not included)! + "--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }), + "--clang-tidy", + "--all-scopes-completion", + "--completion-style=detailed", + "--header-insertion-decorators", + "--header-insertion=iwyu", + "--limit-references=3000", + "--limit-results=270", + }, + commands = { + ClangdSwitchSourceHeader = { + function() + switch_source_header_splitcmd(0, "edit") + end, + description = "Open source/header in current buffer", + }, + ClangdSwitchSourceHeaderVSplit = { + function() + switch_source_header_splitcmd(0, "vsplit") + end, + description = "Open source/header in a new vsplit", + }, + ClangdSwitchSourceHeaderSplit = { + function() + switch_source_header_splitcmd(0, "split") + end, + description = "Open source/header in a new split", + }, + }, + }) end diff --git a/lua/modules/configs/tool/nvim-tree.lua b/lua/modules/configs/tool/nvim-tree.lua index 9d3f7de0d..37593ced0 100644 --- a/lua/modules/configs/tool/nvim-tree.lua +++ b/lua/modules/configs/tool/nvim-tree.lua @@ -62,7 +62,7 @@ return function() show = { file = true, folder = true, - folder_arrow = false, + folder_arrow = true, git = true, }, padding = " ", @@ -81,10 +81,10 @@ return function() ignored = icons.git.Ignore, --◌ }, folder = { - -- arrow_open = "", - -- arrow_closed = "", - arrow_open = "", - arrow_closed = "", + arrow_open = icons.ui.ArrowOpen, + arrow_closed = icons.ui.ArrowClosed, + -- arrow_open = "", + -- arrow_closed = "", default = icons.ui.Folder, open = icons.ui.FolderOpen, empty = icons.ui.EmptyFolder, diff --git a/lua/modules/configs/tool/toggleterm.lua b/lua/modules/configs/tool/toggleterm.lua index 1f0307e1c..a93d8d765 100644 --- a/lua/modules/configs/tool/toggleterm.lua +++ b/lua/modules/configs/tool/toggleterm.lua @@ -1,7 +1,4 @@ return function() - local colors = require("modules.utils").get_palette() - local floatborder_hl = require("modules.utils").hl_to_rgb("FloatBorder", false, colors.blue) - require("toggleterm").setup({ -- size can be a number or function which is passed the current terminal size = function(term) @@ -18,8 +15,14 @@ return function() vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" }) end, highlights = { + Normal = { + link = "Normal", + }, + NormalFloat = { + link = "NormalFloat", + }, FloatBorder = { - guifg = floatborder_hl, + link = "FloatBorder", }, }, open_mapping = false, -- [[]], @@ -33,13 +36,5 @@ return function() direction = "horizontal", close_on_exit = true, -- close the terminal window when the process exits shell = vim.o.shell, -- change the default shell - float_opts = { - border = "curved", - winblend = 0, - highlights = { - border = "Normal", - background = "Normal", - }, - }, }) end diff --git a/lua/modules/configs/tool/wilder.lua b/lua/modules/configs/tool/wilder.lua index 60948a8f0..b99d1a19d 100644 --- a/lua/modules/configs/tool/wilder.lua +++ b/lua/modules/configs/tool/wilder.lua @@ -1,6 +1,5 @@ return function() local wilder = require("wilder") - local colors = require("modules.utils").get_palette() local icons = { ui = require("modules.utils.icons").get("ui") } wilder.setup({ modes = { ":", "/", "?" } }) @@ -25,13 +24,12 @@ return function() ), }) - local match_hl = require("modules.utils").hl_to_rgb("String", false, colors.green) - local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({ border = "rounded", highlights = { - border = "Title", -- highlight to use for the border - accent = wilder.make_hl("WilderAccent", "Pmenu", { { a = 0 }, { a = 0 }, { foreground = match_hl } }), + default = "Pmenu", + border = "PmenuBorder", -- highlight to use for the border + accent = wilder.make_hl("WilderAccent", "CmpItemAbbr", "CmpItemAbbrMatch"), }, empty_message = wilder.popupmenu_empty_message_with_spinner(), highlighter = wilder.lua_fzy_highlighter(), diff --git a/lua/modules/configs/ui/catppuccin.lua b/lua/modules/configs/ui/catppuccin.lua index 673e43eb2..ebd710850 100644 --- a/lua/modules/configs/ui/catppuccin.lua +++ b/lua/modules/configs/ui/catppuccin.lua @@ -1,5 +1,6 @@ return function() local transparent_background = require("core.settings").transparent_background + local clear = {} require("catppuccin").setup({ flavour = "mocha", -- Can be one of: latte, frappe, macchiato, mocha @@ -82,175 +83,74 @@ return function() symbols_outline = false, telekasten = false, telescope = true, - treesitter_context = false, + treesitter_context = true, ts_rainbow = true, vim_sneak = false, vimwiki = false, which_key = true, }, - color_overrides = { - mocha = { - rosewater = "#F5E0DC", - flamingo = "#F2CDCD", - mauve = "#DDB6F2", - pink = "#F5C2E7", - red = "#F28FAD", - maroon = "#E8A2AF", - peach = "#F8BD96", - yellow = "#FAE3B0", - green = "#ABE9B3", - blue = "#96CDFB", - sky = "#89DCEB", - teal = "#B5E8E0", - lavender = "#C9CBFF", - - text = "#D9E0EE", - subtext1 = "#BAC2DE", - subtext0 = "#A6ADC8", - overlay2 = "#C3BAC6", - overlay1 = "#988BA2", - overlay0 = "#6E6C7E", - surface2 = "#6E6C7E", - surface1 = "#575268", - surface0 = "#302D41", - - base = "#1E1E2E", - mantle = "#1A1826", - crust = "#161320", - }, - }, + color_overrides = {}, highlight_overrides = { - mocha = function(cp) + ---@param cp palette + all = function(cp) return { - -- For base configs. - NormalFloat = { fg = cp.text, bg = transparent_background and cp.none or cp.base }, + -- For base configs + NormalFloat = { fg = cp.text, bg = transparent_background and cp.none or cp.mantle }, + FloatBorder = { + fg = transparent_background and cp.blue or cp.mantle, + bg = transparent_background and cp.none or cp.mantle, + }, CursorLineNr = { fg = cp.green }, - Search = { bg = cp.surface1, fg = cp.pink, style = { "bold" } }, - IncSearch = { bg = cp.pink, fg = cp.surface1 }, - Keyword = { fg = cp.pink }, - Type = { fg = cp.blue }, - Typedef = { fg = cp.yellow }, - StorageClass = { fg = cp.red, style = { "italic" } }, - -- For native lsp configs. + -- For native lsp configs DiagnosticVirtualTextError = { bg = cp.none }, DiagnosticVirtualTextWarn = { bg = cp.none }, DiagnosticVirtualTextInfo = { bg = cp.none }, - DiagnosticVirtualTextHint = { fg = cp.rosewater, bg = cp.none }, - - DiagnosticHint = { fg = cp.rosewater }, - LspDiagnosticsDefaultHint = { fg = cp.rosewater }, - LspDiagnosticsHint = { fg = cp.rosewater }, - LspDiagnosticsVirtualTextHint = { fg = cp.rosewater }, - LspDiagnosticsUnderlineHint = { sp = cp.rosewater }, - - -- For fidget. + DiagnosticVirtualTextHint = { bg = cp.none }, + LspInfoBorder = { link = "FloatBorder" }, + + -- For mason.nvim + MasonNormal = { link = "NormalFloat" }, + + -- For nvim-cmp and wilder.nvim + Pmenu = { fg = cp.overlay2, bg = transparent_background and cp.none or cp.base }, + PmenuBorder = { fg = cp.surface1, bg = transparent_background and cp.none or cp.base }, + PmenuSel = { bg = cp.green, fg = cp.base }, + CmpItemAbbr = { fg = cp.overlay2 }, + CmpItemAbbrMatch = { fg = cp.blue, style = { "bold" } }, + CmpDoc = { link = "NormalFloat" }, + CmpDocBorder = { + fg = transparent_background and cp.surface1 or cp.mantle, + bg = transparent_background and cp.none or cp.mantle, + }, + + -- For fidget FidgetTask = { bg = cp.none, fg = cp.surface2 }, FidgetTitle = { fg = cp.blue, style = { "bold" } }, + -- For nvim-tree + NvimTreeRootFolder = { fg = cp.pink }, + NvimTreeIndentMarker = { fg = cp.surface0 }, + -- For trouble.nvim TroubleNormal = { bg = transparent_background and cp.none or cp.base }, - -- For lsp semantic tokens - ["@lsp.type.comment"] = { fg = cp.overlay0 }, - ["@lsp.type.enum"] = { link = "@type" }, - ["@lsp.type.property"] = { link = "@property" }, - ["@lsp.type.macro"] = { link = "@constant" }, - ["@lsp.typemod.function.defaultLibrary"] = { fg = cp.blue, style = { "bold", "italic" } }, - ["@lsp.typemod.function.defaultLibrary.c"] = { fg = cp.blue, style = { "bold" } }, - ["@lsp.typemod.function.defaultLibrary.cpp"] = { fg = cp.blue, style = { "bold" } }, - ["@lsp.typemod.method.defaultLibrary"] = { link = "@lsp.typemod.function.defaultLibrary" }, - ["@lsp.typemod.variable.defaultLibrary"] = { fg = cp.flamingo }, - - -- For treesitter. - ["@field"] = { fg = cp.rosewater }, - ["@property"] = { fg = cp.yellow }, - - ["@include"] = { fg = cp.teal }, - -- ["@operator"] = { fg = cp.sky }, - ["@keyword.operator"] = { fg = cp.sky }, - ["@punctuation.special"] = { fg = cp.maroon }, - - -- ["@float"] = { fg = cp.peach }, - -- ["@number"] = { fg = cp.peach }, - -- ["@boolean"] = { fg = cp.peach }, - - ["@constructor"] = { fg = cp.lavender }, - -- ["@constant"] = { fg = cp.peach }, - -- ["@conditional"] = { fg = cp.mauve }, - -- ["@repeat"] = { fg = cp.mauve }, - ["@exception"] = { fg = cp.peach }, - - ["@constant.builtin"] = { fg = cp.lavender }, - -- ["@function.builtin"] = { fg = cp.peach, style = { "italic" } }, - -- ["@type.builtin"] = { fg = cp.yellow, style = { "italic" } }, - ["@type.qualifier"] = { link = "@keyword" }, - ["@variable.builtin"] = { fg = cp.red, style = { "italic" } }, - - -- ["@function"] = { fg = cp.blue }, - ["@function.macro"] = { fg = cp.red, style = {} }, - ["@parameter"] = { fg = cp.rosewater }, - ["@keyword"] = { fg = cp.red, style = { "italic" } }, - ["@keyword.function"] = { fg = cp.maroon }, - ["@keyword.return"] = { fg = cp.pink, style = {} }, - - -- ["@text.note"] = { fg = cp.base, bg = cp.blue }, - -- ["@text.warning"] = { fg = cp.base, bg = cp.yellow }, - -- ["@text.danger"] = { fg = cp.base, bg = cp.red }, - -- ["@constant.macro"] = { fg = cp.mauve }, - - -- ["@label"] = { fg = cp.blue }, - ["@method"] = { fg = cp.blue, style = { "italic" } }, - ["@namespace"] = { fg = cp.rosewater, style = {} }, - - ["@punctuation.delimiter"] = { fg = cp.teal }, - ["@punctuation.bracket"] = { fg = cp.overlay2 }, - -- ["@string"] = { fg = cp.green }, - -- ["@string.regex"] = { fg = cp.peach }, - ["@type"] = { fg = cp.yellow }, - ["@variable"] = { fg = cp.text }, - ["@tag.attribute"] = { fg = cp.mauve, style = { "italic" } }, - ["@tag"] = { fg = cp.peach }, - ["@tag.delimiter"] = { fg = cp.maroon }, - ["@text"] = { fg = cp.text }, - - -- ["@text.uri"] = { fg = cp.rosewater, style = { "italic", "underline" } }, - -- ["@text.literal"] = { fg = cp.teal, style = { "italic" } }, - -- ["@text.reference"] = { fg = cp.lavender, style = { "bold" } }, - -- ["@text.title"] = { fg = cp.blue, style = { "bold" } }, - -- ["@text.emphasis"] = { fg = cp.maroon, style = { "italic" } }, - -- ["@text.strong"] = { fg = cp.maroon, style = { "bold" } }, - -- ["@string.escape"] = { fg = cp.pink }, - - -- ["@property.toml"] = { fg = cp.blue }, - -- ["@field.yaml"] = { fg = cp.blue }, - - -- ["@label.json"] = { fg = cp.blue }, - - ["@function.builtin.bash"] = { fg = cp.red, style = { "italic" } }, - ["@parameter.bash"] = { fg = cp.yellow, style = { "italic" } }, - - ["@field.lua"] = { fg = cp.lavender }, - ["@constructor.lua"] = { fg = cp.flamingo }, - ["@variable.builtin.lua"] = { fg = cp.flamingo, style = { "italic" } }, - - ["@constant.java"] = { fg = cp.teal }, - - ["@property.typescript"] = { fg = cp.lavender, style = { "italic" } }, - -- ["@constructor.typescript"] = { fg = cp.lavender }, - - -- ["@constructor.tsx"] = { fg = cp.lavender }, - -- ["@tag.attribute.tsx"] = { fg = cp.mauve }, - - ["@type.css"] = { fg = cp.lavender }, - ["@property.css"] = { fg = cp.yellow, style = { "italic" } }, - - ["@type.builtin.c"] = { fg = cp.yellow, style = {} }, - - ["@property.cpp"] = { fg = cp.text }, - ["@type.builtin.cpp"] = { fg = cp.yellow, style = {} }, - - -- ["@symbol"] = { fg = cp.flamingo }, + -- For telescope.nvim + TelescopeBorder = { fg = cp.mantle, bg = cp.mantle }, + TelescopePromptBorder = { fg = cp.surface0, bg = cp.surface0 }, + TelescopePromptNormal = { fg = cp.text, bg = cp.surface0 }, + TelescopePromptPrefix = { fg = cp.flamingo, bg = cp.surface0 }, + TelescopeNormal = { bg = cp.mantle }, + TelescopePreviewTitle = { fg = cp.base, bg = cp.green }, + TelescopePromptTitle = { fg = cp.base, bg = cp.red }, + TelescopeResultsTitle = { fg = cp.mantle, bg = cp.mantle }, + TelescopeSelection = { fg = cp.text, bg = cp.surface0 }, + TelescopeResultsDiffAdd = { fg = cp.green }, + TelescopeResultsDiffChange = { fg = cp.yellow }, + TelescopeResultsDiffDelete = { fg = cp.red }, + + -- For treesitter + ["@keyword.return"] = { fg = cp.pink, style = clear }, } end, }, diff --git a/lua/modules/plugins/completion.lua b/lua/modules/plugins/completion.lua index 1e66a8a7a..dbc7fe370 100644 --- a/lua/modules/plugins/completion.lua +++ b/lua/modules/plugins/completion.lua @@ -42,7 +42,7 @@ completion["hrsh7th/nvim-cmp"] = { { "f3fora/cmp-spell" }, { "hrsh7th/cmp-buffer" }, { "kdheepak/cmp-latex-symbols" }, - { "ray-x/cmp-treesitter" }, + { "ray-x/cmp-treesitter", commit = "c8e3a74" }, -- { "tzachar/cmp-tabnine", build = "./install.sh", config = require("completion.tabnine") }, -- { -- "jcdickinson/codeium.nvim", diff --git a/lua/modules/plugins/ui.lua b/lua/modules/plugins/ui.lua index 7b89aefa5..6fc44817b 100644 --- a/lua/modules/plugins/ui.lua +++ b/lua/modules/plugins/ui.lua @@ -16,6 +16,12 @@ ui["MunifTanjim/nui.nvim"] = { ui["maximilianlloyd/ascii.nvim"] = { lazy = false, } +ui["Jint-lzxy/nvim"] = { + lazy = false, + branch = "refactor/syntax-highlighting", + name = "catppuccin", + config = require("ui.catppuccin"), +} ui["sainnhe/edge"] = { lazy = true, config = require("ui.edge"), @@ -63,11 +69,6 @@ ui["Shatur/neovim-ayu"] = { name = "ayu", config = require("ui.ayu"), } -ui["catppuccin/nvim"] = { - lazy = false, - name = "catppuccin", - config = require("ui.catppuccin"), -} ui["folke/tokyonight.nvim"] = { lazy = false, name = "tokyonight", diff --git a/lua/modules/utils/init.lua b/lua/modules/utils/init.lua index 1c4b3266e..eef44996b 100644 --- a/lua/modules/utils/init.lua +++ b/lua/modules/utils/init.lua @@ -195,23 +195,23 @@ function M.gen_alpha_hl() local colors = M.get_palette() vim.api.nvim_set_hl(0, "AlphaHeader", { fg = colors.blue, default = true }) - vim.api.nvim_set_hl(0, "AlphaButton", { fg = colors.green, default = true }) - vim.api.nvim_set_hl(0, "AlphaAttr", { fg = colors.pink, italic = true, default = true }) + vim.api.nvim_set_hl(0, "AlphaButtons", { fg = colors.green, default = true }) + vim.api.nvim_set_hl(0, "AlphaShortcut", { fg = colors.pink, italic = true, default = true }) vim.api.nvim_set_hl(0, "AlphaFooter", { fg = colors.yellow, default = true }) end -- Generate blend_color for neodim. function M.gen_neodim_blend_attr() - local trans_bg = require("core.settings").transparent_background - local appearance = require("core.settings").background - - if trans_bg and appearance == "dark" then - return "#000000" - elseif trans_bg and appearance == "light" then - return "#FFFFFF" - else - return M.hl_to_rgb("Normal", true) - end + local trans_bg = require("core.settings").transparent_background + local appearance = require("core.settings").background + + if trans_bg and appearance == "dark" then + return "#000000" + elseif trans_bg and appearance == "light" then + return "#FFFFFF" + else + return M.hl_to_rgb("Normal", true) + end end ---Convert number (0/1) to boolean