"nvim-lspconfig": { "branch": "master", "commit": "a2bd1cf7b0446a7414aaf373cea5e4ca804c9c69" },
"nvim-navic": { "branch": "master", "commit": "7d914a39a1ef8f4e22c2c4381abeef7c556f5a13" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
+ "nvim-origami": { "branch": "main", "commit": "ad252be766e7d07e0f1998d84deadb972736db08" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
opt.updatetime = 200 -- Save swap file and trigger CursorHold
opt.splitkeep = "screen"
opt.shortmess:append({ C = true })
-opt.foldmethod = "expr"
-opt.foldexpr = "v:lua.require'rmz.util'.foldexpr()"
-- do not let markdown plugin change indent
vim.g.markdown_recommended_style = 0
end,
},
},
+ { "chrisgrieser/nvim-origami", -- fold with elegance
+ event = "VeryLazy",
+ opts = {
+ foldKeymaps = { setup = false },
+ foldtext = {
+ padding = 1,
+ lineCount = {
+ template = "… %d lines"
+ }
+ }
+ },
+ init = function()
+ -- disable vim's folding
+ vim.opt.foldlevel = 99
+ vim.opt.foldlevelstart = 99
+ end
+ },
-- TODO: currently unused plugins, check and enable/remove
{ "MagicDuck/grug-far.nvim", enabled = false,
return ret
end
-function M.foldexpr()
- local buf = vim.api.nvim_get_current_buf()
- if vim.b[buf].ts_folds == nil then
- -- as long as we don't have a filetype, don't bother
- -- checking if treesitter is available (it won't)
- if vim.bo[buf].filetype == "" then
- return "0"
- end
- if vim.bo[buf].filetype:find("dashboard") then
- vim.b[buf].ts_folds = false
- else
- vim.b[buf].ts_folds = pcall(vim.treesitter.get_parser, buf)
- end
- end
- return vim.b[buf].ts_folds and vim.treesitter.foldexpr() or "0"
-end
-
return M
endfunction
command! -nargs=* -complete=file -bang Debug call <SID>Debug() | Termdebug<bang> <args>
command! -nargs=+ -complete=file -bang DebugCommand call <SID>Debug() | TermdebugCommand<bang> <args>
-
-setlocal foldmethod=syntax
-" set foldlevel according to number of matches of 'namespace' and 'class' not
-" containing ';'
-function! InitialFoldLevel()
- let v:errmsg = ""
- keepjumps keeppatterns silent! 1,/}/s/^\(namespace\|class\) \+[^;]*$//n
- if v:errmsg == ""
- let &l:foldlevel=str2nr(split(v:statusmsg)[0])
- endif
-endf
-call InitialFoldLevel()
-
-function! MyCppFoldText()
- let l:line = getline(v:foldstart)
- " expand tabs in line, foldtext does not do it on its own
- let l:line = substitute(l:line, "\t", repeat(" ", shiftwidth()), "g")
- let l:width = min([&textwidth, winwidth(0)])
- let l:lineinfo = printf("%d", v:foldend - v:foldstart)
- let l:ellipsis = "…"
- return printf("%.*s%s%*d",
- \ l:width - strdisplaywidth(l:ellipsis..l:lineinfo), l:line,
- \ l:ellipsis,
- \ l:width - strdisplaywidth(l:line..l:ellipsis), l:lineinfo)
-endfunction
-setlocal foldtext=MyCppFoldText()
-setlocal fillchars+=fold:\