wiki/editor.neovim.folds.html
2022-07-29 15:41:17 +00:00

21 lines
11 KiB
HTML

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Neovim folds</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
MathJax = {
tex: {
inlineMath: [ [&#x27;$&#x27;,&#x27;$&#x27;], [&#x27;\(&#x27;,&#x27;\)&#x27;] ],
displayMath: [ [&#x27;$$&#x27;,&#x27;$$&#x27;], [&#x27;[&#x27;,&#x27;]&#x27;] ]
},
options = {
processHtmlClass = &quot;math&quot;
}
}
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>Neovim folds</h1><section class="post-metadata"><span>Date: <!-- -->2022-04-03 16:59:05 +08:00</span><span>Date modified: <!-- -->2022-04-03 16:59:24 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><ul><li><p>it is a built-in feature in Neovim;
enables you to quickly navigate a long document by hiding them and opening them when you want
</p></li><li><p>some keybindings for managing folds
</p><table><thead><tr><th>Keymap</th><th>Description</th></tr></thead><tbody><tr><td><code class="inline-code">zf</code></td><td>Create a fold.</td></tr><tr><td><code class="inline-code">zA</code></td><td>Toggle a fold recursively.</td></tr><tr><td><code class="inline-code">zM</code></td><td>Close all folds.</td></tr><tr><td><code class="inline-code">zR</code></td><td>Open all folds.</td></tr><tr><td><code class="inline-code">zj</code></td><td>Move one fold down.</td></tr><tr><td><code class="inline-code">zk</code></td><td>Move one fold up.</td></tr></tbody></table></li><li><p>while in insert mode, there are no folds under your cursor so you can see what you type
</p></li><li><p>while manually managing folds can be tedious, Neovim does have a way to automatically manage folds for you;
this is dictated through the <code class="inline-code">foldmethod</code> variable;
for more information for the following methods, see <code class="inline-code">fold-${VALUE}</code> with the <a href="/wiki/editor.neovim.help-system">Neovim help system</a></p><ul><li><p>with <code class="inline-code">manual</code> value, no additional actions are done
</p></li><li><p>with <code class="inline-code">marker</code> value, a fold will be created ala-HTML markers
</p></li><li><p>with <code class="inline-code">expr</code> value, a fold will be managed through its fold level evaluated from <code class="inline-code">foldexpr</code> function;
certain tools like <a href="https://github.com/nvim-treesitter/nvim-treesitter">nvim-treesitter</a> takes advantage of this to arrange the code through its blocks, scope, etc.
</p></li></ul></li></ul></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2022-04-03 16:59:05 +08:00","date_modified":"2022-04-03 16:59:24 +08:00","language":"en","source":""},"title":"Neovim folds","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"it is a built-in feature in Neovim;\n enables you to quickly navigate a long document by hiding them and opening them when you want\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"some keybindings for managing folds\n"}]},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Keymap"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zf"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Create a fold."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zA"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Toggle a fold recursively."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zM"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Close all folds."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zR"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Open all folds."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zj"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Move one fold down."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"zk"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Move one fold up."}]}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"while in insert mode, there are no folds under your cursor so you can see what you type\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"while manually managing folds can be tedious, Neovim does have a way to automatically manage folds for you;\n this is dictated through the "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"foldmethod"}]},{"type":"text","value":" variable;\n for more information for the following methods, see "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"fold-${VALUE}"}]},{"type":"text","value":" with the "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.help-system"},"children":[{"type":"text","value":"Neovim help system"}]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"with "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"manual"}]},{"type":"text","value":" value, no additional actions are done\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"with "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"marker"}]},{"type":"text","value":" value, a fold will be created ala-HTML markers\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"with "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"expr"}]},{"type":"text","value":" value, a fold will be managed through its fold level evaluated from "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"foldexpr"}]},{"type":"text","value":" function;\n certain tools like "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/nvim-treesitter/nvim-treesitter"},"children":[{"type":"text","value":"nvim-treesitter"}]},{"type":"text","value":" takes advantage of this to arrange the code through its blocks, scope, etc.\n"}]}]}]}]}]}]},"backlinks":[]},"__N_SSG":true},"page":"/[[...slug]]","query":{"slug":["editor.neovim.folds"]},"buildId":"Ie9t5zutrXP6Of75Cb5xF","assetPrefix":"/wiki","nextExport":false,"isFallback":false,"gsp":true}</script><script nomodule="" src="/wiki/_next/static/chunks/polyfills-99d808df29361cf7ffb1.js"></script><script src="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" async=""></script><script src="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" async=""></script><script src="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" async=""></script><script src="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" async=""></script><script src="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" async=""></script><script src="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" async=""></script><script src="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_buildManifest.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_ssgManifest.js" async=""></script></body></html>