Nvim-treesitter configuration

From wikinotes
Revision as of 21:15, 17 July 2021 by Will (talk | contribs) (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'....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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;
  },
}
EOF

Folds

Adjust the foldmethods/foldexprs for languages you'd like to fold using tree-sitter.

set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()