mirror of
https://github.com/marianozunino/nvim.git
synced 2025-06-28 18:43:50 -03:00
chore: some qol crap
This commit is contained in:
parent
867159343a
commit
6fb744cdae
34 changed files with 433 additions and 598 deletions
|
@ -1,53 +1,26 @@
|
|||
local M = {
|
||||
"bbjornstad/pretty-fold.nvim",
|
||||
return {
|
||||
"kevinhwang91/nvim-ufo",
|
||||
event = "BufRead",
|
||||
dependencies = "kevinhwang91/promise-async",
|
||||
config = function()
|
||||
vim.o.foldcolumn = "0" -- '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
|
||||
|
||||
vim.keymap.set("n", "zA", require("ufo").openAllFolds, { desc = "Open all folds" })
|
||||
vim.keymap.set("n", "zC", require("ufo").closeAllFolds, { desc = "Close all folds" })
|
||||
vim.keymap.set("n", "zk", function()
|
||||
local winid = require("ufo").peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end, { desc = "Peek Fold" })
|
||||
|
||||
require("ufo").setup({
|
||||
provider_selector = function()
|
||||
return { "lsp", "indent" }
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
M.config = function()
|
||||
local global_setup = {
|
||||
sections = {
|
||||
left = { "content" },
|
||||
right = {
|
||||
" ",
|
||||
function()
|
||||
return ("[%dL]"):format(vim.v.foldend - vim.v.foldstart)
|
||||
end,
|
||||
"[",
|
||||
"percentage",
|
||||
"]",
|
||||
},
|
||||
},
|
||||
matchup_patterns = {
|
||||
{ "{", "}" },
|
||||
{ "%(", ")" },
|
||||
{ "%[", "]" },
|
||||
},
|
||||
process_comment_signs = ({ "delete", "spaces", false })[2],
|
||||
}
|
||||
|
||||
local function ft_setup(lang, options) -- {{{
|
||||
local opts = vim.tbl_deep_extend("force", global_setup, options)
|
||||
if opts and opts.matchup_patterns and global_setup.matchup_patterns then
|
||||
opts.matchup_patterns = vim.list_extend(opts.matchup_patterns, global_setup.matchup_patterns)
|
||||
end
|
||||
require("pretty-fold").ft_setup(lang, opts)
|
||||
end -- }}}
|
||||
|
||||
require("pretty-fold").setup(global_setup)
|
||||
|
||||
ft_setup("lua", {
|
||||
matchup_patterns = {
|
||||
{ "^%s*do$", "end" },
|
||||
{ "^%s*if", "end" },
|
||||
{ "^%s*for", "end" },
|
||||
{ "function[^%(]*%(", "end" },
|
||||
},
|
||||
})
|
||||
|
||||
ft_setup("vim", {
|
||||
matchup_patterns = {
|
||||
{ "^%s*function!?[^%(]*%(", "endfunction" },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue