1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 18:38:00 +00:00

[neovim] Add ufo/statuscol

This commit is contained in:
Daniel Carrillo 2023-07-03 19:16:19 +02:00
parent a5f849c30e
commit 3f298771a5
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
5 changed files with 48 additions and 2 deletions

View File

@ -36,7 +36,6 @@ vim.opt.wrap = false -- display lines as one long line
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
vim.opt.sidescrolloff = 8 vim.opt.sidescrolloff = 8
vim.opt.guifont = "monospace:h10" -- the font used in graphical neovim applications vim.opt.guifont = "monospace:h10" -- the font used in graphical neovim applications
vim.opt.fillchars.eob = " "
vim.opt.shortmess:append("c") vim.opt.shortmess:append("c")
vim.opt.whichwrap:append("<,>,[,],h,l") vim.opt.whichwrap:append("<,>,[,],h,l")
vim.opt.iskeyword:append("-") vim.opt.iskeyword:append("-")
@ -44,5 +43,11 @@ vim.opt.formatoptions:remove({ "c", "r", "o" })
vim.opt.linebreak = true vim.opt.linebreak = true
vim.opt.numberwidth = 1 vim.opt.numberwidth = 1
vim.opt.foldenable = true
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldcolumn = "1"
vim.opt.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:,diff: ]]
-- experimental -- experimental
vim.opt.cmdheight = 0 -- Number of screen lines to use for the command-line vim.opt.cmdheight = 0 -- Number of screen lines to use for the command-line

View File

@ -173,4 +173,31 @@ require("lazy").setup({
end, end,
ft = { "markdown" }, ft = { "markdown" },
}, },
-- Folding
{
"kevinhwang91/nvim-ufo",
dependencies = {
"kevinhwang91/promise-async",
{
"luukvbaal/statuscol.nvim",
config = function()
local builtin = require("statuscol.builtin")
require("statuscol").setup({
relculright = true,
segments = {
{
text = {
builtin.foldfunc,
},
click = "v:lua.ScFa",
},
{ text = { "%s" }, click = "v:lua.ScSa" },
{ text = { builtin.lnumfunc, " " }, click = "v:lua.ScLa" },
},
})
end,
},
},
},
}, lazy_opts) }, lazy_opts)

View File

@ -6,4 +6,4 @@ require("diffview").setup({
}, },
}) })
vim.opt.fillchars = "diff: " -- vim.opt.fillchars = "diff: "

View File

@ -21,3 +21,4 @@ require("plugins.markdowntoc")
require("plugins.projections") require("plugins.projections")
require("plugins.diffview") require("plugins.diffview")
require("plugins.align") require("plugins.align")
require("plugins.ufo")

View File

@ -0,0 +1,13 @@
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
})
local keymap = vim.keymap.set
-- Code Folding
-- keymap("n", "zR", require("ufo").openAllFolds, { desc = "Open all folds" })
-- keymap("n", "zM", require("ufo").closeAllFolds, { desc = "Close all folds" })
keymap("n", "zr", require("ufo").openFoldsExceptKinds, { desc = "Fold less" })
keymap("n", "zm", require("ufo").closeFoldsWith, { desc = "Fold more" })
keymap("n", "zp", require("ufo").peekFoldedLinesUnderCursor, { desc = "Peek fold" })