mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 11:23:05 +01:00
add nvim-ufo
This commit is contained in:
parent
9b6dbe42db
commit
d55dd987b2
3 changed files with 42 additions and 0 deletions
|
@ -1,6 +1,11 @@
|
|||
local lspc = require "lspconfig"
|
||||
local caps = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
caps.textDocument.foldingRange = {
|
||||
dynamicRegistration = false,
|
||||
lineFoldingOnly = true,
|
||||
}
|
||||
|
||||
local lua_runtime_path = vim.split(package.path, ";")
|
||||
table.insert(lua_runtime_path, "lua/?.lua")
|
||||
table.insert(lua_runtime_path, "lua/?/init.lua")
|
||||
|
|
30
.config/nvim/lua/pluginconf/nvim_ufo.lua
Normal file
30
.config/nvim/lua/pluginconf/nvim_ufo.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local ufo = require "ufo"
|
||||
local ts_parsers = require "nvim-treesitter.parsers"
|
||||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
ufo.setup {
|
||||
open_fold_hl_timeout = 0, -- disable blinky thingy when opening fold
|
||||
provider_selector = function(_, ft, _)
|
||||
if ts_parsers.has_parser(ft) then
|
||||
return { "lsp", "treesitter" }
|
||||
else
|
||||
return { "lsp", "indent" }
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
vim.o.foldcolumn = "1"
|
||||
-- https://github.com/neovim/neovim/pull/17446
|
||||
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
|
||||
vim.o.foldlevel = 256
|
||||
vim.o.foldlevelstart = 256
|
||||
vim.o.foldenable = true
|
||||
|
||||
local map_opts = {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
}
|
||||
|
||||
map("n", "t", "za", map_opts) -- toggle fold
|
||||
map("n", "zO", [[<cmd>lua require("ufo").openAllFolds()<CR>]], map_opts)
|
||||
map("n", "zC", [[<cmd>lua require("ufo").closeAllFolds()<CR>]], map_opts)
|
|
@ -164,5 +164,12 @@ return require("packer").startup(function(use)
|
|||
|
||||
use "mfussenegger/nvim-jdtls"
|
||||
|
||||
use {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
requires = "kevinhwang91/promise-async",
|
||||
after = "nvim-lspconfig",
|
||||
config = pconf "nvim_ufo",
|
||||
}
|
||||
|
||||
cmp_plugins(use)
|
||||
end)
|
||||
|
|
Loading…
Reference in a new issue