I have no idea what I'm doing
This commit is contained in:
parent
9c780880fa
commit
ec8579d599
4 changed files with 1 additions and 51 deletions
|
|
@ -1 +0,0 @@
|
||||||
autocmd VimEnter,BufWinEnter,BufRead,BufNewFile *.pg setlocal filetype=perga
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
local is_windows
|
|
||||||
if jit ~= nil then
|
|
||||||
is_windows = jit.os == "Windows"
|
|
||||||
else
|
|
||||||
is_windows = package.config:sub(1, 1) == "\\"
|
|
||||||
end
|
|
||||||
|
|
||||||
local join_paths = function(...)
|
|
||||||
local separator
|
|
||||||
if is_windows then
|
|
||||||
separator = "\\"
|
|
||||||
else
|
|
||||||
separator = "/"
|
|
||||||
end
|
|
||||||
return table.concat({ ... }, separator)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup(arg)
|
|
||||||
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
|
||||||
parser_config.perga = {
|
|
||||||
install_info = {
|
|
||||||
url = arg['local'] and join_paths(
|
|
||||||
vim.fn.stdpath('data'),
|
|
||||||
'site',
|
|
||||||
'pack',
|
|
||||||
'packer',
|
|
||||||
'start',
|
|
||||||
'tree-sitter-perga'
|
|
||||||
) or 'https://forgejo.ballcloud.cc/wball/tree-sitter-perga',
|
|
||||||
files = { 'src/parser.c' },
|
|
||||||
branch = 'main',
|
|
||||||
},
|
|
||||||
maintainers = { '@wball' }
|
|
||||||
}
|
|
||||||
local ok, ft = pcall(require, 'filetype')
|
|
||||||
if ok then
|
|
||||||
ft.setup({
|
|
||||||
overrides = {
|
|
||||||
extensions = {
|
|
||||||
perga = 'pg',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"path": ".",
|
"path": ".",
|
||||||
"file-types": ["pg"],
|
"file-types": ["pg"],
|
||||||
"injection-regex": "^perga$",
|
"injection-regex": "^perga$",
|
||||||
"highlights": "queries/highlights.scm"
|
"highlights": "queries/perga/highlights.scm"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue