update nvim

This commit is contained in:
Andre Henriques 2025-01-24 13:03:47 +00:00
parent 21ca8a3fbe
commit 823d04780f
5 changed files with 85 additions and 11 deletions

View File

@ -6,6 +6,7 @@
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-snippy": { "branch": "master", "commit": "6e39210aa3a74e2bf6462f492eaf0d436cd2b7d3" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"cyberdream.nvim": { "branch": "main", "commit": "e510399867656973bbedcededf6d32f52fa82b57" },
"fidget": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
@ -19,9 +20,10 @@
"nvim-snippy": { "branch": "master", "commit": "86a0b645551ca83153a594097ee0267498abaae2" },
"nvim-tree.lua": { "branch": "master", "commit": "db8d7ac1f524fc6f808764b29fa695c51e014aa6" },
"nvim-treesitter": { "branch": "master", "commit": "2d5c122af9c3c842d74a137446dae8ff349206ac" },
"oxocarbon.nvim": { "branch": "main", "commit": "004777819ba294423b638a35a75c9f0c7be758ed" },
"nvim-ufo": { "branch": "main", "commit": "4c64d89c2bf174d95d4ac91cc959a9e43e2f318c" },
"plenary": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"snacks.nvim": { "branch": "main", "commit": "9651a931043359fcc094ab5c67ac22554a602745" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"trouble.nvim": { "branch": "main", "commit": "3dc00c0447c016cd43e03054c3d49436a1f2076d" },

View File

@ -118,6 +118,13 @@ return {
opts = {}
},
{
'kevinhwang91/nvim-ufo',
dependencies = {
'kevinhwang91/promise-async',
},
},
{
"neovim/nvim-lspconfig",
dependencies = {
@ -132,6 +139,7 @@ return {
'dcampos/nvim-snippy',
'dcampos/cmp-snippy',
'fidget',
'kevinhwang91/nvim-ufo',
},
config = function()
@ -159,10 +167,17 @@ return {
setup_attach()
setup_cmp()
-- This is required by UFO
local pre_capabilities = vim.lsp.protocol.make_client_capabilities()
pre_capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
pre_capabilities,
require('cmp_nvim_lsp').default_capabilities()
)
@ -192,6 +207,51 @@ return {
capabilities = capabilities,
}
--
-- UFO stuff (folding)
--
local handler = function(virtText, lnum, endLnum, width, truncate)
local newVirtText = {}
local suffix = (' 󰁂 %d '):format(endLnum - lnum)
local sufWidth = vim.fn.strdisplaywidth(suffix)
local targetWidth = width - sufWidth
local curWidth = 0
for _, chunk in ipairs(virtText) do
local chunkText = chunk[1]
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
if targetWidth > curWidth + chunkWidth then
table.insert(newVirtText, chunk)
else
chunkText = truncate(chunkText, targetWidth - curWidth)
local hlGroup = chunk[2]
table.insert(newVirtText, {chunkText, hlGroup})
chunkWidth = vim.fn.strdisplaywidth(chunkText)
-- str width returned from truncate() may less than 2nd argument, need padding
if curWidth + chunkWidth < targetWidth then
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
end
break
end
curWidth = curWidth + chunkWidth
end
table.insert(newVirtText, {suffix, 'MoreMsg'})
return newVirtText
end
require('ufo').setup({
fold_virt_text_handler = handler
})
-- vim.keymap.set('n', 'zf', require('ufo').closeFoldsWith)
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
--
-- END UFO stuff (folding)
--
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)

View File

@ -53,11 +53,18 @@ return {
-- vim.cmd[[colorscheme tokyonight-day]]
-- end
-- }
{
"nyoom-engineering/oxocarbon.nvim",
config = function()
vim.opt.background = "dark" -- set this to dark or light
vim.cmd.colorscheme "oxocarbon"
end
}
-- {
-- "nyoom-engineering/oxocarbon.nvim",
-- config = function()
-- vim.opt.background = "dark" -- set this to dark or light
-- vim.cmd.colorscheme "oxocarbon"
-- end
-- }
{
"scottmckendry/cyberdream.nvim",
config = function()
vim.opt.background = "dark" -- set this to dark or light
vim.cmd.colorscheme "cyberdream"
end
}
}

View File

@ -89,7 +89,7 @@ return {
local api = require "nvim-tree.api"
vim.keymap.set('n', '<C-b>', function() api.tree.toggle() end)
end
}
},
-- {
-- 'wellle/context.vim',
-- }

View File

@ -20,7 +20,12 @@ vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.colorcolumn= "100"
-- vim.opt.foldenable = false
vim.o.foldcolumn = '1' -- '0' is not bad
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- vim.opt.foldenable = true
-- vim.opt.foldmethod = "indent"
vim.filetype.add({