mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 01:57:54 +00:00
17 lines
10 KiB
HTML
17 lines
10 KiB
HTML
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>Neovim Lua modules</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 Lua modules</h1><section class="post-metadata"><span>Date: <!-- -->2022-04-20 18:36:23 +08:00</span><span>Date modified: <!-- -->2022-04-20 18:39:40 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><ul><li><p>Neovim will load the requires files from its runtime paths;
|
|
see <code class="inline-verbatim">runtimepath</code> from the <a href="/wiki/editor.neovim.help-system">Neovim help system</a></p></li><li><p>built on top of the already existing <a href="/wiki/lang.lua.modules">Lua modules</a> system
|
|
</p></li><li><p>while searching for the runtime paths, Neovim will search for certain folders
|
|
</p><ul><li><p><code class="inline-verbatim">plugin/</code> will load all of the Lua files that are placed in that subdirectory
|
|
</p></li><li><p><code class="inline-verbatim">lua/</code> also contains Lua files but does not automatically load until some other module will call <code class="inline-code">require</code> to that module
|
|
</p></li><li><p><code class="inline-verbatim">init.lua</code> is basically the <code class="inline-verbatim">index.html</code> for HTML files, <code class="inline-verbatim">default.nix</code> for <a href="/wiki/lang.nix">Nix language</a>, or <code class="inline-verbatim">mod.rs</code> for <a href="/wiki/lang.rust">Rust language</a></p></li></ul></li><li><p>in module names that are <code class="inline-code">require</code>'d, <code class="inline-verbatim">.</code> is treated as a separator and representing as a directory in the file tree;
|
|
e.g., when running <code class="inline-code">require("custom.plugins")</code>, <code class="inline-verbatim">custom.plugins</code> should have a module at <code class="inline-verbatim">$RUNTIMEPATH/lua/custom/plugins/init.lua</code></p></li><li><p>at some point, Neovim can make use of more Lua modules with <a href="https://luarocks.org/">Luarocks</a></p></li></ul><section><h2>Backlinks</h2><ul><li><a href="/wiki/editor.neovim.lua">Neovim Lua integration</a></li></ul></section></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2022-04-20 18:36:23 +08:00","date_modified":"2022-04-20 18:39:40 +08:00","language":"en","source":""},"title":"Neovim Lua modules","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":"Neovim will load the requires files from its runtime paths;\n see "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"runtimepath"}]},{"type":"text","value":" from the "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.help-system"},"children":[{"type":"text","value":"Neovim help system"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"built on top of the already existing "},{"type":"element","tagName":"a","properties":{"href":"/lang.lua.modules"},"children":[{"type":"text","value":"Lua modules"}]},{"type":"text","value":" system\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"while searching for the runtime paths, Neovim will search for certain folders\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"plugin/"}]},{"type":"text","value":" will load all of the Lua files that are placed in that subdirectory\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua/"}]},{"type":"text","value":" also contains Lua files but does not automatically load until some other module will call "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"require"}]},{"type":"text","value":" to that module\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"init.lua"}]},{"type":"text","value":" is basically the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"index.html"}]},{"type":"text","value":" for HTML files, "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"default.nix"}]},{"type":"text","value":" for "},{"type":"element","tagName":"a","properties":{"href":"/lang.nix"},"children":[{"type":"text","value":"Nix language"}]},{"type":"text","value":", or "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"mod.rs"}]},{"type":"text","value":" for "},{"type":"element","tagName":"a","properties":{"href":"/lang.rust"},"children":[{"type":"text","value":"Rust language"}]}]}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"in module names that are "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"require"}]},{"type":"text","value":"'d, "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":" is treated as a separator and representing as a directory in the file tree;\n e.g., when running "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"require(\"custom.plugins\")"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"custom.plugins"}]},{"type":"text","value":" should have a module at "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"$RUNTIMEPATH/lua/custom/plugins/init.lua"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"at some point, Neovim can make use of more Lua modules with "},{"type":"element","tagName":"a","properties":{"href":"https://luarocks.org/"},"children":[{"type":"text","value":"Luarocks"}]}]}]}]}]},"backlinks":[{"path":"/editor.neovim.lua","title":"Neovim Lua integration"}]},"__N_SSG":true},"page":"/[[...slug]]","query":{"slug":["editor.neovim.lua-modules"]},"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> |