mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
add nvim-ufo for folding
This commit is contained in:
parent
8416508686
commit
90a0645d42
@ -1,6 +1,2 @@
|
||||
" let the initial folding state be that all folds are closed.
|
||||
set foldlevel=0
|
||||
|
||||
" Use nvim-treesitter for folding
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
setlocal foldlevel=0
|
||||
|
||||
14
lua/config/ufo.lua
Normal file
14
lua/config/ufo.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- disable foldcolumn, see https://github.com/kevinhwang91/nvim-ufo/issues/4
|
||||
vim.o.foldcolumn = '0'
|
||||
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
|
||||
|
||||
-- treesitter as a main provider instead
|
||||
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
|
||||
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
|
||||
require('ufo').setup({
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return {'treesitter', 'indent'}
|
||||
end
|
||||
})
|
||||
@ -50,7 +50,7 @@ local plugin_specs = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
enabled = function()
|
||||
if vim.g.is_mac then
|
||||
if vim.g.is_mac or vim.g.is_linux then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -488,6 +488,14 @@ local plugin_specs = {
|
||||
require("config.fidget-nvim")
|
||||
end,
|
||||
},
|
||||
{
|
||||
'kevinhwang91/nvim-ufo',
|
||||
dependencies = {'kevinhwang91/promise-async'},
|
||||
event = { "VeryLazy" },
|
||||
config = function()
|
||||
require("config.ufo")
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
-- configuration for lazy itself.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user