From 457e82555a95284213537a58559782cb081b0351 Mon Sep 17 00:00:00 2001 From: wrapperup Date: Mon, 20 Jan 2025 03:11:03 -0500 Subject: [PATCH] update stuff --- lua/wrap/init.lua | 59 ++++++++-- lua/wrap/lazy.lua | 78 +++++++++---- lua/wrap/lsp.lua | 160 +++++++++++++++++++++------ lua/wrap/remaps.lua | 79 ++++++++++++++ lua/wrap/setup.lua | 2 + lua/wrap/theme.lua | 18 +++ queries/jai/highlights.scm | 218 +++++++++++++++++++++++++++++++++++++ queries/jai/indents.scm | 63 +++++++++++ 8 files changed, 612 insertions(+), 65 deletions(-) create mode 100644 queries/jai/highlights.scm create mode 100644 queries/jai/indents.scm diff --git a/lua/wrap/init.lua b/lua/wrap/init.lua index eed50e3..e5fb8b5 100644 --- a/lua/wrap/init.lua +++ b/lua/wrap/init.lua @@ -1,9 +1,6 @@ -require("wrap.lazy") +vim.g.b = {case_labels = 0} -require("wrap.remaps") -require("wrap.theme") -require("wrap.lsp") -require("wrap.setup") +require("wrap.lazy") vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 @@ -16,12 +13,50 @@ vim.o.hlsearch = true vim.cmd.nohlsearch() -- Set the shell to pwsh --- vim.o.shell = vim.fn.executable("pwsh") and "pwsh" or "powershell" --- vim.o.shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[\'Out-File:Encoding\']=\'utf8\';' --- vim.o.shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' --- vim.o.shellpipe = '2>&1 | %%{ "$_" } | Tee-Object %s; exit $LastExitCode' --- vim.o.shellquote = "" --- vim.o.shellxquote = "" +vim.o.shell = "pwsh" -- and "pwsh" or "powershell" +vim.o.shellcmdflag = '-NoLogo -NonInteractive -NoProfile -ExecutionPolicy RemoteSigned -Command [System.Environment]::SetEnvironmentVariable("TERM","dumb")' +vim.o.shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' +vim.o.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' +vim.o.shellquote = '' +vim.o.shellxquote = '' + + +-- local server = '\\\\.\\pipe\\nvim-pipe-1234' +-- vim.fn.serverstart(server) + +if vim.g.neovide then + vim.keymap.set('n', '', '"+P') -- Paste normal mode + vim.keymap.set('v', '', '"+P') -- Paste visual mode + vim.keymap.set('c', '', '+') -- Paste command mode + vim.keymap.set('i', '', 'l"+Pli') + + vim.api.nvim_set_keymap('', '', '+p', { noremap = true, silent = true}) + vim.api.nvim_set_keymap('!', '', '+', { noremap = true, silent = true}) + vim.api.nvim_set_keymap('t', '', '+', { noremap = true, silent = true}) + vim.api.nvim_set_keymap('v', '', '+', { noremap = true, silent = true}) + vim.o.guifont = "JetBrainsMonoNL NF:h10" --- vim.fn.serverstart('\\\\.\\pipe\\nvim-pipe-1234') + vim.g.neovide_refresh_rate_idle = 160 + vim.g.neovide_refresh_rate = 240 + + vim.g.neovide_theme = 'auto' + + vim.g.neovide_cursor_animation_length = 0.03 + vim.g.neovide_cursor_trail_size = 0.8 + + vim.g.neovide_padding_top = 0 + vim.g.neovide_padding_bottom = 0 + vim.g.neovide_padding_right = 0 + vim.g.neovide_padding_left = 0 + + vim.g.neovide_scroll_animation_length = 0.1 + vim.g.neovide_scroll_animation_far_lines = 999999 + + vim.g.neovide_cursor_vfx_mode = "" +end + +require("wrap.remaps") +require("wrap.theme") +require("wrap.lsp") +require("wrap.setup") diff --git a/lua/wrap/lazy.lua b/lua/wrap/lazy.lua index 9424e23..5ae5d20 100644 --- a/lua/wrap/lazy.lua +++ b/lua/wrap/lazy.lua @@ -60,7 +60,10 @@ require('lazy').setup({ { 'stevearc/oil.nvim' }, -- navigation / controls - { 'ggandor/leap.nvim' }, + { + 'ggandor/leap.nvim', + event = "VeryLazy", + }, { "kylechui/nvim-surround", @@ -77,7 +80,7 @@ require('lazy').setup({ dependencies = { -- LSP Support { 'neovim/nvim-lspconfig' }, -- Required - { -- Optional + { -- Optional 'williamboman/mason.nvim', build = function() pcall(vim.cmd, 'MasonUpdate') @@ -86,15 +89,18 @@ require('lazy').setup({ { 'williamboman/mason-lspconfig.nvim' }, -- Optional -- Autocompletion - { 'hrsh7th/nvim-cmp' }, -- Required - { 'hrsh7th/cmp-nvim-lsp' }, -- Required - { 'L3MON4D3/LuaSnip', tag = "v2.2.0" }, -- Required + { 'hrsh7th/nvim-cmp' }, -- Required + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'L3MON4D3/LuaSnip' }, -- Required } }, - { "ray-x/lsp_signature.nvim" }, + { + "ray-x/lsp_signature.nvim", + event = "VeryLazy", + }, - { "github/copilot.vim" }, + -- { "github/copilot.vim" }, { "folke/trouble.nvim", @@ -109,17 +115,20 @@ require('lazy').setup({ }, -- status line - { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' } }, - { 'arkav/lualine-lsp-progress' }, + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + event = "VeryLazy", + }, - { 'ThePrimeagen/vim-be-good' }, - { 'ThePrimeagen/harpoon' }, { - 'saecki/crates.nvim', - dependencies = 'nvim-lua/plenary.nvim', - config = function() - require('crates').setup() - end, + 'arkav/lualine-lsp-progress', + event = "VeryLazy", + }, + + { + 'ThePrimeagen/harpoon', + event = "VeryLazy", }, { @@ -132,6 +141,7 @@ require('lazy').setup({ -- formatting { 'stevearc/conform.nvim', + event = "VeryLazy", opts = {}, }, @@ -141,8 +151,6 @@ require('lazy').setup({ end, }, - { "folke/neodev.nvim", opts = {} }, - { "nvimdev/hlsearch.nvim", event = 'BufRead', @@ -151,7 +159,37 @@ require('lazy').setup({ end }, - { "zadirion/Unreal.nvim", dependencies = { "tpope/vim-dispatch" } }, + { + 'stevearc/overseer.nvim', + event = "VeryLazy", + opts = {}, + }, - { "jansedivy/jai.vim" }, + { + 'gabrielpoca/replacer.nvim', + event = "VeryLazy", + opts = { rename_files = false }, + keys = { + { + 'h', + function() require('replacer').run() end, + desc = "run replacer.nvim" + } + }, + }, + + -- { + -- 'windwp/nvim-autopairs', + -- event = "InsertEnter", + -- config = true + -- -- use opts = {} for passing setup options + -- -- this is equalent to setup({}) function + -- }, + + { + 'rluba/jai.vim', + init = function () + vim.g.b = {case_labels = 0} + end + }, }) diff --git a/lua/wrap/lsp.lua b/lua/wrap/lsp.lua index 557541b..2438a60 100644 --- a/lua/wrap/lsp.lua +++ b/lua/wrap/lsp.lua @@ -16,10 +16,41 @@ vim.filetype.add({ vto = "vento", jinja = "htmldjango", html = "htmldjango", + hlsl = "hlsl", + slang = "slang" } }) -local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +local parser_config = require ("nvim-treesitter.parsers").get_parser_configs() + +-- parser_config.jai = { +-- install_info = { +-- url = "https://github.com/constantitus/tree-sitter-jai", +-- files = { "src/parser.c" }, +-- }, +-- filetype = "jai", +-- filetype_to_parsername = "jai", +-- indent = { +-- enable = true +-- } +-- } +-- +-- require('nvim-treesitter.configs').setup { +-- highlight = { +-- enable = true, +-- additional_vim_regex_highlighting = false, +-- }, +-- indent = { +-- enable = true, +-- }, +-- ensure_installed = {"jai"}, -- Add "jai" here if needed, or leave it empty +-- } +-- +-- vim.filetype.add({ +-- extension = { +-- jai = "jai", +-- }, +-- }) -- syntax highlighting require("nvim-treesitter.configs").setup({ @@ -34,21 +65,57 @@ require("nvim-treesitter.configs").setup({ local lsp = require('lsp-zero').preset({}) local cmp = require('cmp') -local cmp_select = { behavior = cmp.SelectBehavior.Select } -cmp.setup { - sources = { { name = 'nvim_lsp', trigger_characters = { '-' } } } -} - --- https://github.com/VonHeikemen/lsp-zero.nvim/blob/v2.x/doc/md/api-reference.md#default_keymapsopts -local cmp_mappings = lsp.defaults.cmp_mappings({ - [''] = cmp.mapping.confirm({ select = true }), -}) - -cmp_mappings[''] = nil -cmp_mappings[''] = nil -lsp.setup_nvim_cmp({ - mapping = cmp_mappings, +-- cmp.setup { +-- sources = { { name = 'nvim_lsp', trigger_characters = { '-' } } }, +-- } +-- +-- -- https://github.com/VonHeikemen/lsp-zero.nvim/blob/v2.x/doc/md/api-reference.md#default_keymapsopts +-- local cmp_mappings = lsp.defaults.cmp_mappings({ +-- [''] = cmp.mapping.confirm({ +-- behavior = cmp.ConfirmBehavior.Replace, +-- select = true +-- }), +-- }) + +-- cmp_mappings[''] = nil +-- cmp_mappings[''] = nil + +-- lsp.setup_nvim_cmp({ +-- mapping = cmp_mappings, +-- }) + +cmp.setup({ + sources = { + { name = 'nvim_lsp' }, + {name = 'luasnip'}, + }, + mapping = { + [''] = cmp.mapping.confirm({ select = false }), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.select_prev_item({ behavior = 'select' }), + [''] = cmp.mapping.select_next_item({ behavior = 'select' }), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item({ behavior = 'insert' }) + else + cmp.complete() + end + end), + [''] = cmp.mapping(function() + if cmp.visible() then + cmp.select_next_item({ behavior = 'insert' }) + else + cmp.complete() + end + end), + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, }) lsp.on_attach(function(client, bufnr) @@ -56,7 +123,6 @@ lsp.on_attach(function(client, bufnr) require "lsp_signature".on_attach({ floating_window = false, }, bufnr) - end) lsp.set_sign_icons({ @@ -67,6 +133,21 @@ lsp.set_sign_icons({ }) local lspconfig = require('lspconfig') +local configs = require("lspconfig.configs") + +-- if not configs.jails then +-- configs.jails = { +-- default_config = { +-- cmd = { 'jails' }, +-- root_dir = lspconfig.util.root_pattern("jails.json", "build.jai", "main.jai"), +-- filetypes = { 'jai' }, +-- name = "Jails", +-- }, +-- } +-- end +-- lspconfig.jails.setup {} + +lspconfig.ols.setup {} lspconfig.emmet_language_server.setup { filetypes = { @@ -82,15 +163,27 @@ lspconfig.tailwindcss.setup { }, } +lspconfig.slangd.setup { + filetypes = { + "slang", + }, +} + +vim.lsp.start({ + name = "jai", + cmd = { "jails" }, + root_dir = vim.fn.getcwd(), -- Use PWD as project root dir. +}) + lspconfig.denols.setup { - on_attach = on_attach, - root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"), + on_attach = on_attach, + root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"), } -lspconfig.tsserver.setup { - on_attach = on_attach, - root_dir = lspconfig.util.root_pattern("package.json"), - single_file_support = false +lspconfig.ts_ls.setup { + on_attach = on_attach, + root_dir = lspconfig.util.root_pattern("package.json"), + single_file_support = false } lspconfig.lua_ls.setup(lsp.nvim_lua_ls()) @@ -101,25 +194,26 @@ lspconfig.rust_analyzer.setup { cargo = { loadOutDirsFromCheck = "true", }, + checkOnSave = false, }, }, } lspconfig.clangd.setup { - on_attach = on_attach, - cmd = { - "clangd", - "--offset-encoding=utf-16", - }, + on_attach = on_attach, + cmd = { + "clangd", + "--offset-encoding=utf-16", + }, } lsp.setup() require("conform").setup({ - formatters_by_ft = { - html = { "dprint" }, - vto = { "dprint" }, - vento = { "dprint" }, - jinja = { "dprint" }, - }, + formatters_by_ft = { + html = { "dprint" }, + vto = { "dprint" }, + vento = { "dprint" }, + jinja = { "dprint" }, + }, }) diff --git a/lua/wrap/remaps.lua b/lua/wrap/remaps.lua index fcf39d4..9f3783c 100644 --- a/lua/wrap/remaps.lua +++ b/lua/wrap/remaps.lua @@ -19,11 +19,15 @@ vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(2) end) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(3) end) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(4) end) +vim.keymap.set("n", "Q", "@@") + vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") vim.keymap.set("v", "", ":m '>+1gv=gv") vim.keymap.set("v", "", ":m '<-2gv=gv") +vim.keymap.set("v", "", "", ">gv") vim.keymap.set("n", "", function() vim.cmd("ClangdSwitchSourceHeader") end) @@ -61,14 +65,89 @@ else end vim.keymap.set("n", "pv", function() require("oil").open() end) + +-- telescope + +local filetype_to_std_lib = { + jai = "C:/Repos/jai/jai", + odin = "C:/Repos/odin/Odin", +} + +local find_file_in_std = function() + local filetype = vim.bo.filetype; + + if filetype_to_std_lib[filetype] ~= nil then + builtin.find_files({ cwd = filetype_to_std_lib[filetype] }) + end +end + +local live_grep_in_std = function() + local filetype = vim.bo.filetype; + + if filetype_to_std_lib[filetype] ~= nil then + builtin.live_grep({ cwd = filetype_to_std_lib[filetype] }) + end +end + vim.keymap.set("n", "ff", builtin.find_files, {}) +vim.keymap.set("n", "F", find_file_in_std, {}) vim.keymap.set("n", "fg", builtin.live_grep, {}) +vim.keymap.set("n", "G", live_grep_in_std, {}) +vim.keymap.set("n", "fcf", function() builtin.find_files { cwd = cfg } end, {}) +vim.keymap.set("n", "fcg", function() builtin.live_grep { cwd = cfg } end, {}) vim.keymap.set("n", "fb", builtin.buffers, {}) vim.keymap.set("n", "fh", builtin.help_tags, {}) +vim.keymap.set("n", "fr", builtin.resume, {}) +vim.keymap.set("n", "fq", builtin.quickfix, {}) vim.keymap.set("n", "gu", function() builtin.lsp_references({ include_declaration = false }) end, {}) vim.keymap.set("n", "gd", function() builtin.lsp_definitions({}) end, {}) +vim.keymap.set("n", "h", function() require("replacer").run() end, {}) + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") + vim.keymap.set({ "n", "v" }, "xe", require("nvim-emmet").wrap_with_abbreviation) require("leap").add_default_mappings() require("Comment").setup() + +vim.api.nvim_create_user_command("OverseerRestartLast", function() + local overseer = require("overseer") + local tasks = overseer.list_tasks({ recent_first = true }) + if vim.tbl_isempty(tasks) then + -- no tasks to restart, let the user pick + overseer.run_template() + else + overseer.run_action(tasks[1], "restart") + end +end, {}) + +-- trouble +vim.keymap.set("n", "]d", function() vim.diagnostic.goto_next() end, opts) +vim.keymap.set("n", "[d", function() vim.diagnostic.goto_prev() end, opts) + +vim.keymap.set("n", "", function() vim.cmd "OverseerRestartLast" end) +vim.keymap.set("n", "", function() vim.cmd "OverseerRun" end) + +vim.keymap.set('n', '', function() vim.cmd.wincmd('j') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('k') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('h') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('l') end) + +vim.keymap.set('n', '', ':resize +20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':resize -20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':vertical resize +20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':vertical resize -20', { noremap = true, silent = true }) + +vim.keymap.set('n', '', function() vim.cmd.wincmd('j') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('k') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('h') end) +vim.keymap.set('n', '', function() vim.cmd.wincmd('l') end) + +vim.keymap.set('n', '', ':resize +20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':resize -20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':vertical resize +20', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':vertical resize -20', { noremap = true, silent = true }) + +vim.keymap.set('i', '', function() require("cmp").complete() end) diff --git a/lua/wrap/setup.lua b/lua/wrap/setup.lua index 4ca008f..e3e7c65 100644 --- a/lua/wrap/setup.lua +++ b/lua/wrap/setup.lua @@ -17,3 +17,5 @@ require('oil').setup({ }) require('nvim-surround').setup() + +require('overseer').setup() diff --git a/lua/wrap/theme.lua b/lua/wrap/theme.lua index 4962074..60b72aa 100644 --- a/lua/wrap/theme.lua +++ b/lua/wrap/theme.lua @@ -4,6 +4,7 @@ -- Author: shadmansaleh -- Credit: glepnir local lualine = require('lualine') +local overseer = require('overseer') -- Color table for highlights -- stylua: ignore @@ -231,5 +232,22 @@ ins_right { padding = { left = 1 }, } +ins_right { + "overseer", + label = 'overseer', -- Prefix for task counts + colored = true, -- Color the task icons and counts + symbols = { + [overseer.STATUS.FAILURE] = " - ", + [overseer.STATUS.CANCELED] = " - ", + [overseer.STATUS.SUCCESS] = " - ", + [overseer.STATUS.RUNNING] = "󰐌 - ", + }, + unique = true, -- Unique-ify non-running task count by name + name = nil, -- List of task names to search for + name_not = false, -- When true, invert the name search + status = nil, -- List of task statuses to display + status_not = false, -- When true, invert the status search +} + -- Now don't forget to initialize lualine lualine.setup(config) diff --git a/queries/jai/highlights.scm b/queries/jai/highlights.scm new file mode 100644 index 0000000..e55f764 --- /dev/null +++ b/queries/jai/highlights.scm @@ -0,0 +1,218 @@ +; Includes + +[ + "#import" + "#load" +] @include + +; Keywords +[ + "struct" + "enum" + "enum_flags" + "if" + "ifx" + "else" + "case" + "for" + "while" + "break" + "continue" + "defer" + "cast" + "xx" +] @keyword + +[ + "return" +] @keyword.return + +[ + "if" + "else" + "case" + "break" +] @conditional + +((if_expression + [ + "then" + "ifx" + "else" + ] @conditional.ternary) + (#set! "priority" 105)) + +; Repeats + +[ + "for" + "while" + "continue" +] @repeat + +; Variables + +; (identifier) @variable +name: (identifier) @variable +argument: (identifier) @variable +named_argument: (identifier) @variable +(member_expression (identifier) @parameter) + +((identifier) @variable.builtin + (#any-of? @variable.builtin "context")) + +; Namespaces + +(import (identifier) @namespace) + +; Parameters + +(parameter (identifier) @parameter ":" "="? (identifier)? @constant) + +; (call_expression argument: (identifier) @parameter "=") + +; Functions + +(procedure_declaration (identifier) @function (block)) + +(call_expression function: (identifier) @function.call) + +; Types + +type: (types) @type +type: (identifier) @type +((types) @type) + +modifier: (identifier) @keyword +keyword: (identifier) @keyword + +((types (identifier) @type.builtin) + (#any-of? @type.builtin + "bool" "int" "string" + "s8" "s16" "s32" "s64" + "u8" "u16" "u32" "u64" + "Type" "Any")) + +(struct_declaration (identifier) @type ":" ":") + +(enum_declaration (identifier) @type ":" ":") + +(const_declaration (identifier) @type ":" ":" [(array_type) (pointer_type)]) + +(struct_literal . (identifier) @type) +(array_literal . (identifier) @type) + +; ; I don't like this +; ((identifier) @type +; (#lua-match? @type "^[A-Z][a-zA-Z0-9]*$") +; (#not-has-parent? @type parameter procedure_declaration call_expression)) + +; Fields + +(member_expression "." (identifier) @field) + +; (anonymous_struct_type "{" (identifier) @field) + +(assignment_statement (identifier) @field "="?) +(update_statement (identifier) @field) + +; Constants + +((identifier) @constant + (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$") + (#not-has-parent? @constant type parameter)) + +(member_expression . "." (identifier) @constant) + +(enum_declaration "{" (identifier) @constant) + +; Literals + +(integer) @number +(float) @number + +(string) @string + +;(character) @character + +(string (escape_sequence) @string.escape) + +(boolean) @boolean + +[ + (uninitialized) + (null) +] @constant.builtin + +; Operators + +[ + ":" + "=" + "+" + "-" + "*" + "/" + "%" + ">" + ">=" + "<" + "<=" + "==" + "!=" + "|" + "~" + "&" + "&~" + "<<" + ">>" + "<<<" + ">>>" + "||" + "&&" + "!" + ".." + "+=" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "^=" + "<<=" + ">>=" + "<<<=" + ">>>=" + "||=" + "&&=" +] @operator + +; Punctuation + +[ "{" "}" ] @punctuation.bracket + +[ "(" ")" ] @punctuation.bracket + +[ "[" "]" ] @punctuation.bracket + +[ + "->" + "." + "," + ":" + ";" +] @punctuation.delimiter + +; Comments + +[ + (block_comment) + (comment) +] @comment @spell + +; Errors + +(ERROR) @error + +(block_comment) @comment diff --git a/queries/jai/indents.scm b/queries/jai/indents.scm new file mode 100644 index 0000000..dbf5c86 --- /dev/null +++ b/queries/jai/indents.scm @@ -0,0 +1,63 @@ +; Documentation, kinda +; @indent.begin ; indent children when matching this node +; @indent.end ; marks the end of indented block +; @indent.align ; behaves like python aligned/hanging indent +; @indent.dedent ; dedent children when matching this node +; @indent.branch ; dedent itself when matching this node +; @indent.ignore ; do not indent in this node +; @indent.auto ; behaves like 'autoindent' buffer option +; @indent.zero ; sets this node at position 0 (no indent) + +; NOTE: these don't work well with Allman style + +; Incomplete + +[ + (block) + (enum_declaration "{") + (struct_declaration "{") + (struct_literal "{") + (anonymous_struct_type "{") + (anonymous_enum_type "{") + (asm_statement "{") + (array_literal "[") + (literal) + (assignment_parameters "(") +] @indent.begin + +(if_statement + condition: (_) @indent.begin) + +(if_statement + consequence: (_ + ";" @indent.end) @_consequence + (#not-match? @_consequence "{")) @indent.begin + +(else_clause) @indent.branch +((else_clause) @_elif + (#match? @_elif "if")) @indent.auto + +((if_case_statement) @indent.auto) +((switch_case ";") @indent.begin) + +((identifier) . (ERROR "(" @indent.begin)) + +(block + "}" @indent.end) + +[ + ")" + "]" + "}" +] @indent.branch @indent.end + +[ + (literal "]") +] @indent.branch @indent.end + +[ + (comment) + (block_comment) + (string) + (ERROR) +] @indent.auto