-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreesitter.lua
More file actions
77 lines (75 loc) · 3.84 KB
/
Copy pathtreesitter.lua
File metadata and controls
77 lines (75 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
return {
{ -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
event = { 'BufReadPost', 'BufNewFile' },
build = ':TSUpdate',
opts = {
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
},
config = function(_, opts)
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
-- Prefer git instead of curl in order to improve connectivity in some environments
require('nvim-treesitter.install').prefer_git = true
---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup(opts)
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
--
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
parser_config.bruno = {
install_info = {
url = '~/tree-sitter-bruno/', -- 'https://github.com/Scalamando/tree-sitter-bruno.git', -- local path or git repo
files = { 'src/parser.c', 'src/scanner.c' }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
branch = 'main', -- default branch in case of git repo if different from master
-- generate_requires_npm = true, -- if stand-alone parser without npm dependencies
-- requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
},
}
parser_config.jinja2 = {
install_info = {
url = 'https://github.com/theHamsta/tree-sitter-jinja2.git', -- 'https://github.com/Scalamando/tree-sitter-bruno.git', -- local path or git repo
files = { 'src/parser.c' }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
-- branch = 'main', -- default branch in case of git repo if different from master
},
filetype = 'jinja',
}
vim.filetype.add {
extension = {
bru = 'bruno',
jinja = 'jinja',
},
}
end,
},
{
'nvim-treesitter/nvim-treesitter-context',
opts = {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 1, -- Maximum number of lines to show for a single context
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
},
},
}