Nvim-treesitter configuration: Difference between revisions
From wikinotes
(Created page with "= Modules = <blockquote> Enable modules within your <code>init.nvim</code> <syntaxhighlight lang="vim"> # ~/.config/nvim/init.vim lua <<EOF require'nvim-treesitter.configs'....") |
No edit summary |
||
Line 1: | Line 1: | ||
= Modules = | = Enabling Features = | ||
<blockquote> | |||
== Modules == | |||
<blockquote> | <blockquote> | ||
Enable modules within your <code>init.nvim</code> | Enable modules within your <code>init.nvim</code> | ||
Line 28: | Line 30: | ||
</blockquote><!-- Modules --> | </blockquote><!-- Modules --> | ||
= Folds = | == Folds == | ||
<blockquote> | <blockquote> | ||
Adjust the foldmethods/foldexprs for languages you'd like to fold using tree-sitter. | Adjust the foldmethods/foldexprs for languages you'd like to fold using tree-sitter. | ||
Line 37: | Line 39: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Folds --> | </blockquote><!-- Folds --> | ||
</blockquote><!-- Enabling Features --> | |||
= Customizing Features = | |||
<blockquote> | |||
== Basics == | |||
<blockquote> | |||
Default configuration of features is set within the [https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries queries] directory in <code>.scm</code> files.<br> | |||
In the code, these are read using [https://neovim.io/doc/user/api.html#API nvim_get_runtime_file] which layers files from <code>~/.vim</code> overtop of these files.<br> | |||
Simply override the settings within your .vim directory. | |||
</blockquote><!-- Basics --> | |||
== Folds == | |||
<blockquote> | |||
</blockquote><!-- Folds --> | |||
</blockquote><!-- Customizing Features --> | |||
https://neovim.io/doc/user/api.html#API |
Revision as of 03:06, 18 July 2021
Enabling Features
Modules
Enable modules within your
init.nvim
# ~/.config/nvim/init.vim lua <<EOF require'nvim-treesitter.configs'.setup { highlight = { enable = true, -- when true, enables vim syntaxhighlighting alongside tree-sitters -- true/false or a list of languages additional_vim_regex_highlighting = false, }, incremental_selection = { enable = true; }, indent = { enable = true; }, } EOFFolds
Adjust the foldmethods/foldexprs for languages you'd like to fold using tree-sitter.
set foldmethod=expr set foldexpr=nvim_treesitter#foldexpr()
Customizing Features
Basics
Default configuration of features is set within the queries directory in
.scm
files.
In the code, these are read using nvim_get_runtime_file which layers files from~/.vim
overtop of these files.
Simply override the settings within your .vim directory.Folds