fix(nvim): MDX treesitter
REF: https://phelipetls.github.io/posts/mdx-syntax-highlight-treesitter-nvim/
This commit is contained in:
parent
f05a829156
commit
7d4f61cff3
3 changed files with 18 additions and 1 deletions
3
.config/nvim/after/queries/markdown/highlights.scm
Normal file
3
.config/nvim/after/queries/markdown/highlights.scm
Normal file
|
@ -0,0 +1,3 @@
|
|||
; extends
|
||||
((inline) @_inline (#lua-match? @_inline "^%s*import")) @nospell
|
||||
((inline) @_inline (#lua-match? @_inline "^%s*export")) @nospell
|
7
.config/nvim/after/queries/markdown/injections.scm
Normal file
7
.config/nvim/after/queries/markdown/injections.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
; extends
|
||||
((inline) @injection.content
|
||||
(#lua-match? @injection.content "^%s*import")
|
||||
(#set! injection.language "typescript"))
|
||||
((inline) @injection.content
|
||||
(#lua-match? @injection.content "^%s*export")
|
||||
(#set! injection.language "typescript"))
|
|
@ -35,7 +35,8 @@ return {
|
|||
},
|
||||
},
|
||||
config = function (_, opts)
|
||||
local config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
local parsers = require("nvim-treesitter.parsers")
|
||||
local config = parsers.get_parser_configs()
|
||||
config.gsp = {
|
||||
install_info = {
|
||||
url = "https://git.sr.ht/~mango/tree-sitter-gsp",
|
||||
|
@ -63,6 +64,12 @@ return {
|
|||
[".*/hypr/.*%.conf"] = "hyprlang",
|
||||
},
|
||||
})
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
mdx = "mdx"
|
||||
}
|
||||
})
|
||||
vim.treesitter.language.register("markdown", "mdx")
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue