mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 08:35:48 +02:00
add: blade treesitter config
This commit is contained in:
parent
b9949062dc
commit
fbc8a53840
19 changed files with 177 additions and 14 deletions
1
after/ftplugin/blade.lua
Normal file
1
after/ftplugin/blade.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
vim.bo.commentstring = '{{-- %s --}}'
|
1
after/ftplugin/php.lua
Normal file
1
after/ftplugin/php.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
vim.bo.commentstring = '// %s'
|
1
after/ftplugin/vue.lua
Normal file
1
after/ftplugin/vue.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
vim.bo.commentstring = '<!-- %s -->'
|
4
after/queries/blade/highlights.scm
Normal file
4
after/queries/blade/highlights.scm
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(directive) @tag
|
||||||
|
(directive_start) @tag
|
||||||
|
(directive_end) @tag
|
||||||
|
(comment) @comment @spell
|
16
after/queries/blade/injections.scm
Normal file
16
after/queries/blade/injections.scm
Normal file
|
@ -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))
|
36
after/queries/html/injections.scm
Normal file
36
after/queries/html/injections.scm
Normal file
|
@ -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
|
||||||
|
; <x-foo ::bar="baz" />
|
||||||
|
(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
|
||||||
|
; <x-foo :bar="$baz" />
|
||||||
|
(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"))))
|
10
after/queries/php/indents.scm
Normal file
10
after/queries/php/indents.scm
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
;; extends
|
||||||
|
|
||||||
|
[
|
||||||
|
; prevent double indent for `return new class ...`
|
||||||
|
(return_statement
|
||||||
|
(object_creation_expression))
|
||||||
|
; prevent double indent for `return function() { ... }`
|
||||||
|
(return_statement
|
||||||
|
(anonymous_function_creation_expression))
|
||||||
|
] @indent.dedent
|
9
after/queries/php/injections.scm
Normal file
9
after/queries/php/injections.scm
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
;; extends
|
||||||
|
|
||||||
|
; ((text) @injection.content
|
||||||
|
; (#set! injection.language "html")
|
||||||
|
; (#set! injection.combined))
|
||||||
|
|
||||||
|
; ((php) @injection.content
|
||||||
|
; (#set! injection.language "php_only")
|
||||||
|
; (#set! injection.combined))
|
|
@ -19,6 +19,7 @@
|
||||||
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
"gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "4036c8ae9cc29faf8e6443fa5b23e679db055d24" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "4036c8ae9cc29faf8e6443fa5b23e679db055d24" },
|
||||||
|
"laravel.nvim": { "branch": "main", "commit": "8aaf614b5c8fc045f75ebc2ba69d68e33847b06d" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "378bfb465673a747e9e9f966e518063499e20cfe" },
|
"lazy.nvim": { "branch": "main", "commit": "378bfb465673a747e9e9f966e518063499e20cfe" },
|
||||||
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||||
|
@ -28,7 +29,6 @@
|
||||||
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
"mini.indentscope": { "branch": "main", "commit": "56d42be090e8fcc68eda69cfe55af8c5e562300e" },
|
||||||
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
"neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" },
|
||||||
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
"neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" },
|
||||||
"neotest-gtest": { "branch": "main", "commit": "b44c8afc26cea75ffc80617ce07b4e745a56e589" },
|
|
||||||
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
|
"neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "d580646db85f49b8226d52b143a458161f41954a" },
|
"noice.nvim": { "branch": "main", "commit": "d580646db85f49b8226d52b143a458161f41954a" },
|
||||||
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
"none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" },
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
"nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" },
|
"nvim-scrollview": { "branch": "main", "commit": "fd334e5ad0c616987d1b9114890a59c97165cf83" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
|
"nvim-tree.lua": { "branch": "master", "commit": "2086e564c4d23fea714e8a6d63b881e551af2f41" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "d4a888ae3cff358cb239643c45b2b38bb60e29c6" },
|
"nvim-treesitter": { "branch": "master", "commit": "d4a888ae3cff358cb239643c45b2b38bb60e29c6" },
|
||||||
|
"nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "ddfccbf0df1b9349c2b9e9b17f4afa8f9b6c1ed1" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" },
|
||||||
|
@ -59,7 +60,6 @@
|
||||||
"smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" },
|
"smart-splits.nvim": { "branch": "master", "commit": "66fda3a601a5b4c679656f15eb6ddd613c8d3216" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "f2bfde705ac752c52544d5cfa8b0aee0a766c1ed" },
|
"telescope.nvim": { "branch": "master", "commit": "f2bfde705ac752c52544d5cfa8b0aee0a766c1ed" },
|
||||||
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" },
|
"tiny-devicons-auto-colors.nvim": { "branch": "main", "commit": "9be4af5b1bc1f26a11206ed7ce8bf44312e7941a" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
|
|
||||||
"toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" },
|
"toggleterm.nvim": { "branch": "main", "commit": "fee58a0473fd92b28c34f8f724e4918b15ba30a3" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
"vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" },
|
||||||
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
|
"vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" },
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
_G.pcode = _G.pcode or {}
|
_G.pcode = _G.pcode or {}
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = {
|
||||||
|
[".*%.blade%.php"] = "blade",
|
||||||
|
},
|
||||||
|
})
|
||||||
require("custom.default")
|
require("custom.default")
|
||||||
require("custom.dashboard")
|
require("custom.dashboard")
|
||||||
require("config.lazy_lib")
|
require("config.lazy_lib")
|
||||||
|
|
|
@ -132,7 +132,7 @@ pcode.columnline = true
|
||||||
pcode.auto_save = true
|
pcode.auto_save = true
|
||||||
|
|
||||||
-- https://github.com/folke/todo-comments.nvim
|
-- https://github.com/folke/todo-comments.nvim
|
||||||
pcode.todo_comment = true
|
pcode.todo_comment = false
|
||||||
|
|
||||||
-- https://github.com/nvim-telescope/telescope.nvim
|
-- https://github.com/nvim-telescope/telescope.nvim
|
||||||
---@alias telescope_themes
|
---@alias telescope_themes
|
||||||
|
@ -165,7 +165,7 @@ pcode.active_javascript_config = {
|
||||||
pcode.active_php_config = true
|
pcode.active_php_config = true
|
||||||
pcode.active_golang_config = false
|
pcode.active_golang_config = false
|
||||||
pcode.active_python_config = false
|
pcode.active_python_config = false
|
||||||
pcode.active_cpp_config = true
|
pcode.active_cpp_config = false
|
||||||
pcode.active_java_config = {
|
pcode.active_java_config = {
|
||||||
active = false,
|
active = false,
|
||||||
project = "gradle", -- gradle or maven
|
project = "gradle", -- gradle or maven
|
||||||
|
|
|
@ -116,6 +116,24 @@ if pcode.active_php_config then
|
||||||
require("lint").linters_by_ft = opts.linters_by_ft
|
require("lint").linters_by_ft = opts.linters_by_ft
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"adalessa/laravel.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
-- "tpope/vim-dotenv",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
},
|
||||||
|
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>L", "", desc = " Laravel" },
|
||||||
|
{ "<leader>La", ":Laravel artisan<cr>", desc = "Artisan" },
|
||||||
|
{ "<leader>Lr", ":Laravel routes<cr>", desc = "Routes" },
|
||||||
|
{ "<leader>Lm", ":Laravel related<cr>", desc = "Related" },
|
||||||
|
},
|
||||||
|
event = { "VeryLazy" },
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ if pcode.active_javascript_config.active then
|
||||||
end
|
end
|
||||||
-- run if php config true
|
-- run if php config true
|
||||||
if pcode.active_php_config then
|
if pcode.active_php_config then
|
||||||
local lst_ts = { "php", "phpdoc" }
|
local lst_ts = { "html", "php_only", "php", "bash", "blade" }
|
||||||
for _, ts in pairs(lst_ts) do
|
for _, ts in pairs(lst_ts) do
|
||||||
table.insert(pcode.treesitter_ensure_installed, ts)
|
table.insert(pcode.treesitter_ensure_installed, ts)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
local ts_list = {
|
|
||||||
"lua",
|
|
||||||
"vim",
|
|
||||||
"vimdoc",
|
|
||||||
}
|
|
||||||
for _, ts in pairs(pcode.treesitter_ensure_installed or {}) do
|
|
||||||
table.insert(ts_list, ts)
|
|
||||||
end
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
@ -73,7 +65,7 @@ return {
|
||||||
return {
|
return {
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
ensure_installed = ts_list,
|
ensure_installed = {},
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
|
|
36
lua/plugins/treesitter_blade.lua
Normal file
36
lua/plugins/treesitter_blade.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local ts_list = {
|
||||||
|
"lua",
|
||||||
|
"vim",
|
||||||
|
"vimdoc",
|
||||||
|
}
|
||||||
|
for _, ts in pairs(pcode.treesitter_ensure_installed or {}) do
|
||||||
|
table.insert(ts_list, ts)
|
||||||
|
end
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = ts_list,
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -80,6 +80,12 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = {
|
||||||
|
[".*%.blade%.php"] = "blade",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Autoformat
|
-- Autoformat
|
||||||
-- augroup _lsp
|
-- augroup _lsp
|
||||||
-- autocmd!
|
-- autocmd!
|
||||||
|
|
8
queries/blade/folds.scm
Normal file
8
queries/blade/folds.scm
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
((directive_start) @start
|
||||||
|
(directive_end) @end.after
|
||||||
|
(#set! role block))
|
||||||
|
|
||||||
|
|
||||||
|
((bracket_start) @start
|
||||||
|
(bracket_end) @end
|
||||||
|
(#set! role block))
|
4
queries/blade/highlights.scm
Normal file
4
queries/blade/highlights.scm
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(directive) @tag
|
||||||
|
(directive_start) @tag
|
||||||
|
(directive_end) @tag
|
||||||
|
(comment) @comment @spell
|
16
queries/blade/injections.scm
Normal file
16
queries/blade/injections.scm
Normal file
|
@ -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))
|
Loading…
Add table
Add a link
Reference in a new issue