mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-09 00:45:09 +00:00
Deploy PR #1545 preview
This commit is contained in:
parent
2db790ded0
commit
5bd5a2a1d8
4 changed files with 84 additions and 19 deletions
File diff suppressed because one or more lines are too long
|
|
@ -606,7 +606,7 @@ Read more about it in the
|
|||
<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>
|
||||
<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);">query</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>
|
||||
|
|
|
|||
|
|
@ -5335,7 +5335,7 @@
|
|||
<details class="toc-category">
|
||||
<summary title="vim.languages">
|
||||
<span>vim.languages</span>
|
||||
<span class="toc-count">514</span>
|
||||
<span class="toc-count">515</span>
|
||||
</summary>
|
||||
<ul>
|
||||
|
||||
|
|
@ -6917,6 +6917,14 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.languages.jinja.treesitter.injection' title="vim.languages.jinja.treesitter.injection">
|
||||
jinja.treesitter.injection
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.languages.jinja.treesitter.inlinePackage' title="vim.languages.jinja.treesitter.inlinePackage">
|
||||
jinja.treesitter.inlinePackage
|
||||
|
|
@ -15385,7 +15393,7 @@
|
|||
<details class="toc-category">
|
||||
<summary title="vim.treesitter">
|
||||
<span>vim.treesitter</span>
|
||||
<span class="toc-count">25</span>
|
||||
<span class="toc-count">26</span>
|
||||
</summary>
|
||||
<ul>
|
||||
|
||||
|
|
@ -15495,6 +15503,14 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.treesitter.filetypeMappings' title="vim.treesitter.filetypeMappings">
|
||||
filetypeMappings
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.treesitter.fold' title="vim.treesitter.fold">
|
||||
fold
|
||||
|
|
@ -15552,16 +15568,16 @@
|
|||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.treesitter.queries._.content' title="vim.treesitter.queries.*.content">
|
||||
queries.*.content
|
||||
<a href='#option-vim.treesitter.queries._.filetypes' title="vim.treesitter.queries.*.filetypes">
|
||||
queries.*.filetypes
|
||||
|
||||
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href='#option-vim.treesitter.queries._.filetypes' title="vim.treesitter.queries.*.filetypes">
|
||||
queries.*.filetypes
|
||||
<a href='#option-vim.treesitter.queries._.query' title="vim.treesitter.queries.*.query">
|
||||
queries.*.query
|
||||
|
||||
|
||||
</a>
|
||||
|
|
@ -30344,6 +30360,18 @@ not listed in the docs</p>
|
|||
<div class="option-example">Example: <code>true</code></div>
|
||||
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/languages/jinja.nix" target="_blank"><nvf/modules/plugins/languages/jinja.nix></a></code></div>
|
||||
</div>
|
||||
<div class="option" id="option-vim.languages.jinja.treesitter.injection">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.languages.jinja.treesitter.injection" class="option-anchor">vim.languages.jinja.treesitter.injection</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>string</code></div>
|
||||
<div class="option-description"><html><head></head><body><p>Treesitter language to inject in Jinja templates</p>
|
||||
</body></html></div>
|
||||
<div class="option-default">Default: <code>"html"</code></div>
|
||||
<div class="option-declared">Declared in: <code><a href="https://github.com/NotAShelf/nvf/blob/main/modules/plugins/languages/jinja.nix" target="_blank"><nvf/modules/plugins/languages/jinja.nix></a></code></div>
|
||||
</div>
|
||||
<div class="option" id="option-vim.languages.jinja.treesitter.inlinePackage">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.languages.jinja.treesitter.inlinePackage" class="option-anchor">vim.languages.jinja.treesitter.inlinePackage</a>
|
||||
|
|
@ -44491,6 +44519,26 @@ there are at least 2 lines above cursorline.</p>
|
|||
<div class="option-example">Example: <code>true</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.filetypeMappings">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.treesitter.filetypeMappings" class="option-anchor">vim.treesitter.filetypeMappings</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>attribute set of list of string</code></div>
|
||||
<div class="option-description"><html><head></head><body><p>For each parser, registers a list of alternative filetypes.
|
||||
For more information see <code>:h vim.treesitter.language.register()</code>.
|
||||
See treesitter builtin mappings here: <<a href="https://github.com/nvim-treesitter/nvim-treesitter/blob/main/plugin/filetypes.lua">https://github.com/nvim-treesitter/nvim-treesitter/blob/main/plugin/filetypes.lua</a>></p>
|
||||
</body></html></div>
|
||||
<div class="option-default">Default: <code>{ }</code></div>
|
||||
<div class="option-example">Example: <pre><code>{
|
||||
sh = [
|
||||
"ash"
|
||||
"dash"
|
||||
];
|
||||
}</code></pre></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.fold">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.treesitter.fold" class="option-anchor">vim.treesitter.fold</a>
|
||||
|
|
@ -44591,17 +44639,6 @@ the required grammars to this.</p>
|
|||
<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>
|
||||
|
|
@ -44614,6 +44651,17 @@ the required grammars to this.</p>
|
|||
<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._.query">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.treesitter.queries._.query" class="option-anchor">vim.treesitter.queries.*.query</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._.type">
|
||||
<h3 class="option-name">
|
||||
<a href="#option-vim.treesitter.queries._.type" class="option-anchor">vim.treesitter.queries.*.type</a>
|
||||
|
|
|
|||
|
|
@ -468,14 +468,31 @@ formatter.</p>
|
|||
<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>, <code>entryAnywhere</code>, <code>entryBefore</code>, <code>entryAfter</code> as <code>lua</code> in nix.</p>
|
||||
<p>Added injections for <code>query = '' ... ''</code> as <code>query</code> and <code>mkLualine '' ... ''</code>,
|
||||
<code>entryAnywhere '' ... ''</code>, <code>entryBefore ] '' ... ''</code>,
|
||||
<code>entryAfter ] '' ... ''</code> as <code>lua</code> in nix.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added <a class="option-reference" href="options.html#option-vim.languages.tera.treesitter.injection"><code class="nixos-option">vim.languages.tera.treesitter.injection</code></a> to configure, what
|
||||
language the content is.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added <a class="option-reference" href="options.html#option-vim.languages.jinja.treesitter.injection"><code class="nixos-option">vim.languages.jinja.treesitter.injection</code></a> to configure, what
|
||||
language the content is.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added <a class="option-reference" href="options.html#option-vim.treesitter.filetypeMappings"><code class="nixos-option">vim.treesitter.filetypeMappings</code></a> to support mappings similar to
|
||||
<a href="https://github.com/nvim-treesitter/nvim-treesitter/blob/main/plugin/filetypes.lua">https://github.com/nvim-treesitter/nvim-treesitter/blob/main/plugin/filetypes.lua</a>.
|
||||
This is mostly use full for Markdown code block injections.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>Added some Tree-sitter filetype mappings for:</p>
|
||||
<ul>
|
||||
<li><code>bash</code> = <code>ash</code>, <code>dash</code>, <code>zsh</code></li>
|
||||
<li><code>yaml</code> = <code>yaml</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<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
|
||||
<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