ux and editing plugins configured
This commit is contained in:
parent
ab42f6cebc
commit
9a03d01844
8 changed files with 193 additions and 13 deletions
56
lua/plugins/ufo.lua
Normal file
56
lua/plugins/ufo.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
-- Phase 6.7: nvim-ufo for better folding with Treesitter and LSP support
|
||||
return {
|
||||
'kevinhwang91/nvim-ufo',
|
||||
dependencies = {
|
||||
'kevinhwang91/promise-async',
|
||||
},
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
keys = {
|
||||
{ 'zR', function() require('ufo').openAllFolds() end, desc = 'Open all folds' },
|
||||
{ 'zM', function() require('ufo').closeAllFolds() end, desc = 'Close all folds' },
|
||||
{ 'zr', function() require('ufo').openFoldsExceptKinds() end, desc = 'Open folds except kinds' },
|
||||
{ 'zm', function() require('ufo').closeFoldsWith() end, desc = 'Close folds with' },
|
||||
{ 'K', function()
|
||||
local winid = require('ufo').peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
-- Fall back to LSP hover if not on a fold
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end, desc = 'Peek fold or LSP hover' },
|
||||
},
|
||||
opts = {
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
-- Use Treesitter for supported languages, LSP for others, indent as fallback
|
||||
return { 'treesitter', 'indent' }
|
||||
end,
|
||||
-- Open folds when searching
|
||||
open_fold_hl_timeout = 150,
|
||||
close_fold_kinds_for_ft = {
|
||||
default = { 'imports', 'comment' },
|
||||
},
|
||||
preview = {
|
||||
win_config = {
|
||||
border = { '', '─', '', '', '', '─', '', '' },
|
||||
winhighlight = 'Normal:Folded',
|
||||
winblend = 0,
|
||||
},
|
||||
mappings = {
|
||||
scrollU = '<C-u>',
|
||||
scrollD = '<C-d>',
|
||||
jumpTop = '[',
|
||||
jumpBot = ']',
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- Set fold settings for nvim-ufo
|
||||
vim.o.foldcolumn = '1' -- Show fold column
|
||||
vim.o.foldlevel = 99 -- Open all folds by default
|
||||
vim.o.foldlevelstart = 99 -- Open all folds when opening a file
|
||||
vim.o.foldenable = true -- Enable folding
|
||||
-- Use simple characters for fold indicators
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:▼,foldsep: ,foldclose:▶]]
|
||||
|
||||
require('ufo').setup(opts)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue