From 4dfcea0e987b17ef706e3d1a0f0f9279fc325d47 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Sun, 24 May 2026 19:13:36 +0100 Subject: [PATCH] fix(nvim): Add 0.12 experimental stuff --- .config/nvim/init.lua | 165 +++++++++++++++++++------------ .config/nvim/nvim-pack-lock.json | 64 ++++++------ 2 files changed, 129 insertions(+), 100 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 01ee86f..62f1afe 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -34,6 +34,7 @@ vim.opt.autoread = true -- Automati vim.opt.swapfile = false -- Disable swap files -- Formatting vim.opt.formatoptions:remove("ro") -- Remove 'ro' from formatoptions +vim.opt.completeopt = { 'menuone', 'noinsert', 'popup', 'fuzzy' } --Move lines vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") @@ -82,8 +83,8 @@ vim.api.nvim_create_autocmd('PackChanged', { }) vim.pack.add({ - 'https://github.com/sainnhe/gruvbox-material', - 'https://github.com/sainnhe/everforest', + --'https://github.com/sainnhe/gruvbox-material', + --'https://github.com/sainnhe/everforest', 'https://github.com/navarasu/onedark.nvim', { src = 'https://github.com/echasnovski/mini.icons', version = vim.version.range('*') }, 'https://github.com/folke/snacks.nvim', @@ -93,7 +94,6 @@ vim.pack.add({ { src = 'https://github.com/echasnovski/mini.ai', version = vim.version.range('*') }, -- Adds S in regex to handle case conversion 'https://github.com/tpope/vim-abolish', - 'https://github.com/mbbill/undotree', { src = 'https://github.com/ThePrimeagen/harpoon', version = 'harpoon2' }, 'https://github.com/stevearc/oil.nvim', 'https://github.com/mrjones2014/smart-splits.nvim', @@ -105,6 +105,7 @@ vim.pack.add({ 'https://github.com/smjonas/inc-rename.nvim', 'https://github.com/williamboman/mason.nvim', { src = 'https://github.com/saghen/blink.cmp', version = vim.version.range('*') }, + { src = 'https://github.com/saghen/blink.compat', version = vim.version.range('*') }, 'https://github.com/rafamadriz/friendly-snippets', 'https://github.com/stevearc/conform.nvim', 'https://github.com/mfussenegger/nvim-lint', @@ -112,7 +113,7 @@ vim.pack.add({ 'https://github.com/mfussenegger/nvim-dap', 'https://github.com/igorlfs/nvim-dap-view', 'https://github.com/lervag/vimtex', - { src = 'https://github.com/chomosuke/typst-preview.nvim', version = vim.version.range('1.*') }, + 'https://github.com/micangl/cmp-vimtex', 'https://github.com/tpope/vim-fugitive', 'https://github.com/FabijanZulj/blame.nvim', 'https://github.com/folke/todo-comments.nvim', @@ -120,6 +121,11 @@ vim.pack.add({ 'https://github.com/nvim-tree/nvim-web-devicons', }) +-- NVIM 0.12 EXPERIMENTAL +vim.cmd.packadd('nvim.undotree') +vim.o.cmdheight=0 +require('vim._core.ui2').enable() + local treesitter = require('nvim-treesitter') vim.api.nvim_create_autocmd('FileType', { callback = function(args) @@ -248,8 +254,24 @@ require('mason').setup() vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) - local conform = require("conform") + -- local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) + -- vim.lsp.completion.enable(true, client.id, ev.buf, { + -- autotrigger = true, + -- convert = function(item) + -- local kind_name = vim.lsp.protocol.CompletionItemKind[item.kind] or 'Text' + -- local icon, hl = require('mini.icons').get('lsp', kind_name:lower()) + -- return { + -- abbr = (item.label or ''):gsub('%b()', ''), + -- kind = icon and (icon .. ' ' .. kind_name) or kind_name, + -- kind_hlgroup = hl, + -- menu = item.detail or '', + -- } + -- end, + -- }) + -- vim.o.pumheight = 7 + -- vim.o.pumborder = 'single' + local conform = require("conform") local function jumpWithVirtLineDiags(jumpCount) pcall(vim.api.nvim_del_augroup_by_name, "jumpWithVirtLineDiags") vim.diagnostic.jump({ count = jumpCount }) @@ -269,7 +291,9 @@ vim.api.nvim_create_autocmd("LspAttach", { end, 1) end + vim.api.nvim_set_hl(0, 'Pmenu', { link = 'Float' }) local bufopts = { noremap = true, silent = true, buffer = ev.buf } + vim.keymap.set('i', '', vim.lsp.completion.get) vim.keymap.set("n", "e", vim.diagnostic.open_float, bufopts) vim.keymap.set("n", "q", vim.diagnostic.setloclist, bufopts) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) @@ -357,9 +381,14 @@ vim.lsp.enable('clangd') vim.lsp.config['nil_ls'] = { capabilities = capabilities } vim.lsp.enable('nil_ls') +vim.lsp.config['pyright'] = { capabilities = capabilities } +vim.lsp.enable('pyright') + -- vimtex -- if vim.loop.os_uname().sysname == "Darwin" then - vim.g.vimtex_view_method = 'sioyek' + vim.g.vimtex_view_method = 'skim' + -- vim.g.vimtex_view_method = 'zathura' + -- vim.g.vimtex_view_zathura_use_synctex = 0 else vim.g.vimtex_view_method = 'zathura' end @@ -380,71 +409,79 @@ vim.g.vimtex_view_automatic = 1 -- blink.cmp -- -require('blink.cmp').setup({ - keymap = { - preset = 'default', - [''] = {}, - [''] = {}, - [''] = { 'scroll_documentation_up', 'fallback' }, - [''] = { 'scroll_documentation_down', 'fallback' }, - }, - appearance = { - use_nvim_cmp_as_default = true, - nerd_font_variant = 'mono', - }, - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, - providers = { - lazydev = { - name = "LazyDev", - module = "lazydev.integrations.blink", - fallbacks = { "lsp" }, - }, +if vim.g.vscode ~= 1 then + require('blink.cmp').setup({ + keymap = { + preset = 'default', + [''] = {}, + [''] = {}, + [''] = { 'scroll_documentation_up', 'fallback' }, + [''] = { 'scroll_documentation_down', 'fallback' }, }, - }, - signature = { - enabled = true, - window = { show_documentation = false }, - }, - cmdline = { - completion = { menu = { auto_show = true } }, - }, - completion = { - accept = { auto_brackets = { enabled = true } }, - menu = { - border = "single", - winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", - winblend = 0, - draw = { - treesitter = { 'lsp' }, - columns = { { 'kind_icon' }, { 'label' } }, - components = { - kind_icon = { - ellipsis = false, - text = function(ctx) - local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind) - return kind_icon - end, - highlight = function(ctx) - local _, hl, _ = require('mini.icons').get('lsp', ctx.kind) - return hl - end, - }, + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = 'mono', + }, + sources = { + default = { 'vimtex', 'lsp', 'path', 'snippets', 'buffer' }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + fallbacks = { "lsp" }, + }, + vimtex = { + name = "vimtex", + min_keyword_length = 2, + module = "blink.compat.source", + score_offset = 80, }, }, }, - documentation = { - auto_show = true, - window = { - border = 'single', - max_width = 160, - max_height = 30, - winblend = 0, + signature = { + enabled = true, + window = { show_documentation = false }, + }, + cmdline = { + completion = { menu = { auto_show = true } }, + }, + completion = { + accept = { auto_brackets = { enabled = true } }, + menu = { + border = "single", winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", + winblend = 0, + draw = { + treesitter = { 'lsp' }, + columns = { { 'kind_icon' }, { 'label' } }, + components = { + kind_icon = { + ellipsis = false, + text = function(ctx) + local kind_icon, _, _ = require('mini.icons').get('lsp', ctx.kind) + return kind_icon + end, + highlight = function(ctx) + local _, hl, _ = require('mini.icons').get('lsp', ctx.kind) + return hl + end, + }, + }, + }, + }, + documentation = { + auto_show = true, + window = { + border = 'single', + max_width = 160, + max_height = 30, + winblend = 0, + winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None", + }, }, }, - }, -}) + }) +end -- conform -- require('conform').setup({ diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json index 5ddf6c3..be15736 100644 --- a/.config/nvim/nvim-pack-lock.json +++ b/.config/nvim/nvim-pack-lock.json @@ -5,30 +5,31 @@ "src": "https://github.com/FabijanZulj/blame.nvim" }, "blink.cmp": { - "rev": "451168851e8e2466bc97ee3e026c3dcb9141ce07", + "rev": "78336bc89ee5365633bcf754d93df01678b5c08f", "src": "https://github.com/saghen/blink.cmp", "version": ">=0.0.0" }, - "conform.nvim": { - "rev": "086a40dc7ed8242c03be9f47fbcee68699cc2395", - "src": "https://github.com/stevearc/conform.nvim" + "blink.compat": { + "rev": "2ed6d9a28b07fa6f3bface818470605f8896408c", + "src": "https://github.com/saghen/blink.compat", + "version": ">=0.0.0" }, - "everforest": { - "rev": "b03a03148c8b34c24c96960b93da9c8883d11f54", - "src": "https://github.com/sainnhe/everforest" + "cmp-vimtex": { + "rev": "c09ca05bfa0641754516f13294d73d3799a02fc8", + "src": "https://github.com/micangl/cmp-vimtex" + }, + "conform.nvim": { + "rev": "9fd3b3a91b0981d60d2bc688c8cd1680320ee5de", + "src": "https://github.com/stevearc/conform.nvim" }, "friendly-snippets": { "rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9", "src": "https://github.com/rafamadriz/friendly-snippets" }, "fzf-lua": { - "rev": "6e41ba7505f35a6f054ca682b043aa0cea36c2ef", + "rev": "23f71140754b9162551dc8ccc1d6346e4275ecc2", "src": "https://github.com/ibhagwan/fzf-lua" }, - "gruvbox-material": { - "rev": "790afe9dd085aa04eccd1da3626c5fa05c620e53", - "src": "https://github.com/sainnhe/gruvbox-material" - }, "harpoon": { "rev": "87b1a3506211538f460786c23f98ec63ad9af4e5", "src": "https://github.com/ThePrimeagen/harpoon", @@ -47,11 +48,11 @@ "src": "https://github.com/barreiroleo/ltex-extra.nvim" }, "mason.nvim": { - "rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65", + "rev": "8e921c2b68571e978db5d4d3fef9c9a7f8755473", "src": "https://github.com/williamboman/mason.nvim" }, "mini.ai": { - "rev": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4", + "rev": "bfb26d9072670c3aaefab0f53024b2f3729c8083", "src": "https://github.com/echasnovski/mini.ai", "version": ">=0.0.0" }, @@ -71,31 +72,31 @@ "version": ">=0.0.0" }, "nvim-dap": { - "rev": "a9d8cb68ee7184111dc66156c4a2ebabfbe01bc5", + "rev": "45a69eba683a2c448dd9ecfc4de89511f0646b5f", "src": "https://github.com/mfussenegger/nvim-dap" }, "nvim-dap-view": { - "rev": "1b538131335f807ab54baa2bc06b811d5dd75079", + "rev": "b5cc6e1c4cd188478fdad2e0b58dbca08fd6d363", "src": "https://github.com/igorlfs/nvim-dap-view" }, "nvim-lint": { - "rev": "606b823a57b027502a9ae00978ebf4f5d5158098", + "rev": "665525810630701b84181e4d9eefd24b49845b29", "src": "https://github.com/mfussenegger/nvim-lint" }, "nvim-lspconfig": { - "rev": "dd261ad5266ab5bbec249d21efeceda98ff3e1a6", + "rev": "8f7e64066e2641d5e7d494962a9c7051e3d38dd5", "src": "https://github.com/neovim/nvim-lspconfig" }, "nvim-treesitter": { - "rev": "2f5d4c3f3c675962242096bcc8e586d76dd72eb2", + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", "src": "https://github.com/nvim-treesitter/nvim-treesitter" }, "nvim-treesitter-textobjects": { - "rev": "4e91b5d0394329a229725b021a8ea217099826ef", + "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e", "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" }, "nvim-web-devicons": { - "rev": "d7462543c9e366c0d196c7f67a945eaaf5d99414", + "rev": "2795c26c916bb3c57dde308b82be51971fa92747", "src": "https://github.com/nvim-tree/nvim-web-devicons" }, "oil.nvim": { @@ -103,38 +104,29 @@ "src": "https://github.com/stevearc/oil.nvim" }, "onedark.nvim": { - "rev": "213c23ae45a04797572242568d5d51937181792d", + "rev": "df4792accde9db0043121f32628bcf8e645d9aea", "src": "https://github.com/navarasu/onedark.nvim" }, "plenary.nvim": { - "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", "src": "https://github.com/nvim-lua/plenary.nvim" }, "smart-splits.nvim": { - "rev": "82d01bb71bc051955654b3af68355f783d872fe0", + "rev": "9053ebd394c38fe55fd2f4710daec27411c34fb9", "src": "https://github.com/mrjones2014/smart-splits.nvim" }, "snacks.nvim": { - "rev": "a049339328e2599ad6e85a69fa034ac501e921b2", + "rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e", "src": "https://github.com/folke/snacks.nvim" }, "tiny-glimmer.nvim": { - "rev": "932e6c2cc4a43ce578f007db1f8f61ad6798f938", + "rev": "cc285167914e947fc130523d02927fdaf24636a6", "src": "https://github.com/rachartier/tiny-glimmer.nvim" }, "todo-comments.nvim": { "rev": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668", "src": "https://github.com/folke/todo-comments.nvim" }, - "typst-preview.nvim": { - "rev": "e123a7ab64e52d836e00dea9251e85b201f38966", - "src": "https://github.com/chomosuke/typst-preview.nvim", - "version": "1.0.0 - 2.0.0" - }, - "undotree": { - "rev": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d", - "src": "https://github.com/mbbill/undotree" - }, "vim-abolish": { "rev": "dcbfe065297d31823561ba787f51056c147aa682", "src": "https://github.com/tpope/vim-abolish" @@ -144,7 +136,7 @@ "src": "https://github.com/tpope/vim-fugitive" }, "vimtex": { - "rev": "82d2305ff71dfb3bd91602534cc9bb9a195bcb38", + "rev": "182ad387e3f3107699483606c9a2b6648f8437b2", "src": "https://github.com/lervag/vimtex" } }