updated and added folding config
This commit is contained in:
parent
d7f4690061
commit
74267c56fd
4 changed files with 72 additions and 33 deletions
|
|
@ -9,7 +9,7 @@ lsp.ensure_installed {
|
|||
-- 'mypy',
|
||||
-- 'black',
|
||||
-- 'isort',
|
||||
'ruff_lsp',
|
||||
-- 'ruff_lsp',
|
||||
'pyright',
|
||||
-- Java Stuffs
|
||||
'jdtls',
|
||||
|
|
|
|||
36
after/plugin/nvim-ufo-config.lua
Normal file
36
after/plugin/nvim-ufo-config.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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
|
||||
|
||||
-- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself
|
||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
vim.keymap.set('n', 'zK', function()
|
||||
local winid = require('ufo').peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
-- choose one of coc.nvim and nvim lsp
|
||||
vim.fn.CocActionAsync 'definitionHover' -- coc.nvim
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end)
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
|
||||
for _, ls in ipairs(language_servers) do
|
||||
require('lspconfig')[ls].setup {
|
||||
capabilities = capabilities,
|
||||
-- you can add other fields for setting up lsp server in this table
|
||||
}
|
||||
end
|
||||
|
||||
require('ufo').setup {
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
return { 'lsp', 'indent' }
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue