feat: enhance Neovim configuration with NetRW disabling, auto number toggling, and code folding setup
parent
3338d39206
commit
dfaacbb0e1
@ -0,0 +1,22 @@
|
|||||||
|
return {
|
||||||
|
|
||||||
|
{
|
||||||
|
'kevinhwang91/nvim-ufo',
|
||||||
|
dependencies = {
|
||||||
|
'kevinhwang91/promise-async',
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
vim.o.foldcolumn = '1' -- '0' does not show the fold column, higher values increase the width
|
||||||
|
vim.o.foldlevel = 5 -- Using ufo provider need a large value, feel free to decrease the value
|
||||||
|
vim.o.foldlevelstart = 99
|
||||||
|
vim.o.foldenable = true
|
||||||
|
|
||||||
|
require('ufo').setup {
|
||||||
|
provider_selector = function(bufnr, filetype, buftype)
|
||||||
|
return { 'treesitter', 'indent' }
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
## Code folding
|
||||||
|
|
||||||
|
To see the code fold in left gutter.
|
||||||
|
set foldcolumn=1
|
||||||
|
|
||||||
|
### Creating fold
|
||||||
|
#### Set coding folding mode
|
||||||
|
:set foldmethod=manual
|
||||||
|
|
||||||
|
#### Creating a manual fold
|
||||||
|
1. First select a section of lines in visual mode.
|
||||||
|
2. Press `zf` to create fold, it is `zd` to delete the same fold.
|
||||||
|
3. `zo` to open fold, `zc` to close fold, `za` to toggle open/close fold
|
||||||
|
|
||||||
|
|
||||||
|
#### Creating indent fold
|
||||||
|
:set foldmethod=indent
|
||||||
|
|
||||||
|
|
||||||
|
#### Creating expr fold using nvim-treesitter
|
||||||
|
:set foldlevel=2
|
||||||
|
:set foldmethod=expr
|
||||||
|
:set foldexpr=nvim_treesitter#foldexpr()
|
||||||
|
|
||||||
|
|
||||||
|
vim.wo.foldmethod = 'expr'
|
Loading…
Reference in New Issue