nvim: add ufo folding plugin
This commit is contained in:
parent
749b49bbac
commit
75aa3bc9fa
12
.gitmodules
vendored
12
.gitmodules
vendored
@ -14,7 +14,6 @@
|
|||||||
# neovim plugins
|
# neovim plugins
|
||||||
################
|
################
|
||||||
|
|
||||||
# auto close brackets and quotes
|
|
||||||
[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-cmp"]
|
[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_nvim-cmp"]
|
||||||
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-cmp
|
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-cmp
|
||||||
url = https://github.com/hrsh7th/nvim-cmp.git
|
url = https://github.com/hrsh7th/nvim-cmp.git
|
||||||
@ -61,6 +60,17 @@
|
|||||||
[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_cmp_luasnip"]
|
[submodule "src/dot_local/share/nvim/site/pack/3pp/start/external_cmp_luasnip"]
|
||||||
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_cmp_luasnip
|
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_cmp_luasnip
|
||||||
url = https://github.com/saadparwaiz1/cmp_luasnip
|
url = https://github.com/saadparwaiz1/cmp_luasnip
|
||||||
|
|
||||||
|
# auto-close brackets
|
||||||
[submodule "src/dot_local/share/nvim/site/pack/3pp/opt/external_auto-pairs"]
|
[submodule "src/dot_local/share/nvim/site/pack/3pp/opt/external_auto-pairs"]
|
||||||
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_auto-pairs
|
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_auto-pairs
|
||||||
url = https://github.com/jiangmiao/auto-pairs
|
url = https://github.com/jiangmiao/auto-pairs
|
||||||
|
|
||||||
|
# code folding
|
||||||
|
# coding.lua
|
||||||
|
[submodule "src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-ufo"]
|
||||||
|
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_nvim-ufo
|
||||||
|
url = https://github.com/kevinhwang91/nvim-ufo
|
||||||
|
[submodule "src/dot_local/share/nvim/site/pack/3pp/opt/external_promise-async"]
|
||||||
|
path = src/dot_local/share/nvim/site/pack/3pp/opt/external_promise-async
|
||||||
|
url = https://github.com/kevinhwang91/promise-async
|
||||||
|
@ -63,11 +63,6 @@ require 'nvim-treesitter.configs'.setup {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- code folding
|
|
||||||
vim.wo.foldmethod = 'expr'
|
|
||||||
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
|
||||||
vim.wo.foldlevel = 99 -- unfold by default
|
|
||||||
|
|
||||||
--------
|
--------
|
||||||
-- auto-pairs for brackets
|
-- auto-pairs for brackets
|
||||||
--------
|
--------
|
||||||
@ -200,18 +195,45 @@ local servers = {
|
|||||||
},
|
},
|
||||||
nushell = {},
|
nushell = {},
|
||||||
}
|
}
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true
|
||||||
|
}
|
||||||
for lsp, sv_settings in pairs(servers) do
|
for lsp, sv_settings in pairs(servers) do
|
||||||
-- defaults
|
-- defaults
|
||||||
local settings = {
|
local settings = {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
},
|
||||||
|
capabilities=capabilities,
|
||||||
}
|
}
|
||||||
for k, v in pairs(servers[lsp]) do settings[k] = v end
|
for k, v in pairs(servers[lsp]) do settings[k] = v end
|
||||||
nvim_lsp[lsp].setup(settings)
|
nvim_lsp[lsp].setup(settings)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------
|
||||||
|
-- code folding
|
||||||
|
--
|
||||||
|
-- useful binds include zM (close all folds), zA (recursively toggle fold), and zR (open all folds).
|
||||||
|
-- see :h usr_28 for more information about folds.
|
||||||
|
--------
|
||||||
|
vim.cmd.packadd("promise-async")
|
||||||
|
vim.cmd.packadd("nvim-ufo")
|
||||||
|
local ufo = require("ufo")
|
||||||
|
ufo.setup()
|
||||||
|
vim.o.foldenable = true
|
||||||
|
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
|
-- set to '1' to get a column with arrows for folds
|
||||||
|
vim.o.foldcolumn = '0'
|
||||||
|
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||||
|
vim.o.foldlevel = 99
|
||||||
|
vim.o.foldlevelstart = 99
|
||||||
|
keymap('zM', ufo.closeAllFolds)
|
||||||
|
keymap('zR', ufo.openAllFolds)
|
||||||
|
keymap('zm', ufo.closeFoldsWith)
|
||||||
|
keymap('zr', ufo.openFoldsExceptKinds)
|
||||||
|
|
||||||
------
|
------
|
||||||
-- completions
|
-- completions
|
||||||
|
@ -34,6 +34,8 @@ local styles = colorbuddy.styles
|
|||||||
Group.new("Normal", colors.noir_4, colors.none, nil)
|
Group.new("Normal", colors.noir_4, colors.none, nil)
|
||||||
Group.new("StatusLine", colors.noir_4, colors.none, styles.bold)
|
Group.new("StatusLine", colors.noir_4, colors.none, styles.bold)
|
||||||
Group.link("MsgArea", groups.Normal)
|
Group.link("MsgArea", groups.Normal)
|
||||||
|
Group.link("FoldColumn", groups.Normal)
|
||||||
|
Group.link("Folded", groups.Normal)
|
||||||
Group.new("StatusLineNC", colors.noir_7, colors.none)
|
Group.new("StatusLineNC", colors.noir_7, colors.none)
|
||||||
Group.link("Gutter", groups.normal)
|
Group.link("Gutter", groups.normal)
|
||||||
Group.new("LineNr", colors.noir_8, colors.none, nil)
|
Group.new("LineNr", colors.noir_8, colors.none, nil)
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 522d719d421fc42b95577d9624048d8348d326ea
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 119e8961014c9bfaf1487bf3c2a393d254f337e2
|
Loading…
Reference in New Issue
Block a user