updates
This commit is contained in:
parent
2645b608e8
commit
36f6058413
2 changed files with 6 additions and 24 deletions
|
|
@ -1,23 +1,5 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function get_indent(lnum)
|
|
||||||
local prev_line = vim.fn.getline(lnum - 1)
|
|
||||||
local curr_line = vim.fn.getline(lnum)
|
|
||||||
|
|
||||||
local prev_indent = vim.fn.indent(lnum - 1)
|
|
||||||
local shiftwidth = vim.bo.shiftwidth
|
|
||||||
|
|
||||||
if prev_line:match(';') then
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
if prev_line:match(':=') then
|
|
||||||
return prev_indent + shiftwidth
|
|
||||||
end
|
|
||||||
|
|
||||||
return prev_indent
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = { pg = 'perga' }
|
extension = { pg = 'perga' }
|
||||||
|
|
@ -27,17 +9,17 @@ function M.setup(opts)
|
||||||
pattern = "perga",
|
pattern = "perga",
|
||||||
callback = function()
|
callback = function()
|
||||||
_G.get_perga_indent = get_indent
|
_G.get_perga_indent = get_indent
|
||||||
|
|
||||||
vim.bo.indentexpr = 'v:lua.get_perga_indent(v:lnum)'
|
|
||||||
vim.bo.indentkeys = '0{,0},0),0],!^F,o,O,e,:,='
|
|
||||||
vim.opt_local.commentstring = '-- %s'
|
vim.opt_local.commentstring = '-- %s'
|
||||||
|
vim.opt_local.comments = 'sr:[*,mb:*,ex:*],b:--'
|
||||||
|
vim.opt_local.formatoptions = 'cqort'
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
|
local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
parser_config.perga = {
|
parser_config.perga = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = 'https://forgejo.ballcloud.cc/wball/tree-sitter-perga',
|
-- url = 'https://forgejo.ballcloud.cc/wball/tree-sitter-perga',
|
||||||
|
url = '~/repos/tree-sitter-perga',
|
||||||
files = {'src/parser.c'},
|
files = {'src/parser.c'},
|
||||||
branch = 'main',
|
branch = 'main',
|
||||||
generate_requires_npm = false,
|
generate_requires_npm = false,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[ "fun" "λ" "forall" "∏" "let" "in" "end" ] @keyword
|
[ "fun" "λ" "forall" "∏" "let" "in" "end" "def" "axiom" ] @keyword
|
||||||
(axiom) @keyword
|
(axiom) @keyword
|
||||||
|
|
||||||
(preprocess
|
(preprocess
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
[(star) (square)] @constant.builtin
|
[(star) (square)] @constant.builtin
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
(block_comment) @comment
|
;(block_comment) @comment
|
||||||
|
|
||||||
[ "(" ")" ] @punctuation.bracket
|
[ "(" ")" ] @punctuation.bracket
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue