diff --git a/after/queries/html/injections.scm b/after/queries/html/injections.scm new file mode 100644 index 00000000..e183fb07 --- /dev/null +++ b/after/queries/html/injections.scm @@ -0,0 +1,36 @@ +;; extends + +; AlpineJS attributes +(attribute + (attribute_name) @_attr + (#lua-match? @_attr "^x%-%l") + (#not-any-of? @_attr "x-teleport" "x-ref" "x-transition") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")) + +; Blade escaped JS attributes +; +(element + (_ + (tag_name) @_tag + (#lua-match? @_tag "^x%-%l") + (attribute + (attribute_name) @_attr + (#lua-match? @_attr "^::%l") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")))) + +; Blade PHP attributes +; +(element + (_ + (tag_name) @_tag + (#lua-match? @_tag "^x%-%l") + (attribute + (attribute_name) @_attr + (#lua-match? @_attr "^:%l") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "php_only")))) diff --git a/init.lua b/init.lua index 3f9c68f2..685129b1 100644 --- a/init.lua +++ b/init.lua @@ -217,6 +217,7 @@ local function close_neo_tree() require('neo-tree.sources.manager').close_all() vim.notify 'closed all' end + -- -- [[ Configure and install plugins ]] -- @@ -248,12 +249,13 @@ require('lazy').setup({ -- Auto-save sessions { 'rmagatti/auto-session', + enabled = true, lazy = false, opts = { log_level = 'error', auto_session_suppress_dirs = { '~/', '/' }, - auto_session_enable_last_session = true, - auto_session_root_dir = '~/.local/state/nvim/sessions/', + auto_session_enable_last_session = false, + -- auto_session_root_dir = '~/.local/state/nvim/sessions/', bypass_session_save_file_types = { 'neo-tree' }, pre_save_cmds = { close_neo_tree, @@ -933,6 +935,7 @@ require('lazy').setup({ }, { 'nvim-neo-tree/neo-tree.nvim', + enabled = true, branch = 'v3.x', cmd = 'Neotree', dependencies = { @@ -1144,6 +1147,22 @@ require('lazy').setup({ -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + local parser_config = require('nvim-treesitter.parsers').get_parser_configs() + + parser_config.blade = { + install_info = { + url = 'https://github.com/EmranMR/tree-sitter-blade', + files = { 'src/parser.c' }, + branch = 'main', + }, + filetype = 'blade', + } + + vim.filetype.add { + pattern = { + ['.*%.blade%.php'] = 'blade', + }, + } end, }, diff --git a/queries/blade/highlights.scm b/queries/blade/highlights.scm new file mode 100644 index 00000000..2c9c2cd8 --- /dev/null +++ b/queries/blade/highlights.scm @@ -0,0 +1,4 @@ +(directive) @tag +(directive_start) @tag +(directive_end) @tag +(comment) @comment @spell diff --git a/queries/blade/injections.scm b/queries/blade/injections.scm new file mode 100644 index 00000000..da9a830a --- /dev/null +++ b/queries/blade/injections.scm @@ -0,0 +1,16 @@ +((text) @injection.content + (#not-has-ancestor? @injection.content "envoy") + (#set! injection.combined) + (#set! injection.language php)) + +((text) @injection.content + (#has-ancestor? @injection.content "envoy") + (#set! injection.combined) + (#set! injection.language bash)) + +((php_only) @injection.content + (#set! injection.combined) + (#set! injection.language php_only)) + +((parameter) @injection.content + (#set! injection.language php_only))