From 36f605841324278a31cbc3b4fc69333d4b954697 Mon Sep 17 00:00:00 2001 From: William Ball Date: Sun, 1 Dec 2024 20:52:42 -0800 Subject: [PATCH] updates --- lua/perga/init.lua | 26 ++++---------------------- queries/perga/highlights.scm | 4 ++-- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lua/perga/init.lua b/lua/perga/init.lua index 4a0e40f..02e897b 100644 --- a/lua/perga/init.lua +++ b/lua/perga/init.lua @@ -1,23 +1,5 @@ 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) vim.filetype.add({ extension = { pg = 'perga' } @@ -27,17 +9,17 @@ function M.setup(opts) pattern = "perga", callback = function() _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.comments = 'sr:[*,mb:*,ex:*],b:--' + vim.opt_local.formatoptions = 'cqort' end }) local parser_config = require 'nvim-treesitter.parsers'.get_parser_configs() parser_config.perga = { 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'}, branch = 'main', generate_requires_npm = false, diff --git a/queries/perga/highlights.scm b/queries/perga/highlights.scm index 128c400..76d60f1 100644 --- a/queries/perga/highlights.scm +++ b/queries/perga/highlights.scm @@ -1,4 +1,4 @@ -[ "fun" "λ" "forall" "∏" "let" "in" "end" ] @keyword +[ "fun" "λ" "forall" "∏" "let" "in" "end" "def" "axiom" ] @keyword (axiom) @keyword (preprocess @@ -10,7 +10,7 @@ [(star) (square)] @constant.builtin (comment) @comment -(block_comment) @comment +;(block_comment) @comment [ "(" ")" ] @punctuation.bracket