mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 03:47:37 +00:00
Deploy PR #1431 preview
This commit is contained in:
parent
d6d24954b0
commit
be19704dba
4 changed files with 105 additions and 4 deletions
File diff suppressed because one or more lines are too long
|
|
@ -114,7 +114,8 @@
|
||||||
</ul><li><a href="#ch-autocmds-augroups">Autocommands and Autogroups</a>
|
</ul><li><a href="#ch-autocmds-augroups">Autocommands and Autogroups</a>
|
||||||
<ul><li><a href="#sec-vim-augroups">Autogroups (vim.augroups)</a>
|
<ul><li><a href="#sec-vim-augroups">Autogroups (vim.augroups)</a>
|
||||||
<li><a href="#sec-vim-autocmds">Autocommands (vim.autocmds)</a>
|
<li><a href="#sec-vim-autocmds">Autocommands (vim.autocmds)</a>
|
||||||
</li></ul></li>
|
</ul><li><a href="#queries--vim-treesitter-queries">Queries (vim.treesitter.queries)</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
|
@ -609,6 +610,20 @@ Vimscript) for the same autocommand. Choose one.</p>
|
||||||
<p>These definitions are automatically translated into the necessary Lua code to
|
<p>These definitions are automatically translated into the necessary Lua code to
|
||||||
configure <code>vim.api.nvim_create_augroup</code> and <code>vim.api.nvim_create_autocmd</code> when
|
configure <code>vim.api.nvim_create_augroup</code> and <code>vim.api.nvim_create_autocmd</code> when
|
||||||
Neovim starts.</p>
|
Neovim starts.</p>
|
||||||
|
<h1 id="queries--vim-treesitter-queries">Queries (<code>vim.treesitter.queries</code>)</h1>
|
||||||
|
<p>Queries allow you to change Neovim's behavior based on Tree-sitter.<br>
|
||||||
|
Read more about it in the
|
||||||
|
<a href="https://neovim.io/doc/user/treesitter/#_treesitter-queries">neovim docs</a>.</p>
|
||||||
|
<p><strong>Example:</strong></p>
|
||||||
|
<p>In the following example, we are creating a custom injection, to highlight the
|
||||||
|
Lua string after <code>mkLuaInline</code>.</p>
|
||||||
|
<pre class="highlight"><code class="language-nix"><span style="color:rgb(97,175,239);">foo</span> <span style="color:rgb(171,178,191);">=</span> <span style="color:rgb(171,178,191);">mkLuaInline</span> <span style="color:rgb(152,195,121);">''</span><span style="color:rgb(152,195,121);"></span><br><span style="color:rgb(152,195,121);"> function bar()</span><br><span style="color:rgb(152,195,121);"> return 'foobar'</span><br><span style="color:rgb(152,195,121);"> end</span><br><span style="color:rgb(152,195,121);">''</span><span style="color:rgb(132,139,152);">;</span><br></code></pre>
|
||||||
|
<pre class="highlight"><code class="language-nix"><span style="color:rgb(132,139,152);">{</span><br> <span style="color:rgb(86,182,194);">vim</span><span style="color:rgb(132,139,152);">.</span><span style="color:rgb(86,182,194);">treesitter</span><span style="color:rgb(132,139,152);">.</span><span style="color:rgb(86,182,194);">queries</span> <span style="color:rgb(171,178,191);">=</span> <span style="color:rgb(132,139,152);">[</span><span style="color:rgb(132,139,152);">{</span><br> <span style="color:rgb(86,182,194);">type</span> <span style="color:rgb(171,178,191);">=</span> <span style="color:rgb(152,195,121);">"</span><span style="color:rgb(152,195,121);">injections</span><span style="color:rgb(152,195,121);">"</span><span style="color:rgb(132,139,152);">;</span><br> <span style="color:rgb(86,182,194);">filetypes</span> <span style="color:rgb(171,178,191);">=</span> <span style="color:rgb(132,139,152);">[</span><span style="color:rgb(152,195,121);">"</span><span style="color:rgb(152,195,121);">nix</span><span style="color:rgb(152,195,121);">"</span><span style="color:rgb(132,139,152);">]</span><span style="color:rgb(132,139,152);">;</span><br> <span style="color:rgb(86,182,194);">content</span> <span style="color:rgb(171,178,191);">=</span> <span style="color:rgb(152,195,121);">''</span><span style="color:rgb(152,195,121);"></span><br><span style="color:rgb(152,195,121);"> ;; extends</span><br><span style="color:rgb(152,195,121);"></span><br><span style="color:rgb(152,195,121);"> ((apply_expression</span><br><span style="color:rgb(152,195,121);"> function: (variable_expression</span><br><span style="color:rgb(152,195,121);"> name: (identifier) @_func</span><br><span style="color:rgb(152,195,121);"> (#eq? @_func "mkLuaInline"))</span><br><span style="color:rgb(152,195,121);"></span><br><span style="color:rgb(152,195,121);"> argument: (indented_string_expression</span><br><span style="color:rgb(152,195,121);"> (string_fragment) @injection.content)</span><br><span style="color:rgb(152,195,121);"></span><br><span style="color:rgb(152,195,121);"> (#set! injection.language "lua")</span><br><span style="color:rgb(152,195,121);"> (#set! injection.combined)))</span><br><span style="color:rgb(152,195,121);"> </span><span style="color:rgb(152,195,121);">''</span><span style="color:rgb(132,139,152);">;</span><br> <span style="color:rgb(132,139,152);">}</span><span style="color:rgb(132,139,152);">]</span><span style="color:rgb(132,139,152);">;</span><br><span style="color:rgb(132,139,152);">}</span><br></code></pre>
|
||||||
|
<p>This will generate a <code>queries/nix/injections.scm</code> in a Neovim runtime directory.</p>
|
||||||
|
<div class="admonition note">
|
||||||
|
<p class="admonition-title">Note</p>
|
||||||
|
<p>When multiple queries match the same <code>filetype</code> and <code>type</code>, they are merged.</p>
|
||||||
|
</div>
|
||||||
</body></html><!-- deno-fmt-ignore-start --></main>
|
</body></html><!-- deno-fmt-ignore-start --></main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -647,7 +662,8 @@ Neovim starts.</p>
|
||||||
</ul><li><a href="#ch-autocmds-augroups">Autocommands and Autogroups</a>
|
</ul><li><a href="#ch-autocmds-augroups">Autocommands and Autogroups</a>
|
||||||
<ul><li><a href="#sec-vim-augroups">Autogroups (vim.augroups)</a>
|
<ul><li><a href="#sec-vim-augroups">Autogroups (vim.augroups)</a>
|
||||||
<li><a href="#sec-vim-autocmds">Autocommands (vim.autocmds)</a>
|
<li><a href="#sec-vim-autocmds">Autocommands (vim.autocmds)</a>
|
||||||
</li></ul></li>
|
</ul><li><a href="#queries--vim-treesitter-queries">Queries (vim.treesitter.queries)</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
|
||||||
|
|
@ -15228,7 +15228,7 @@
|
||||||
<details class="toc-category">
|
<details class="toc-category">
|
||||||
<summary title="vim.treesitter">
|
<summary title="vim.treesitter">
|
||||||
<span>vim.treesitter</span>
|
<span>vim.treesitter</span>
|
||||||
<span class="toc-count">21</span>
|
<span class="toc-count">25</span>
|
||||||
</summary>
|
</summary>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
|
|
@ -15386,6 +15386,38 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href='#option-vim-treesitter-queries' title="vim.treesitter.queries">
|
||||||
|
queries
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href='#option-vim-treesitter-queries-*-content' title="vim.treesitter.queries.*.content">
|
||||||
|
queries.*.content
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href='#option-vim-treesitter-queries-*-filetypes' title="vim.treesitter.queries.*.filetypes">
|
||||||
|
queries.*.filetypes
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href='#option-vim-treesitter-queries-*-type' title="vim.treesitter.queries.*.type">
|
||||||
|
queries.*.type
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href='#option-vim-treesitter-textobjects-enable' title="vim.treesitter.textobjects.enable">
|
<a href='#option-vim-treesitter-textobjects-enable' title="vim.treesitter.textobjects.enable">
|
||||||
textobjects.enable
|
textobjects.enable
|
||||||
|
|
@ -44113,6 +44145,52 @@ the required grammars to this.</p>
|
||||||
<div class="option-example">Example: <code>["lua" "nix"]</code></div>
|
<div class="option-example">Example: <code>["lua" "nix"]</code></div>
|
||||||
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="option" id="option-vim-treesitter-queries">
|
||||||
|
<h3 class="option-name">
|
||||||
|
<a href="#option-vim-treesitter-queries" class="option-anchor">vim.treesitter.queries</a>
|
||||||
|
<span class="copy-link" title="Copy link to this option"></span>
|
||||||
|
<span class="copy-feedback">Link copied!</span>
|
||||||
|
</h3>
|
||||||
|
<div class="option-type">Type: <code>list of (submodule)</code></div>
|
||||||
|
<div class="option-description"><html><head></head><body><p>A list of Neovim treesitter queries to be registered.</p>
|
||||||
|
</body></html></div>
|
||||||
|
<div class="option-default">Default: <code>[ ]</code></div>
|
||||||
|
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
||||||
|
</div>
|
||||||
|
<div class="option" id="option-vim-treesitter-queries-*-content">
|
||||||
|
<h3 class="option-name">
|
||||||
|
<a href="#option-vim-treesitter-queries-*-content" class="option-anchor">vim.treesitter.queries.*.content</a>
|
||||||
|
<span class="copy-link" title="Copy link to this option"></span>
|
||||||
|
<span class="copy-feedback">Link copied!</span>
|
||||||
|
</h3>
|
||||||
|
<div class="option-type">Type: <code>strings concatenated with "\n"</code></div>
|
||||||
|
<div class="option-description"><html><head></head><body><p>The queries scm script.</p>
|
||||||
|
</body></html></div>
|
||||||
|
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
||||||
|
</div>
|
||||||
|
<div class="option" id="option-vim-treesitter-queries-*-filetypes">
|
||||||
|
<h3 class="option-name">
|
||||||
|
<a href="#option-vim-treesitter-queries-*-filetypes" class="option-anchor">vim.treesitter.queries.*.filetypes</a>
|
||||||
|
<span class="copy-link" title="Copy link to this option"></span>
|
||||||
|
<span class="copy-feedback">Link copied!</span>
|
||||||
|
</h3>
|
||||||
|
<div class="option-type">Type: <code>list of string</code></div>
|
||||||
|
<div class="option-description"><html><head></head><body><p>The filetypes for which the query should be registered.</p>
|
||||||
|
</body></html></div>
|
||||||
|
<div class="option-default">Default: <code>[ ]</code></div>
|
||||||
|
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
||||||
|
</div>
|
||||||
|
<div class="option" id="option-vim-treesitter-queries-*-type">
|
||||||
|
<h3 class="option-name">
|
||||||
|
<a href="#option-vim-treesitter-queries-*-type" class="option-anchor">vim.treesitter.queries.*.type</a>
|
||||||
|
<span class="copy-link" title="Copy link to this option"></span>
|
||||||
|
<span class="copy-feedback">Link copied!</span>
|
||||||
|
</h3>
|
||||||
|
<div class="option-type">Type: <code>one of "injections", "highlights", "folds", "locals", "indents"</code></div>
|
||||||
|
<div class="option-description"><html><head></head><body><p>The kind of query to register.</p>
|
||||||
|
</body></html></div>
|
||||||
|
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/treesitter/treesitter.nix" target="_blank"><nvf/modules/plugins/treesitter/treesitter.nix></a></code></div>
|
||||||
|
</div>
|
||||||
<div class="option" id="option-vim-treesitter-textobjects-enable">
|
<div class="option" id="option-vim-treesitter-textobjects-enable">
|
||||||
<h3 class="option-name">
|
<h3 class="option-name">
|
||||||
<a href="#option-vim-treesitter-textobjects-enable" class="option-anchor">vim.treesitter.textobjects.enable</a>
|
<a href="#option-vim-treesitter-textobjects-enable" class="option-anchor">vim.treesitter.textobjects.enable</a>
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,13 @@ formatter.</p>
|
||||||
<p><a href="https://github.com/snoweuph">Snoweuph</a></p>
|
<p><a href="https://github.com/snoweuph">Snoweuph</a></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
<p>Added <a class="option-reference" href="options.html#option-vim-treesitter-queries"><code class="nixos-option">vim.treesitter.queries</code></a> to support adding custom queries.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Added injections for <code>vim.treesitter.queries.*.content</code> as <code>query</code> and
|
||||||
|
<code>mkLualine ""</code> as <code>lua</code>.</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
<p>Added <code>vim.lsp.presets.<name></code> to contain LSP configurations. This allows for
|
<p>Added <code>vim.lsp.presets.<name></code> to contain LSP configurations. This allows for
|
||||||
more flexibility in nvf and reuse of LSPs across languages. Dropped
|
more flexibility in nvf and reuse of LSPs across languages. Dropped
|
||||||
<code>deprecatedSingleOrListOf</code> in favor of <code>listOf</code> for the affected LSP options.</p>
|
<code>deprecatedSingleOrListOf</code> in favor of <code>listOf</code> for the affected LSP options.</p>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue