-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsyntax.lua
More file actions
125 lines (112 loc) · 3.44 KB
/
syntax.lua
File metadata and controls
125 lines (112 loc) · 3.44 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
----------------------
-- Syntax Highlighting
----------------------
return function(use)
-- Better Folding
-- I *used to* use nvim-ufo, but it was really buggy.
-- It would randomly fold things I wasn't expecting.
-- - search results
-- - neo-tree folders
--
-- It would also regularly break.
-- Now I just use treesitter for folding.
-- autoclose and autorename tags
use {
-- 'windwp/nvim-ts-autotag',
'NullVoxPopuli/nvim-ts-autotag',
branch = 'patch-1',
config = function()
require('nvim-ts-autotag').setup({
opts = {
-- Defaults
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false -- Auto close on trailing </
},
-- Also override individual filetype configs, these take priority.
-- Empty by default, useful if one of the "opts" global settings
-- doesn't work well in a specific filetype
per_filetype = {
-- ["html"] = {
-- enable_close = false
-- }
},
})
end,
}
use {
-- NOTE: this repo is working on a breaking change.
-- it's pretty big and can't be tried out right now.
-- a bunch of other plugins break.
--
-- (main is also super buggy right now)
'nvim-treesitter/nvim-treesitter',
branch = "main",
config = function()
require('nvim-treesitter').install({
-- Many handled by ember.nvim
-- Web Framework Languages
"svelte",
-- Web Transport Languages
"graphql",
-- "help", -- missing?
-- "comment", -- slow?
-- Configuration Languages
"toml", "json", "yaml",
"dockerfile",
"lua", "vim", "hyprlang",
"hcl", "terraform",
-- Scripting Languages
"commonlisp",
"bash",
"jq",
-- Languages I don't know how to categorize
"ruby",
-- Systems Languages
"c", "cmake",
"rust",
"go",
-- Specifically for the treesitter AST
"query",
-- Utility Syntaxes
"diff",
"jq",
"git_rebase", "gitcommit", "gitignore"
})
vim.api.nvim_create_autocmd('FileType', {
pattern = {
'markdown',
'scss',
'json', 'jq', 'bash', 'c', 'go', 'rust', 'diff',
'svelte', 'graphql', 'toml', 'yaml', 'dockerfile',
},
callback = function()
-- Folding
vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.wo[0][0].foldmethod = 'expr'
-- indentation
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
-- Fancy!
vim.treesitter.start()
end,
})
require("nvim-treesitter.install").prefer_git = true
require('ts_context_commentstring').setup({})
vim.g.skip_ts_context_commentstring_module = true
vim.treesitter.language.register('html', 'html.edge')
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
end
}
-- Useful for large functions or in unfamiliar code
use 'nvim-treesitter/nvim-treesitter-context'
-- Comments in embedded languages via treesitter
use { 'JoosepAlviste/nvim-ts-context-commentstring',
config = function()
require('ts_context_commentstring').setup {
enable_autocmd = false,
}
end
}
end