diff --git a/home/dot_config/exact_nvim/exact_after/exact_ftplugin/blade.lua b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/blade.lua new file mode 100644 index 0000000..1931f8b --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/blade.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '{{-- %s --}}' diff --git a/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown.lua b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown.lua new file mode 100644 index 0000000..b7e2345 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '' diff --git a/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown_inline.lua b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown_inline.lua new file mode 100644 index 0000000..b7e2345 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/markdown_inline.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '' diff --git a/home/dot_config/exact_nvim/exact_after/exact_ftplugin/php.lua b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/php.lua new file mode 100644 index 0000000..f398d66 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/php.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '// %s' diff --git a/home/dot_config/exact_nvim/exact_after/exact_ftplugin/vue.lua b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/vue.lua new file mode 100644 index 0000000..b7e2345 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_ftplugin/vue.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '' diff --git a/home/dot_config/exact_nvim/exact_after/exact_queries/exact_html/injections.scm b/home/dot_config/exact_nvim/exact_after/exact_queries/exact_html/injections.scm new file mode 100644 index 0000000..e183fb0 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_after/exact_queries/exact_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/home/dot_config/exact_nvim/exact_lua/exact_config/options.lua b/home/dot_config/exact_nvim/exact_lua/exact_config/options.lua index 0b16fd3..0dd0ce0 100644 --- a/home/dot_config/exact_nvim/exact_lua/exact_config/options.lua +++ b/home/dot_config/exact_nvim/exact_lua/exact_config/options.lua @@ -66,3 +66,7 @@ vim.opt.foldmethod = 'expr' vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -- vim.cmd([[ set nofoldenable]]) -- Disable folding at startup vim.opt.foldenable = true + +-- LSP Server to use for PHP. +-- Set to "intelephense" to use intelephense instead of phpactor. +vim.g.lazyvim_php_lsp = 'intelephense' diff --git a/home/dot_config/exact_nvim/exact_lua/exact_plugins/laravel.lua b/home/dot_config/exact_nvim/exact_lua/exact_plugins/laravel.lua new file mode 100644 index 0000000..acbd17f --- /dev/null +++ b/home/dot_config/exact_nvim/exact_lua/exact_plugins/laravel.lua @@ -0,0 +1,6 @@ +return { + { + 'ricardoramirezr/blade-nav.nvim', + ft = { 'blade', 'blade.php' }, + }, +} diff --git a/home/dot_config/exact_nvim/exact_lua/exact_plugins/lsp.lua b/home/dot_config/exact_nvim/exact_lua/exact_plugins/lsp.lua index 37af4b2..c7531b6 100644 --- a/home/dot_config/exact_nvim/exact_lua/exact_plugins/lsp.lua +++ b/home/dot_config/exact_nvim/exact_lua/exact_plugins/lsp.lua @@ -34,6 +34,12 @@ return { mason = false, cmd = { vim.fn.expand('~/.asdf/shims/ruby-lsp') }, }, + intelephense = { + enable = true, + }, + phpactor = { + enable = false, + }, eslint = { root_dir = get_root_dir, }, diff --git a/home/dot_config/exact_nvim/exact_lua/exact_plugins/treesitter.lua b/home/dot_config/exact_nvim/exact_lua/exact_plugins/treesitter.lua index b5b6e75..285f144 100644 --- a/home/dot_config/exact_nvim/exact_lua/exact_plugins/treesitter.lua +++ b/home/dot_config/exact_nvim/exact_lua/exact_plugins/treesitter.lua @@ -2,11 +2,21 @@ return { { 'nvim-treesitter/playground', cmd = 'TSPlaygroundToggle' }, { 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', + build = function() + require('nvim-treesitter.install').update({ with_sync = true })() + end, + dependencies = { + 'windwp/nvim-ts-autotag', + 'RRethy/nvim-treesitter-endwise', + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/nvim-treesitter-context', + 'LiadOz/nvim-dap-repl-highlights', + }, opts = function(_, opts) vim.list_extend(opts.ensure_installed, { 'angular', 'bash', + 'blade', 'cpp', 'css', 'dockerfile', @@ -22,6 +32,7 @@ return { 'markdown', 'markdown_inline', 'mermaid', + 'php', 'prisma', 'regex', 'ruby', @@ -39,6 +50,9 @@ return { 'vue', }) opts.autoinstall = true + opts.highlight = { enable = true } + opts.indent = { enable = true } + -- https://github.com/nvim-treesitter/playground#query-linter opts.query_linter = { enable = true, @@ -65,15 +79,29 @@ return { } end, config = function(_, opts) - require('nvim-treesitter.configs').setup(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', + } -- MDX vim.filetype.add({ extension = { mdx = 'mdx', }, + pattern = { + ['.*%.blade%.php'] = 'blade', + }, }) vim.treesitter.language.register('markdown', 'mdx') + + require('nvim-treesitter.configs').setup(opts) end, }, { diff --git a/home/dot_config/exact_nvim/exact_queries/exact_blade/highlights.scm b/home/dot_config/exact_nvim/exact_queries/exact_blade/highlights.scm new file mode 100644 index 0000000..2c9c2cd --- /dev/null +++ b/home/dot_config/exact_nvim/exact_queries/exact_blade/highlights.scm @@ -0,0 +1,4 @@ +(directive) @tag +(directive_start) @tag +(directive_end) @tag +(comment) @comment @spell diff --git a/home/dot_config/exact_nvim/exact_queries/exact_blade/injections.scm b/home/dot_config/exact_nvim/exact_queries/exact_blade/injections.scm new file mode 100644 index 0000000..5283841 --- /dev/null +++ b/home/dot_config/exact_nvim/exact_queries/exact_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)) diff --git a/home/dot_config/exact_nvim/lazyvim.json b/home/dot_config/exact_nvim/lazyvim.json index 32fd57c..a23cffa 100644 --- a/home/dot_config/exact_nvim/lazyvim.json +++ b/home/dot_config/exact_nvim/lazyvim.json @@ -1,13 +1,12 @@ { "extras": [ - "lazyvim.plugins.extras.dap.core", - "lazyvim.plugins.extras.test.core", "lazyvim.plugins.extras.coding.copilot", "lazyvim.plugins.extras.coding.copilot-chat", "lazyvim.plugins.extras.coding.mini-comment", "lazyvim.plugins.extras.coding.mini-surround", "lazyvim.plugins.extras.coding.neogen", "lazyvim.plugins.extras.coding.yanky", + "lazyvim.plugins.extras.dap.core", "lazyvim.plugins.extras.editor.harpoon2", "lazyvim.plugins.extras.editor.leap", "lazyvim.plugins.extras.editor.mini-move", @@ -20,6 +19,7 @@ "lazyvim.plugins.extras.lang.go", "lazyvim.plugins.extras.lang.json", "lazyvim.plugins.extras.lang.markdown", + "lazyvim.plugins.extras.lang.php", "lazyvim.plugins.extras.lang.ruby", "lazyvim.plugins.extras.lang.rust", "lazyvim.plugins.extras.lang.svelte", @@ -28,6 +28,7 @@ "lazyvim.plugins.extras.lang.vue", "lazyvim.plugins.extras.lang.yaml", "lazyvim.plugins.extras.linting.eslint", + "lazyvim.plugins.extras.test.core", "lazyvim.plugins.extras.ui.mini-indentscope", "lazyvim.plugins.extras.ui.treesitter-context", "lazyvim.plugins.extras.util.dot", @@ -41,5 +42,4 @@ "doc/news.txt": "24450" }, "version": 6 -} - +} \ No newline at end of file diff --git a/home/dot_tool-versions b/home/dot_tool-versions.tmpl similarity index 80% rename from home/dot_tool-versions rename to home/dot_tool-versions.tmpl index 6e78c85..ec38574 100644 --- a/home/dot_tool-versions +++ b/home/dot_tool-versions.tmpl @@ -12,3 +12,6 @@ golang 1.23.1 lua 5.1 deno 1.46.3 just 1.36.0 +{{- if not $isWork }} +php 8.3.12 +{{- end }}