mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 09:18:59 +00:00
21 lines
11 KiB
HTML
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: [ ['$','$'], ['\(','\)'] ],
|
||
|
displayMath: [ ['$$','$$'], ['[',']'] ]
|
||
|
},
|
||
|
options = {
|
||
|
processHtmlClass = "math"
|
||
|
}
|
||
|
}
|
||
|
</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
|