WIP
This commit is contained in:
parent
e0b66e89f9
commit
6d228a0a32
8 changed files with 149 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ let
|
|||
"after"
|
||||
"autoload"
|
||||
"ftdetect"
|
||||
"queries"
|
||||
"lua"
|
||||
"plugin"
|
||||
];
|
||||
|
|
@ -67,6 +68,7 @@ in
|
|||
lsp_lines-nvim # Show diagnostics *over* regions
|
||||
none-ls-nvim # LSP integration for linters and formatters
|
||||
nvim-treesitter.withAllGrammars # Better highlighting
|
||||
(pkgs.vimPlugins.nvim-treesitter.grammarToPlugin pkgs.tree-sitter-bp)
|
||||
nvim-treesitter-textobjects # More textobjects
|
||||
plenary-nvim # 'null-ls', 'telescope' dependency
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
local ts_config = require("nvim-treesitter.configs")
|
||||
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
parser_config.bp = {
|
||||
install_info = {
|
||||
url = "",
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
}
|
||||
|
||||
ts_config.setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
|
|
|||
8
modules/home/vim/queries/bp/folds.scm
Normal file
8
modules/home/vim/queries/bp/folds.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[
|
||||
(list_expression)
|
||||
(map_expression)
|
||||
(module)
|
||||
(select_expression)
|
||||
] @fold
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
67
modules/home/vim/queries/bp/highlights.scm
Normal file
67
modules/home/vim/queries/bp/highlights.scm
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
(comment) @comment
|
||||
|
||||
; Operators {{{
|
||||
(operator) @operator
|
||||
|
||||
(integer_literal ("-") @operator)
|
||||
; }}}
|
||||
|
||||
; Punctuation {{{
|
||||
[
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
; }}}
|
||||
|
||||
; Literal {{{
|
||||
(boolean_literal) @boolean
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
[
|
||||
(raw_string_literal)
|
||||
(interpreted_string_literal)
|
||||
] @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
; }}}
|
||||
|
||||
; Declarations {{{
|
||||
(identifier) @variable
|
||||
|
||||
(module
|
||||
type: (identifier) @function.call)
|
||||
|
||||
(module
|
||||
(property
|
||||
field: (identifier) @variable.parameter))
|
||||
; }}}
|
||||
|
||||
; Built-ins {{{
|
||||
[
|
||||
(unset)
|
||||
(default)
|
||||
] @variable.builtin
|
||||
(condition
|
||||
name: (identifier) @function.builtin)
|
||||
; }}}
|
||||
|
||||
; Expressions {{{
|
||||
(map_expression
|
||||
(property
|
||||
field: (identifier) @property))
|
||||
|
||||
(select_expression
|
||||
"select" @keyword.conditional)
|
||||
; }}}
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
27
modules/home/vim/queries/bp/indents.scm
Normal file
27
modules/home/vim/queries/bp/indents.scm
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
; Expressions {{{
|
||||
(list_expression) @indent.begin
|
||||
(list_expression
|
||||
"]" @indent.branch)
|
||||
|
||||
(map_expression) @indent.begin
|
||||
(map_expression
|
||||
"}" @indent.branch)
|
||||
|
||||
(select_expression) @indent.begin
|
||||
(select_expression
|
||||
")" @indent.branch)
|
||||
|
||||
(select_cases) @indent.begin
|
||||
(select_cases
|
||||
"}" @indent.branch)
|
||||
; }}}
|
||||
|
||||
; Declarations {{{
|
||||
(module) @indent.begin
|
||||
(module
|
||||
")" @indent.branch)
|
||||
(module
|
||||
"}" @indent.branch)
|
||||
; }}}
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
4
modules/home/vim/queries/bp/injections.scm
Normal file
4
modules/home/vim/queries/bp/injections.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
14
modules/home/vim/queries/bp/locals.scm
Normal file
14
modules/home/vim/queries/bp/locals.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(module
|
||||
(property
|
||||
field: (identifier) @local.definition.parameter))
|
||||
|
||||
(map_expression
|
||||
(property
|
||||
field: (identifier) @local.definition.field))
|
||||
|
||||
(assignment
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
18
overlays/tree-sitter-bp/default.nix
Normal file
18
overlays/tree-sitter-bp/default.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
self: prev:
|
||||
let
|
||||
tree-sitter = prev.tree-sitter.override {
|
||||
extraGrammars = {
|
||||
tree-sitter-bp = {
|
||||
src = self.fetchFromGitHub {
|
||||
owner = "ambroisie";
|
||||
repo = "tree-sitter-bp";
|
||||
rev = "v0.4.0";
|
||||
hash = "sha256-h9T8tfS2K85N9NLwYj6tu2MHPj4YyG/UBYoezfWuEyI=";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit (tree-sitter.passthru.builtGrammars) tree-sitter-bp;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue