commit 33c2bc8397cac9384647716bcfa2c04caf1cd613 Author: alex-chevski Date: Sun Feb 25 17:37:23 2024 +0300 feat(kauffinger/lazyvim): new config with my own from kauffinger/lazyvim diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/.neoconf.json b/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8a8a7c3 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +# 💤 LazyVim + Laravel + +(and some stuff I also use) +This is my best effort to fully integrate my LazyVim config with Laravel and all Laravel-related tools. +Works great with Livewire v3 as well as Volt and Folio. +When using Volt, use class-based syntax for maximum compatibility. +Functional Volt works, too, but has issues with `$this`. + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. + +## Laravel Native + +This config is setup with the best available dev tooling for laravel + +- Intelephense +- Blade Language Support +- Blade Formatter +- Pint +- Phpstan (make sure you configure larastan in your project) +- Rustywind +- Tailwind LS +- XDebug with configuration for Laravel Sail +- Treesitter beta for blade files included + +## Additions + +### Requirements + +If you encounter an issue with `Intelephense` not recognising facade or model function calls, you will need to install [Laravel IDE Helper](https://github.com/barryvdh/laravel-ide-helper) into your project and execute the relevant artisan commands. Thanks to [@ermand](https://github.com/ermand) for bringing up the issue as well as the solution. + +Make sure you install all TreeSitter parsers by doing: +`:TSInstall all` and `:TSInstall php_only`. +This will install both the experimental blade parser, for which configuration is included in this config, as well as the php_only parser, which is needed for it to work fully. +For some reason php_only is not included in `all`. + +Optional: + +- lazygit +- lazydocker + +(you should use both, they are great) + +### LSP + +- Tailwind support +- Intelephense for php (best in class for Laravel development) + +### Theme + +- I concede, we are back to using catppuccin. There is just too many integrations. + +## Troubleshooting + +If opening a py file leads to pyright analyzing your whole library, make sure to add an empty `pyrightconfig.json` into the file root. +This can be your $HOME folder or for example on darwin using homebrew it could be `/opt/homebrew/`. diff --git a/after/queries/html/injections.scm b/after/queries/html/injections.scm new file mode 100644 index 0000000..e183fb0 --- /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/after/queries/php/indents.scm b/after/queries/php/indents.scm new file mode 100644 index 0000000..b2044f3 --- /dev/null +++ b/after/queries/php/indents.scm @@ -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 diff --git a/index.blade.php b/index.blade.php new file mode 100644 index 0000000..cc691b3 --- /dev/null +++ b/index.blade.php @@ -0,0 +1,127 @@ +@extends('layouts/eatvio') +@php + $curDiaryDate = \Carbon\Carbon::createFromFormat('Y-m-d', $curDiary->date)->format('d-m-Y'); +@endphp +@section('main_section') +
+ +
+ @method('PATCH') + @csrf + +
+
{{ __('meal_form.wakeup_and_down_time') }} + +
+
+ +
+

{{ __('diary.waking_time') }}

+
+ + + + +
+
+
+

{{ __('diary.bedtime') }}

+
+ + + + +
+
+
+ +
+ + @livewire('diary.meal-form', ['diaryId' => $diaryId]) +
+
+
{{ __('meal_form.additional_info_for_consultant') }}
+ +
+ + +
+
+
+ @once + @push('jq_scripts') + + + @endpush + @endonce +@endsection diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..fe91972 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,79 @@ +{ + "LazyVim": { "branch": "main", "commit": "fe72424e77cb9c953084bbcaaa0eb7fe8056dc70" }, + "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "SchemaStore.nvim": { "branch": "main", "commit": "0358c7e159e5502361bf3971d89bf5133bcc2893" }, + "bufferline.nvim": { "branch": "main", "commit": "b15c6daf5a64426c69732b31a951f4e438cb6590" }, + "catppuccin": { "branch": "main", "commit": "c0de3b46811fe1ce3912e2245a9dfbea6b41c300" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "composer.nvim": { "branch": "main", "commit": "ec9537969adc7fc128cfe9c3a9925850455896c8" }, + "conform.nvim": { "branch": "master", "commit": "192a6d2ddace343f1840a8f72efe2315bd392243" }, + "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, + "copilot.lua": { "branch": "master", "commit": "03f825956ec49e550d07875d867ea6e7c4dc8c00" }, + "crates.nvim": { "branch": "main", "commit": "ec2b04a380c9f3a8e6ca38c230e4990d71978143" }, + "dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" }, + "everforest-nvim": { "branch": "main", "commit": "eedb19079c6bf9d162f74a5c48a6d2759f38cc76" }, + "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, + "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, + "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, + "laravel.nvim": { "branch": "main", "commit": "5ef5296f9c943e88850591b5e21f17db62e874ee" }, + "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, + "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" }, + "mason.nvim": { "branch": "main", "commit": "c43eeb5614a09dc17c03a7fb49de2e05de203924" }, + "mini.ai": { "branch": "main", "commit": "ee9446a17c160aba6a04ff22097389c41872c878" }, + "mini.animate": { "branch": "main", "commit": "82519630b2760ffc516ebc387bef632f9c07b9f5" }, + "mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" }, + "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, + "mini.indentscope": { "branch": "main", "commit": "cf07f19e718ebb0bcc5b00999083ce11c37b8d40" }, + "mini.pairs": { "branch": "main", "commit": "04f58f2545ed80ac3b52dd4826e93f33e15b2af6" }, + "mini.starter": { "branch": "main", "commit": "ce222a5b6de50a9963c1eb62aa16ec6d5efca7ee" }, + "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, + "namespace.nvim": { "branch": "master", "commit": "bcf511a5a3641d6a3beaefc7048ef5b98616ebdd" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" }, + "neoconf.nvim": { "branch": "main", "commit": "faab415b0ba57f0a15a82210f346f662e6551e1a" }, + "neodev.nvim": { "branch": "main", "commit": "3157f2e876fd6223d36cfa76bee4709247d62fa5" }, + "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, + "none-ls.nvim": { "branch": "main", "commit": "4715e3e0480152dbbca1a3b5d09f070508a54691" }, + "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, + "nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" }, + "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" }, + "nvim-lint": { "branch": "master", "commit": "85fe14d080d902dcc566461f0205495d0c153372" }, + "nvim-lspconfig": { "branch": "master", "commit": "ec7d51a619049c7c597f469f81ea199db6794651" }, + "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, + "nvim-spectre": { "branch": "master", "commit": "3712ff0cdf4f9f877d9ca708d835a877d9a0abaf" }, + "nvim-treesitter": { "branch": "master", "commit": "6f1f407d712d1c451451db74ff3a6eb72190548d" }, + "nvim-treesitter-context": { "branch": "master", "commit": "e4a259f05032983c8611ca150ac25f1df62c0871" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "7f00d94543f1fd37cab2afa2e9a6cd54e1c6b9ef" }, + "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, + "nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" }, + "persistence.nvim": { "branch": "main", "commit": "4982499c1636eac254b72923ab826ee7827b3084" }, + "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, + "rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" }, + "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" }, + "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "bc25c56083939f274edcfe395c6ff7de23b67c50" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "master", "commit": "2e1e382df42467029b493c143c2e727028140214" }, + "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, + "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, + "typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" }, + "vim-blade": { "branch": "master", "commit": "9534101808cc320eef003129a40cab04b026a20c" }, + "vim-dadbod": { "branch": "master", "commit": "936e78f44113eac54948474e222293dd70eaef9e" }, + "vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" }, + "vim-dadbod-ui": { "branch": "master", "commit": "165699c573469e6a95b48d35052f848c340c5911" }, + "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, + "vim-fugitive": { "branch": "master", "commit": "4bc9d989930e37989b038540cc49e63728d3f220" }, + "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, + "vim-startuptime": { "branch": "master", "commit": "308b0088a864c4711a96e45b6734cf9294074f65" }, + "vimtex": { "branch": "master", "commit": "01c4c167338b74dc0c30621841bc548b52e96330" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 0000000..f63dc38 --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + "lazyvim.plugins.extras.lang.rust" + ], + "news": { + "NEWS.md": "2123" + }, + "version": 2 +} \ No newline at end of file diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..da8480c --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,33 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here + +-- Define an autocmd group for the blade workaround +local augroup = vim.api.nvim_create_augroup("lsp_blade_workaround", { clear = true }) + +-- Autocommand to temporarily change 'blade' filetype to 'php' when opening for LSP server activation +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = augroup, + pattern = "*.blade.php", + callback = function() + vim.bo.filetype = "php" + end, +}) + +-- Additional autocommand to switch back to 'blade' after LSP has attached +vim.api.nvim_create_autocmd("LspAttach", { + pattern = "*.blade.php", + callback = function(args) + vim.schedule(function() + -- Check if the attached client is 'intelephense' + for _, client in ipairs(vim.lsp.get_active_clients()) do + if client.name == "intelephense" and client.attached_buffers[args.buf] then + vim.api.nvim_buf_set_option(args.buf, "filetype", "blade") + -- update treesitter parser to blade + vim.api.nvim_buf_set_option(args.buf, "syntax", "blade") + break + end + end + end) + end, +}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..932ce8d --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,51 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +local Util = require("lazyvim.util") +local function map(mode, lhs, rhs, opts) + local keys = require("lazy.core.handler").handlers.keys + ---@cast keys LazyKeysHandler + -- do not create the keymap if a lazy keys handler exists + if not keys.active[keys.parse({ lhs, mode = mode }).id] then + opts = opts or {} + opts.silent = opts.silent ~= false + vim.keymap.set(mode, lhs, rhs, opts) + end +end + +map("n", "gd", function() + Util.float_term( + { "lazydocker", "-f", Util.get_root() .. "docker-compose.yml" }, + { cwd = Util.get_root(), esc_esc = false } + ) +end, { desc = "LazyDocker (root dir)" }) + +local bind = vim.keymap.set +local opts = { silent = true, noremap = true } + +-- for russian layout +bind("i", "", "", opts) +bind("n", "л", "gk", opts) +bind("n", "о", "gj", opts) +bind("i", "", "u", opts) +bind("i", "", "u", opts) + +bind("n", "[c", function() + require("treesitter-context").go_to_context() +end) + +--personal +--normal mode +bind("i", "jk", "") +--save +bind("n", "zz", ":update") + +bind("n", ",", ":nohlsearch") + +-- namespace php +vim.keymap.set("n", "u", "GetClass") +vim.keymap.set("n", "un", "Namespace") + +vim.keymap.set("n", "[", "call append(line('.') - 1, repeat([''], v:count1))") +vim.keymap.set("n", "]", "call append(line('.'), repeat([''], v:count1))") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..cf2cd0b --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,55 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", + lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.json" }, + { import = "lazyvim.plugins.extras.lang.yaml" }, + { import = "lazyvim.plugins.extras.lang.docker" }, + { import = "lazyvim.plugins.extras.lang.tex" }, + -- { import = "lazyvim.plugins.extras.lang.python" }, + { import = "lazyvim.plugins.extras.coding.copilot" }, + { import = "lazyvim.plugins.extras.dap.core" }, + { import = "lazyvim.plugins.extras.lsp.none-ls" }, + -- { import = "lazyvim.plugins.extras.lang.go" }, + { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "everforest" } }, + checker = { enabled = true, notify = false }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..6a58a6d --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,7 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here +vim.o.relativenumber = false + +-- vim.api.nvim_set_keymap("n", "", ":bnext", { noremap = true }) +-- vim.api.nvim_set_keymap("n", "", ":bprev", { noremap = true }) diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..31d086f --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,55 @@ +local util = require("conform.util") +return { + "stevearc/conform.nvim", + opts = function() + ---@class ConformOpts + local opts = { + -- LazyVim will use these options when formatting with the conform.nvim formatter + format = { + timeout_ms = 3000, + async = false, -- not recommended to change + quiet = false, -- not recommended to change + }, + ---@type table + formatters_by_ft = { + lua = { "stylua" }, + fish = { "fish_indent" }, + sh = { "shfmt" }, + php = { "pint" }, + blade = { "blade-formatter", "rustywind" }, + -- python = { "black" }, + javascript = { "prettierd" }, + }, + -- LazyVim will merge the options you set here with builtin formatters. + -- You can also define any custom formatters here. + ---@type table + formatters = { + injected = { options = { ignore_errors = true } }, + -- # Example of using dprint only when a dprint.json file is present + -- dprint = { + -- condition = function(ctx) + -- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + -- + -- # Example of using shfmt with extra args + -- shfmt = { + -- extra_args = { "-i", "2", "-ci" }, + -- }, + pint = { + meta = { + url = "https://github.com/laravel/pint", + description = "Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.", + }, + command = util.find_executable({ + vim.fn.stdpath("data") .. "/mason/bin/pint", + "vendor/bin/pint", + }, "pint"), + args = { "$FILENAME" }, + stdin = false, + }, + }, + } + return opts + end, +} diff --git a/lua/plugins/database.lua b/lua/plugins/database.lua new file mode 100644 index 0000000..b2d8bc8 --- /dev/null +++ b/lua/plugins/database.lua @@ -0,0 +1,26 @@ +return { + "kristijanhusak/vim-dadbod-ui", + dependencies = { + "tpope/vim-dadbod", + "kristijanhusak/vim-dadbod-completion", + "tpope/vim-dotenv", + }, + keys = { { "db", ":tab DBUI", desc = "Open Database client" } }, + init = function() + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_show_database_icon = 1 + vim.g.db_ui_force_echo_notifications = 1 + vim.g.db_ui_win_position = "left" + vim.g.db_ui_winwidth = 100 + + vim.g.db_ui_table_helpers = { + mysql = { + Count = "select count(1) from {optional_schema}{table}", + Explain = "EXPLAIN {last_query}", + }, + sqlite = { + Describe = "PRAGMA table_info({table})", + }, + } + end, +} diff --git a/lua/plugins/emmet_ls.lua b/lua/plugins/emmet_ls.lua new file mode 100644 index 0000000..a0c540d --- /dev/null +++ b/lua/plugins/emmet_ls.lua @@ -0,0 +1,28 @@ +return { + { + "neovim/nvim-lspconfig", + opts = { + -- @type lspconfig.options + servers = { + emmet_ls = { + filetypes = { + "astro", + "blade", + "css", + "eruby", + "html", + "htmldjango", + "javascriptreact", + "less", + "pug", + "sass", + "scss", + "svelte", + "typescriptreact", + "vue", + }, + }, + }, + }, + }, +} diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua new file mode 100644 index 0000000..c950669 --- /dev/null +++ b/lua/plugins/example.lua @@ -0,0 +1,267 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +-- if true then return {} end + +-- every spec file under config.plugins will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + -- { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load everforest + { + "LazyVim/LazyVim", + opts = { + colorscheme = "everforest", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- add symbols-outline + -- { + -- "simrat39/symbols-outline.nvim", + -- cmd = "SymbolsOutline", + -- keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, + -- config = true, + -- }, + + -- override nvim-cmp and add cmp-emoji + -- { + -- "hrsh7th/nvim-cmp", + -- dependencies = { "hrsh7th/cmp-emoji" }, + -- ---@param opts cmp.ConfigSchema + -- opts = function(_, opts) + -- local cmp = require("cmp") + -- opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) + -- end, + -- }, + + -- change some telescope options and a keymap to browse plugin files + -- { + -- "nvim-telescope/telescope.nvim", + -- keys = { + -- -- add a keymap to browse plugin files + -- -- stylua: ignore + -- { + -- "fp", + -- function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + -- desc = "Find Plugin File", + -- }, + -- }, + -- change some options + -- opts = { + -- defaults = { + -- layout_strategy = "horizontal", + -- layout_config = { prompt_position = "top" }, + -- sorting_strategy = "ascending", + -- winblend = 0, + -- }, + -- }, + -- }, + + -- add telescope-fzf-native + -- { + -- "telescope.nvim", + -- dependencies = { + -- "nvim-telescope/telescope-fzf-native.nvim", + -- build = "make", + -- config = function() + -- require("telescope").load_extension("fzf") + -- end, + -- }, + -- }, + + -- add pyright to lspconfig + -- { + -- "neovim/nvim-lspconfig", + -- ---@class PluginLspOpts + -- opts = { + -- ---@type lspconfig.options + -- servers = { + -- -- pyright will be automatically installed with mason and loaded with lspconfig + -- pyright = {}, + -- }, + -- }, + -- }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + -- { + -- "neovim/nvim-lspconfig", + -- dependencies = { + -- "jose-elias-alvarez/typescript.nvim", + -- init = function() + -- require("lazyvim.util").on_attach(function(_, buffer) + -- -- stylua: ignore + -- vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + -- vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + -- end) + -- end, + -- }, + -- ---@class PluginLspOpts + -- opts = { + -- ---@type lspconfig.options + -- servers = { + -- -- tsserver will be automatically installed with mason and loaded with lspconfig + -- tsserver = {}, + -- }, + -- -- you can do any additional lsp server setup here + -- -- return true if you don't want this server to be setup with lspconfig + -- ---@type table + -- setup = { + -- -- example to setup with typescript.nvim + -- tsserver = function(_, opts) + -- require("typescript").setup({ server = opts }) + -- return true + -- end, + -- -- Specify * to use this function as a fallback for any server + -- -- ["*"] = function(server, opts) end, + -- }, + -- }, + -- }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "bash", + -- "help", + -- "html", + -- "javascript", + -- "json", + -- "lua", + -- "markdown", + -- "markdown_inline", + -- "python", + -- "query", + -- "regex", + -- "tsx", + -- "typescript", + -- "vim", + -- "yaml", + -- }, + -- }, + -- }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = function(_, opts) + -- -- add tsx and treesitter + -- vim.list_extend(opts.ensure_installed, { + -- "tsx", + -- "typescript", + -- }) + -- end, + -- }, + + -- the opts function can also be used to change the default opts: + -- { + -- "nvim-lualine/lualine.nvim", + -- event = "VeryLazy", + -- opts = function(_, opts) + -- table.insert(opts.sections.lualine_x, "😄") + -- end, + -- }, + + -- or you can return new options to override all the defaults + -- { + -- "nvim-lualine/lualine.nvim", + -- event = "VeryLazy", + -- opts = function() + -- return { + -- --[[add your custom lualine config here]] + -- } + -- end, + -- }, + + -- use mini.starter instead of alpha + -- { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc + -- { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + -- { + -- "williamboman/mason.nvim", + -- opts = { + -- ensure_installed = { + -- "stylua", + -- "shellcheck", + -- "shfmt", + -- "flake8", + -- }, + -- }, + -- }, + + -- Use for completion and snippets (supertab) + -- first: disable default and behavior in LuaSnip + { + "L3MON4D3/LuaSnip", + keys = function() + return {} + end, + }, + -- then: setup supertab in cmp + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-emoji", + }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + + local luasnip = require("luasnip") + local cmp = require("cmp") + + opts.mapping = vim.tbl_extend("force", opts.mapping, { + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }) + end, + }, +} diff --git a/lua/plugins/extra_languages.lua b/lua/plugins/extra_languages.lua new file mode 100644 index 0000000..a4cc9e7 --- /dev/null +++ b/lua/plugins/extra_languages.lua @@ -0,0 +1,5 @@ +return { + { + "jwalton512/vim-blade", + }, +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..4698d40 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,10 @@ +return { + "tpope/vim-fugitive", + keys = { + { "ga", ":Git fetch --all -p", desc = "Git fetch" }, + { "gl", ":Git pull", desc = "Git pull" }, + { "gdh", ":diffget //2", desc = "Git diff grab from left" }, + { "gdl", ":diffget //3", desc = "Git diff grab from right" }, + }, + cmd = { "G", "Git" }, +} diff --git a/lua/plugins/intelephense.lua b/lua/plugins/intelephense.lua new file mode 100644 index 0000000..3503a37 --- /dev/null +++ b/lua/plugins/intelephense.lua @@ -0,0 +1,28 @@ +return { + { + "neovim/nvim-lspconfig", + opts = { + -- @type lspconfig.options + servers = { + intelephense = { + filetypes = { "php", "blade" }, + settings = { + intelephense = { + filetypes = { "php", "blade" }, + files = { + associations = { "*.php", "*.blade.php" }, -- Associating .blade.php files as well + maxSize = 5000000, + }, + }, + }, + cmd = { + "node", + "--max-old-space-size=4096", + "/home/alex/.local/share/nvim/mason/bin/intelephense", + "--stdio", + }, + }, + }, + }, + }, +} diff --git a/lua/plugins/laravel.lua b/lua/plugins/laravel.lua new file mode 100644 index 0000000..7849c59 --- /dev/null +++ b/lua/plugins/laravel.lua @@ -0,0 +1,45 @@ +return { + "adalessa/laravel.nvim", + dependencies = { + "rcarriga/nvim-notify", + "nvim-telescope/telescope.nvim", + "MunifTanjim/nui.nvim", + }, + cmd = { "Sail", "Artisan", "Composer", "Npm", "Laravel", "LaravelInfo", "DockerCompose" }, + keys = { + { "la", ":Laravel artisan", desc = "Laravel Application Commands" }, + { "lr", ":Laravel routes", desc = "Laravel Application Routes" }, + { + "lt", + function() + require("laravel.tinker").send_to_tinker() + end, + mode = "v", + desc = "Laravel Application Routes", + }, + }, + init = function() + vim.g.laravel_log_level = "debug" + end, + config = function() + local uid = vim.system({ "id", "-u" }, { text = true }):wait().stdout or "1000" + local gid = vim.system({ "id", "-g" }, { text = true }):wait().stdout or "1000" + + local user_arg = string.format("%s:%s", vim.trim(uid), vim.trim(gid)) + + require("laravel").setup({ + route_info = { + position = "top", + }, + environment = { + environments = { + ["ao"] = require("laravel.environment.docker_compose").setup({ + container_name = "panel-webserver", + cmd = { "docker", "compose", "exec", "-u", user_arg, "-it", "panel-webserver" }, + }), + }, + }, + }) + require("telescope").load_extension("laravel") + end, +} diff --git a/lua/plugins/mason-nvim-dap.lua b/lua/plugins/mason-nvim-dap.lua new file mode 100644 index 0000000..24455d6 --- /dev/null +++ b/lua/plugins/mason-nvim-dap.lua @@ -0,0 +1,47 @@ +return { + "jay-babu/mason-nvim-dap.nvim", + dependencies = "mason.nvim", + cmd = { "DapInstall", "DapUninstall" }, + opts = { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_setup = true, + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = { + function(config) + -- all sources with no handler get passed here + + -- Keep original functionality + require("mason-nvim-dap").default_setup(config) + end, + php = function(config) + config.configurations = { + { + type = "php", + request = "launch", + name = "Listen for Xdebug", + port = 9003, + pathMappings = { + -- For some reason xdebug sometimes fails for me, depending on me + -- using herd or docker. To get it to work, change the order of the mappings. + -- The first mapping should be the one that you are actively using. + -- This only started recently, so I don't know what changed. + ["${workspaceFolder}"] = "${workspaceFolder}", + ["/var/www/html"] = "${workspaceFolder}", + }, + }, + } + require("mason-nvim-dap").default_setup(config) -- don't forget this! + end, + }, + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + "php", + "bash", + -- "python", + }, + }, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..69ecc4d --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,34 @@ +return { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "actionlint", + "ansible-language-server", + "ansible-lint", + "antlers-language-server", + "black", + "bash-language-server", + "blade-formatter", + "docker-compose-language-service", + "dockerfile-language-server", + "dot-language-server", + "emmet-ls", + "eslint_d", + "flake8", + "hadolint", + "html-lsp", + "intelephense", + "nginx-language-server", + "php-debug-adapter", + "phpstan", + "pint", + "prettierd", + "pyright", + "rustywind", + "shellcheck", + "shfmt", + "stylua", + "tailwindcss-language-server", + }, + }, +} diff --git a/lua/plugins/null-ls.lua b/lua/plugins/null-ls.lua new file mode 100644 index 0000000..79580e6 --- /dev/null +++ b/lua/plugins/null-ls.lua @@ -0,0 +1,24 @@ +return { + { + "nvimtools/none-ls.nvim", + opts = function() + local nls = require("null-ls") + return { + sources = { + nls.builtins.diagnostics.phpstan.with({ + extra_args = { + "--memory-limit=2G", + }, + }), + }, + } + end, + }, + { + -- add longer timeout, since formatting blade files gets a little slow + -- "neovim/nvim-lspconfig", + -- opts = { + -- format = { timeout_ms = 2000 }, + -- }, + }, +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..7912516 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,10 @@ +return { + "nvim-cmp", + opts = function(_, opts) + table.insert(opts.sources, 1, { + name = "copilot", + group_index = 2, + priority = 100, + }) + end, +} diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..2569e45 --- /dev/null +++ b/lua/plugins/nvim-lint.lua @@ -0,0 +1,30 @@ +return { + "mfussenegger/nvim-lint", + event = "LazyFile", + opts = { + -- Event to trigger linters + events = { "BufWritePost", "BufReadPost", "InsertLeave" }, + linters_by_ft = { + fish = { "fish" }, + dockerfile = { "hadolint" }, + -- python = { "pylint" }, + -- Use the "*" filetype to run linters on all filetypes. + -- ['*'] = { 'global linter' }, + -- Use the "_" filetype to run linters on filetypes that don't have other linters configured. + -- ['_'] = { 'fallback linter' }, + }, + -- LazyVim extension to easily override linter options + -- or add custom linters. + ---@type table + linters = { + -- -- Example of using selene only when a selene.toml file is present + -- selene = { + -- -- `condition` is another LazyVim extension that allows you to + -- -- dynamically enable/disable linters based on the context. + -- condition = function(ctx) + -- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1] + -- end, + -- }, + }, + }, +} diff --git a/lua/plugins/php.lua b/lua/plugins/php.lua new file mode 100644 index 0000000..69d6d06 --- /dev/null +++ b/lua/plugins/php.lua @@ -0,0 +1,97 @@ +return { -- lazy + { + "ccaglak/namespace.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + { + "adalessa/composer.nvim", + lazy = true, + }, + }, + -- { + -- "ludovicchabant/vim-gutentags", + -- config = function() + -- vim.g.gutentags_ctags_exclude = { + -- "*.git", + -- "*.svg", + -- "*.hg", + -- "*/tests/*", + -- "build", + -- "dist", + -- "*sites/*/files/*", + -- "bin", + -- "node_modules", + -- "bower_components", + -- "cache", + -- "compiled", + -- "docs", + -- "example", + -- "bundle", + -- "vendor", + -- "*.md", + -- "*-lock.json", + -- "*.lock", + -- "*bundle*.js", + -- "*build*.js", + -- ".*rc*", + -- "*.json", + -- "*.min.*", + -- "*.map", + -- "*.bak", + -- "*.zip", + -- "*.pyc", + -- "*.class", + -- "*.sln", + -- "*.Master", + -- "*.csproj", + -- "*.tmp", + -- "*.csproj.user", + -- "*.cache", + -- "*.pdb", + -- "tags*", + -- "cscope.*", + -- -- '*.css', + -- -- '*.less', + -- -- '*.scss', + -- "*.exe", + -- "*.dll", + -- "*.mp3", + -- "*.ogg", + -- "*.flac", + -- "*.swp", + -- "*.swo", + -- "*.bmp", + -- "*.gif", + -- "*.ico", + -- "*.jpg", + -- "*.png", + -- "*.rar", + -- "*.zip", + -- "*.tar", + -- "*.tar.gz", + -- "*.tar.xz", + -- "*.tar.bz2", + -- "*.pdf", + -- "*.doc", + -- "*.docx", + -- "*.ppt", + -- "*.pptx", + -- } + -- + -- vim.g.gutentags_add_default_project_roots = false + -- vim.g.gutentags_project_root = { "package.json", ".git" } + -- vim.g.gutentags_cache_dir = vim.fn.stdpath("data") .. "/ctags" + -- vim.g.gutentags_generate_on_new = true + -- vim.g.gutentags_generate_on_missing = true + -- vim.g.gutentags_generate_on_write = true + -- vim.g.gutentags_generate_on_empty_buffer = true + -- vim.g.gutentags_modules = true + -- vim.cmd([[command! -nargs=0 GutentagsClearCache call system('rm ' . g:gutentags_cache_dir . '/*')]]) + -- vim.g.gutentags_ctags_extra_args = { "--tag-relative=yes", "--fields=+ailmnS" } + -- + -- -- custom + -- vim.g.gutentags_modules = { "ctags" } + -- end, + -- }, +} diff --git a/lua/plugins/tailwind.lua b/lua/plugins/tailwind.lua new file mode 100644 index 0000000..0118ef9 --- /dev/null +++ b/lua/plugins/tailwind.lua @@ -0,0 +1,43 @@ +return { + { + "neovim/nvim-lspconfig", + opts = { + servers = { + tailwindcss = { + settings = { + tailwindCSS = { + experimental = { + classRegex = { + "@?class\\(([^]*)\\)", + "'([^']*)'", + }, + }, + }, + }, + }, + }, + }, + }, + { + "NvChad/nvim-colorizer.lua", + opts = { + user_default_options = { + tailwind = true, + }, + }, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + { "roobert/tailwindcss-colorizer-cmp.nvim", config = true }, + }, + opts = function(_, opts) + -- original LazyVim kind icon formatter + local format_kinds = opts.formatting.format + opts.formatting.format = function(entry, item) + format_kinds(entry, item) -- add icons + return require("tailwindcss-colorizer-cmp").formatter(entry, item) + end + end, + }, +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..85c4065 --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,24 @@ +return { + -- -- Configure LazyVim to load gruvbox + -- { + -- "LazyVim/LazyVim", + -- opts = { + -- colorscheme = "catppuccin-mocha", + -- }, + -- }, + "neanias/everforest-nvim", + lazy = false, + priority = 1000, + config = function() + require("everforest").setup({ + background = "hard", + transparent_background_level = 0, + italics = true, + disable_italic_comments = false, + ui_contrast = "low", + }) + vim.cmd("let g:everforest_better_performance = 1") + vim.cmd("let g:airline_theme = 'everforest'") + vim.cmd("colorscheme everforest") + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..fd39c56 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,50 @@ +-- add more treesitter parsers +return { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true }) + end, + dependencies = { + { + "JoosepAlviste/nvim-ts-context-commentstring", + opts = { + custom_calculation = function(_, language_tree) + if vim.bo.filetype == "blade" and language_tree._lang ~= "javascript" and language_tree._lang ~= "php" then + return "{{-- %s --}}" + end + end, + }, + }, + "nvim-treesitter/nvim-treesitter-textobjects", + }, + opts = { + ensure_installed = "all", + -- auto_install = true, + highlight = { + enable = true, + }, + -- Needed because treesitter highlight turns off autoindent for php files + indent = { + enable = true, + }, + }, + config = function(_, opts) + ---@class ParserInfo[] + 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", + -- "src/scanner.cc", + }, + branch = "main", + -- generate_requires_npm = true, + -- requires_generate_from_grammar = true, + }, + filetype = "blade", + } + + require("nvim-treesitter.configs").setup(opts) + end, +} diff --git a/queries/blade/folds.scm b/queries/blade/folds.scm new file mode 100644 index 0000000..0705d92 --- /dev/null +++ b/queries/blade/folds.scm @@ -0,0 +1,8 @@ +((directive_start) @start + (directive_end) @end.after + (#set! role block)) + + +((bracket_start) @start + (bracket_end) @end + (#set! role block)) diff --git a/queries/blade/highlights.scm b/queries/blade/highlights.scm new file mode 100644 index 0000000..2c9c2cd --- /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 0000000..bd3ead0 --- /dev/null +++ b/queries/blade/injections.scm @@ -0,0 +1,15 @@ +((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/stylua.toml b/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file