
Folding files and persisting folds · LazyVim LazyVim - GitHub
2023年8月21日 · Here is a recipe for setting up folding with LazyVim. I set fondnextmax to 1 so only the top level functions are folded. This works for me but change as you see fit. pattern = "*.*", callback = function() vim.cmd.mkview() end, group = save_fold, pattern = "*.*", callback = function() vim.cmd.loadview({ mods = { emsg_silent = true } }) end,
Fold - Neovim docs
4 天之前 · To increase the fold level of a fold for a range of lines, define a fold inside it that has the same lines. The manual folds are lost when you abandon the file. To save the folds use the :mkview command. The view can be restored later with :loadview. The folds are automatically defined by the indent of the lines.
Vim: How to keep folds on save? - Stack Overflow
2019年3月25日 · You can save your current folds; when you finish editing a file, before exiting vim, enter the command :mkview. When you next open the file, if you enter :loadview, it will restore your folds. If you want this to happen automatically, add this code to your vimrc augroup remember_folds autocmd! autocmd BufWinLeave * mkview
Regression: saving buffer will affect folding · Issue #30 ... - GitHub
2022年6月30日 · As soon as one saves the buffer, all folds will be reset (or everything gets closed in my case) as per foldlevel. So, provided treesitter fold provider is used, how am I supposed to stop all the folds reset?
Persistent folds between Vim sessions - Today I Learned
2016年2月23日 · The solution is quite simple - when you are ready to save your folds run the :mkview command. This will save your folds in the current buffer to your viewdir (:h viewdir) depending on your environment.
[QUESTION] is there a way to get advanced folding that can save …
2022年9月26日 · You can auto save fold states, the method is using autocommands to do :mkview when leaving a buffer and :loadview when the buffer is opened, here is an SO answer I found for setting it up:
folding - Can I save folds? - Vi and Vim Stack Exchange
2018年12月4日 · An easy to fold the legacy codes permanently is to use the foldmethod of "marker". You can enclose the codes with the markers " { { {" and "}}}", and add a modeline to the file, like: /* vim: set foldmethod=marker : */
Automatically load & save folds of files - except for help files
2021年1月10日 · My current solution to automatically load & save views of a file is the following: " automatically saves & loads folds when closing or opening a file set viewoptions-=options augroup
How to save a view (with folds) into the file? - Vi and Vim Stack Exchange
Is it possible to save folds (the view) into the text file I'm editting? If not then maybe I can write a rule that will save the view into something like .%.view (dot filename dot view) ?
How to save folds in Vim after changing the foldmethod to diff?
2021年6月23日 · :h fold-manual mentions :mkview and :loadview, which can save the folds and then restore them.