diff --git a/.neoconf.json b/.neoconf.json deleted file mode 100644 index 7c48087..0000000 --- a/.neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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 index 3b56894..51eb82b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ -# πŸ’€ Personal Nvim Setup +# Personal Neovim Setup -This is my personal Neovim Setup based on ([LazyVim](https://www.lazyvim.org/)). I use it for my daily work and I'm happy to share it with you. Feel free to use it as a base for your own setup. +This is my personal Neovim setup, updated in Dezember 2024 from LazyVim to a own configuration Setup. I'm using Neovim as my main editor for coding and writing. The Setup is manly focused on Golang, JavaScript/TypeScript, Python and Lua. -## Setup +## Installation -Setup Neovim on a new System +Clone the repository to your local machine: -```shell -git clone git@github.com:fschuermeyer/nvim-setup.git ~/.config/nvim +```bash +git clone git@github.com/fschuermeyer/nvim-setup.git ~/.config/nvim ``` -On the first Startup use `:MasonLockRestore` to restore the LSP Configuration. diff --git a/init.lua b/init.lua index 30d5aed..d1bd2f9 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,6 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") - --- provider setup -vim.g.python3_host_prog = os.getenv("HOME") .. "/.pyenv/versions/3.11.0/bin/python3" -vim.g.loaded_perl_provider = 0 -vim.g.loaded_ruby_provider = 0 +require("core.options") +require("core.keymaps") +require("core.provider") +require("core.autocmd") +require("core.lazy") +require("core.lspinfo") diff --git a/lazy-lock.json b/lazy-lock.json index f1c7b78..84d68ef 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,44 +1,32 @@ { "CopilotChat.nvim": { "branch": "main", "commit": "2ebe591cff06018e265263e71e1dbc4c5aa8281e" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LazyVim": { "branch": "main", "commit": "31af2075423d0e6d3c4f10ab299498471afe4ea0" }, - "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, - "SchemaStore.nvim": { "branch": "main", "commit": "562681847dd904485caddd42395db2bb9d6e694a" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "alternate-toggler": { "branch": "main", "commit": "819800304d3e8e575fd6aa461a8bcf2217e1cfb6" }, "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, - "bufferline.nvim": { "branch": "main", "commit": "261a72b90d6db4ed8014f7bda976bcdc9dd7ce76" }, - "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, + "bufferline.nvim": { "branch": "main", "commit": "9f0826ae6adfd836a23bf8a4910e3c07450211f4" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-git": { "branch": "main", "commit": "ec049036e354ed8ed0215f2427112882e1ea7051" }, "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "9180320205d250429f0f80e073326c674e2a7149" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, + "copilot-lualine": { "branch": "main", "commit": "f40450c3e138766026327e7807877ea860618258" }, "copilot.lua": { "branch": "master", "commit": "886ee73b6d464b2b3e3e6a7ff55ce87feac423a9" }, + "copilot.vim": { "branch": "release", "commit": "61f11db27b691435590b684ed49cba5a691f1884" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" }, - "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "grug-far.nvim": { "branch": "main", "commit": "c88435b825a35bfa468b47159709b3221976ecd1" }, - "haskell-snippets.nvim": { "branch": "master", "commit": "bd893770dd7a0c1a473601c3c919e61670745b36" }, - "haskell-tools.nvim": { "branch": "master", "commit": "65d6993eba1a56bbd5211ef13a100d26ce3e644a" }, - "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, - "kulala.nvim": { "branch": "main", "commit": "c7efcd01afafae0ab68c2a77cd050b9795edd8ad" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, - "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lock.nvim": { "branch": "main", "commit": "86614f76c3442fba1c5c8d79aa1efcb3ad69de1c" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.ai": { "branch": "main", "commit": "ebb04799794a7f94628153991e6334c3304961b8" }, - "mini.animate": { "branch": "main", "commit": "d14190ac3040116540889e2ebc25f488b195799e" }, - "mini.diff": { "branch": "main", "commit": "00f072250061ef498f91ed226918c9ec31a416a4" }, - "mini.icons": { "branch": "main", "commit": "44c0160526f7ae17ca8e8eab9ab235d047fcf7a6" }, - "neo-tree.nvim": { "branch": "main", "commit": "a9f8943b4c31f8460d25c71e0f463d65e9775f1c" }, - "neotest": { "branch": "master", "commit": "5da58782edb137e75d8ffa149bea48eaa13532f5" }, + "mini.ai": { "branch": "main", "commit": "40e380a589d07ec2c856940c6422aafe5d949a0d" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neotest": { "branch": "master", "commit": "0dccb5ebcf00de245e2060fa17822a9464f5c41a" }, "neotest-go": { "branch": "main", "commit": "92950ad7be2ca02a41abca5c6600ff6ffaf5b5d6" }, "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, @@ -47,35 +35,25 @@ "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-cmp": { "branch": "main", "commit": "b555203ce4bd7ff6192e759af3362f9d217e8c89" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "665d3569a86395fe0dab85efbdb26d7d2ee57e49" }, - "nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" }, - "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, - "nvim-dap-ui": { "branch": "master", "commit": "e94d98649dccb6a3884b66aabc2e07beb279e535" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, - "nvim-lint": { "branch": "master", "commit": "1fea92f1d9908eaa5eb8bafe08b4293d7aadaa55" }, - "nvim-lspconfig": { "branch": "master", "commit": "ff2b85abaa810f6611233dbe6d31c07510ebf43d" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, + "nvim-lspconfig": { "branch": "master", "commit": "8b15a1a597a59f4f5306fad9adfe99454feab743" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, - "nvim-treesitter": { "branch": "master", "commit": "eb3e850acff4d9f2f2dd8dacd75353043c899753" }, - "nvim-treesitter-context": { "branch": "master", "commit": "2bcf700b59bc92850ca83a1c02e86ba832e0fae0" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" }, + "nvim-notify": { "branch": "master", "commit": "c3797193536711b5d8983975791c4b11dc35ab3a" }, + "nvim-treesitter": { "branch": "master", "commit": "5f78e989243f9fb0fb55e0cf54820920d86dfd30" }, "nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" }, - "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, + "nvim-web-devicons": { "branch": "master", "commit": "4adeeaa7a32d46cf3b5833341358c797304f950a" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, - "render-markdown.nvim": { "branch": "main", "commit": "ba6253d9673daf0cf394b87b2c2ecb7630944c7d" }, - "snacks.nvim": { "branch": "main", "commit": "98df370703b3c47a297988f3e55ce99628639590" }, - "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, + "refactoring.nvim": { "branch": "master", "commit": "2db6d378e873de31d18ade549c2edba64ff1c2e3" }, + "ripgrep": { "branch": "master", "commit": "94305125ef33b86151b6cd2ce2b33d641f6b6ac3" }, + "snacks.nvim": { "branch": "main", "commit": "d312053f78b4fb55523def179ac502438dd93193" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" }, + "telescope-themes": { "branch": "main", "commit": "9b7c368b83b82b53c0a6e9e977f8329e5f1fe269" }, + "telescope-undo.nvim": { "branch": "main", "commit": "2971cc9f193ec09e0c5de3563f99cbea16b63f10" }, "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, - "telescope_hoogle": { "branch": "master", "commit": "5c2ae51bcf905a7101134a597e6f7be2dc05f975" }, "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, "tokyonight.nvim": { "branch": "main", "commit": "45d22cf0e1b93476d3b6d362d720412b3d34465c" }, - "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, - "ts-comments.nvim": { "branch": "main", "commit": "872dcfa0418f4a33b7437fb4d9f4e89f2f000d74" }, - "venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" }, - "vim-be-good": { "branch": "master", "commit": "0ae3de14eb8efc6effe7704b5e46495e91931cc5" }, "vim-dadbod": { "branch": "master", "commit": "f740950d0703099e0f172016f10e0e39f50fd0ba" }, - "vim-dadbod-completion": { "branch": "master", "commit": "9e354e86fcc67a5ec2c104f312e374ea2f89c799" }, + "vim-dadbod-completion": { "branch": "master", "commit": "71eb73d1f7399be6a56cc43b928276cd5ca27ffd" }, "vim-dadbod-ui": { "branch": "master", "commit": "0fec59e3e1e619e302198cd491b7d27f8d398b7c" }, "vim-go": { "branch": "master", "commit": "6adc82bfef7f9a4b0db78065ae51b8ebb145c355" }, "vim-tmux-navigator": { "branch": "master", "commit": "d847ea942a5bb4d4fab6efebc9f30d787fd96e65" }, diff --git a/lazyvim.json b/lazyvim.json deleted file mode 100644 index 3dcd8f8..0000000 --- a/lazyvim.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extras": [ - "lazyvim.plugins.extras.ai.copilot", - "lazyvim.plugins.extras.ai.copilot-chat", - "lazyvim.plugins.extras.coding.luasnip", - "lazyvim.plugins.extras.editor.mini-diff", - "lazyvim.plugins.extras.lang.docker", - "lazyvim.plugins.extras.lang.git", - "lazyvim.plugins.extras.lang.go", - "lazyvim.plugins.extras.lang.haskell", - "lazyvim.plugins.extras.lang.json", - "lazyvim.plugins.extras.lang.markdown", - "lazyvim.plugins.extras.lang.php", - "lazyvim.plugins.extras.lang.python", - "lazyvim.plugins.extras.lang.sql", - "lazyvim.plugins.extras.lang.tailwind", - "lazyvim.plugins.extras.lang.toml", - "lazyvim.plugins.extras.lang.typescript", - "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-animate", - "lazyvim.plugins.extras.ui.treesitter-context", - "lazyvim.plugins.extras.util.rest" - ], - "news": { - "NEWS.md": "7429" - }, - "version": 7 -} \ No newline at end of file diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua deleted file mode 100644 index 9b8b069..0000000 --- a/lua/config/autocmds.lua +++ /dev/null @@ -1,28 +0,0 @@ --- 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 - -vim.cmd([[ - autocmd BufNewFile,BufRead *.tmpl set filetype=gohtmltmpl - autocmd BufNewFile,BufRead *.gohtml set filetype=gohtmltmpl - autocmd BufNewFile,BufRead *.gohtmltmpl set filetype=gohtmltmpl - autocmd BufNewFile,BufRead *.gotexttmpl set filetype=gotexttmpl - autocmd BufNewFile,BufRead *.twig set filetype=html -]]) - --- Disable Autoformat for Specific Filetypes -local disable_autoformat = function(pattern) - vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = pattern, - callback = function() - vim.b.autoformat = false - end, - }) -end - --- disable Autoformatting for Stylesheets -disable_autoformat({ "css", "scss", "sass" }) - -disable_autoformat({ "kotlin" }) - -disable_autoformat({ "gohtml", "gohtmltmpl", "tmpl" }) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua deleted file mode 100644 index 41f821f..0000000 --- a/lua/config/keymaps.lua +++ /dev/null @@ -1,51 +0,0 @@ --- 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 enableKey = vim.keymap.set - --- Move Lines --- Alternative Commands for MacOS "option/alt" Key not working -enableKey("n", "", "m .-2==", { desc = "Move Up" }) -enableKey("n", "", "m .+1==", { desc = "Move Down" }) -enableKey("i", "", "m .+1==gi", { desc = "Move Down" }) -enableKey("i", "", "m .-2==gi", { desc = "Move Up" }) -enableKey("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) -enableKey("v", "", ":m '<-2gv=gv", { desc = "Move Up" }) - --- Go (vim-go) -enableKey( - "n", - "tg", - ":GoTestFunc", - { desc = "Testing Golang Function 🐰", silent = true, noremap = true } -) - --- Enable Copilot -enableKey("n", "ce", ":Copilot enable", { desc = "Enable Copilot" }) -enableKey("n", "cx", ":Copilot disable", { desc = "Disable Copilot" }) - --- Tmux Fix move CTRL+A to CTRL+Q -enableKey("n", "", "", { desc = "Increment Numbers", silent = true, noremap = true }) - --- Tmux Navigator -enableKey("n", "", ":TmuxNavigateLeft", { desc = "Tmux Navigate Left", silent = true, noremap = true }) -enableKey("n", "", ":TmuxNavigateDown", { desc = "Tmux Navigate Down", silent = true, noremap = true }) -enableKey("n", "", ":TmuxNavigateUp", { desc = "Tmux Navigate Up", silent = true, noremap = true }) -enableKey("n", "", ":TmuxNavigateRight", { desc = "Tmux Navigate Right", silent = true, noremap = true }) - --- Diffview Keymaps - -enableKey("n", "gf", "DiffviewFileHistory %", { desc = "Diffview Current File" }) -enableKey("n", "gh", "DiffviewFileHistory", { desc = "Diffview History" }) -enableKey("n", "gt", "DiffviewClose", { desc = "Diffview Close" }) -enableKey("n", "gd", "DiffviewOpen", { desc = "Diffview Open" }) -enableKey("n", "gp", "DiffviewOpen origin/HEAD...HEAD --imply-local", { desc = "Diffview Branch" }) - --- Alternate Toggler -enableKey( - "n", - "i", - "lua require('alternate-toggler').toggleAlternate()", - { desc = "Toggle Alternate" } -) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua deleted file mode 100644 index 2dd316a..0000000 --- a/lua/config/lazy.lua +++ /dev/null @@ -1,54 +0,0 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- custom plugins - { import = "lazyvim.plugins.extras.dap.core" }, - -- import/override with your plugins - { import = "plugins" }, - - { "LazyVim", version = "13" }, - }, - 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 = { "tokyonight", "habamax" } }, - checker = { enabled = true }, -- 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 deleted file mode 100644 index 78f507f..0000000 --- a/lua/config/options.lua +++ /dev/null @@ -1,12 +0,0 @@ --- 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.opt.tabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.smarttab = true - -vim.opt.ignorecase = false - --- Disable mouse -vim.opt.mouse = "" diff --git a/lua/core/autocmd.lua b/lua/core/autocmd.lua new file mode 100644 index 0000000..2343265 --- /dev/null +++ b/lua/core/autocmd.lua @@ -0,0 +1,20 @@ +vim.api.nvim_set_hl(0, "YankHighlight", { bg = "#C11B3B", fg = "#F3A3B3" }) + +-- Highlight, was gejankt wurde +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() + vim.highlight.on_yank({ + higroup = "YankHighlight", + timeout = 200, + }) + end, +}) + +-- Highlight for Template Files +vim.cmd([[ + autocmd BufNewFile,BufRead *.tmpl set filetype=gohtmltmpl + autocmd BufNewFile,BufRead *.gohtml set filetype=gohtmltmpl + autocmd BufNewFile,BufRead *.gohtmltmpl set filetype=gohtmltmpl + autocmd BufNewFile,BufRead *.gotexttmpl set filetype=gotexttmpl + autocmd BufNewFile,BufRead *.twig set filetype=html +]]) diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua new file mode 100644 index 0000000..c477db1 --- /dev/null +++ b/lua/core/keymaps.lua @@ -0,0 +1,39 @@ +vim.g.mapleader = " " + +local setKey = vim.keymap.set + +-- Move Lines +local moveUp = { noremap = true, silent = true, desc = "Move the Line Up" } +local moveDown = { noremap = true, silent = true, desc = "Move the Line Down" } +local keyMapUp = "" +local keyMapDown = "" + +setKey("n", keyMapUp, "m .-2==", moveUp) +setKey("n", keyMapDown, "m .+1==", moveDown) + +setKey("i", keyMapUp, "m .-2==gi", moveUp) +setKey("i", keyMapDown, "m .+1==gi", moveDown) + +setKey("v", keyMapUp, ":m '<-2gv=gv", moveUp) +setKey("v", keyMapDown, ":m '>+1gv=gv", moveDown) + +-- Diffview +setKey("n", "gf", "DiffviewFileHistory %", { desc = "Diffview Current File" }) +setKey("n", "gh", "DiffviewFileHistory", { desc = "Diffview History" }) +setKey("n", "gt", "DiffviewClose", { desc = "Diffview Close" }) +setKey("n", "gd", "DiffviewOpen", { desc = "Diffview Open" }) +setKey("n", "gp", "DiffviewOpen origin/HEAD...HEAD --imply-local", { desc = "Diffview Branch" }) + +-- Window Mappings +setKey("n", "#", "vsplit", { desc = "Split Window Vertically" }) +setKey("n", "-", "split", { desc = "Split Window Horizontally" }) + +-- AlternateToggler +setKey("n", "i", "ToggleAlternate", { desc = "Toggle State" }) + +-- VimGo +setKey("n", "tg", "GoTestFunc", { desc = "Test Golang" }) + +-- Center after Scroll +setKey("n", "", "zz", { desc = "Center after Scroll" }) +setKey("n", "", "zz", { desc = "Center after Scroll" }) diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua new file mode 100644 index 0000000..d910984 --- /dev/null +++ b/lua/core/lazy.lua @@ -0,0 +1,30 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + { import = "plugins.lsp" } + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/core/lspinfo.lua b/lua/core/lspinfo.lua new file mode 100644 index 0000000..d3f034d --- /dev/null +++ b/lua/core/lspinfo.lua @@ -0,0 +1,93 @@ +local state = { + floating = { + buf = -1, + win = -1, + } +} + +local function create_floating_window(opts) + opts = opts or {} + local width = opts.width or math.floor(vim.o.columns * 0.2) + local height = opts.height or math.floor(vim.o.lines * 0.2) + + -- Calculate the position to center the window + local col = math.floor((vim.o.columns - width) / 2) + local row = math.floor((vim.o.lines - height) / 2) + + -- Create a buffer + local buf = nil + if vim.api.nvim_buf_is_valid(opts.buf) then + buf = opts.buf + else + buf = vim.api.nvim_create_buf(false, true) -- No file, scratch buffer + end + + local win_config = { + relative = "editor", + width = width, + height = height, + col = col, + row = row, + style = "minimal", -- No borders or extra UI elements + border = "rounded", + } + + local win = vim.api.nvim_open_win(buf, true, win_config) + + return { buf = buf, win = win } +end + +local function highlight_dashed_lines(buf, lines) + for i, line in ipairs(lines) do + if line == "---" then + vim.api.nvim_buf_add_highlight(buf, -1, "diffIndexLine", i - 1, 0, -1) + end + end +end + +vim.api.nvim_set_hl(0, "BoldTitle", { bold = true, fg = "#4B5FEC" }) + +local function show_lsp_info_in_buffer(buf) + local clients = vim.lsp.get_clients() + local lines = {} + + if #clients == 0 then + table.insert(lines, "Keine aktiven LSP-Clients gefunden.") + else + table.insert(lines, "Aktive LSP-Clients:") + table.insert(lines, "---") + + for _, client in ipairs(clients) do + table.insert(lines, "Client-Name: " .. client.name) + table.insert(lines, "Server-ID: " .. client.id) + + table.insert(lines, "---") + end + end + + vim.api.nvim_buf_set_option(buf, "readonly", false) + vim.api.nvim_buf_set_option(buf, "modifiable", true) + + vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines) + vim.api.nvim_buf_add_highlight(buf, -1, "BoldTitle", 0, 0, -1) + highlight_dashed_lines(buf, lines) + + vim.api.nvim_buf_set_option(buf, "readonly", true) + vim.api.nvim_buf_set_option(buf, "modifiable", false) + + vim.api.nvim_buf_set_keymap(buf, "n", "q", ":q", { noremap = true, silent = true }) +end + +local toggle_lsp_info = function() + if not vim.api.nvim_win_is_valid(state.floating.win) then + state.floating = create_floating_window { buf = state.floating.buf } + + show_lsp_info_in_buffer(state.floating.buf) + else + vim.api.nvim_win_hide(state.floating.win) + end +end + +vim.api.nvim_create_user_command("LspClients", toggle_lsp_info, {}) + +vim.keymap.set("n", "cl", ":LspClients", { noremap = true, silent = true, desc = "LSP Clients anzeigen" }) diff --git a/lua/core/options.lua b/lua/core/options.lua new file mode 100644 index 0000000..4c55b69 --- /dev/null +++ b/lua/core/options.lua @@ -0,0 +1,30 @@ +local opt = vim.opt + +-- Nvim Options +-- Tab settings +opt.tabstop = 4 +opt.shiftwidth = 4 +opt.smarttab = true +opt.autoindent = true +opt.smartindent = true +opt.expandtab = true -- Use spaces instead of tabs + +-- Line Configs +opt.number = true +opt.relativenumber = true +opt.cursorline = true +opt.wrap = false + +opt.termguicolors = true +opt.mouse = "" +opt.clipboard = "unnamedplus" -- System Clipboard + +-- Persitent Undo History +opt.undofile = true +opt.undodir = vim.fn.stdpath("data") .. "/undo" +opt.undolevels = 10000 + +opt.splitright = true +opt.splitbelow = true + +opt.confirm = true diff --git a/lua/core/provider.lua b/lua/core/provider.lua new file mode 100644 index 0000000..fae41fa --- /dev/null +++ b/lua/core/provider.lua @@ -0,0 +1,3 @@ +-- disable provider +vim.g.loaded_perl_provider = 0 +vim.g.loaded_ruby_provider = 0 diff --git a/lua/plugins/additional.lua b/lua/plugins/additional.lua deleted file mode 100644 index b94016e..0000000 --- a/lua/plugins/additional.lua +++ /dev/null @@ -1,20 +0,0 @@ -return { - "christoomey/vim-tmux-navigator", - "ThePrimeagen/vim-be-good", - "sindrets/diffview.nvim", - "rmagatti/alternate-toggler", - { - "echasnovski/mini.pairs", - enabled = false, - }, - { - "LunarVim/bigfile.nvim", - event = "BufReadPre", - opts = { - filesize = 3, - }, - config = function(_, opts) - require("bigfile").setup(opts) - end, - }, -} diff --git a/lua/plugins/alternate-toggler.lua b/lua/plugins/alternate-toggler.lua new file mode 100644 index 0000000..5588148 --- /dev/null +++ b/lua/plugins/alternate-toggler.lua @@ -0,0 +1,3 @@ +return { + "rmagatti/alternate-toggler", +} diff --git a/lua/plugins/bigfile.lua b/lua/plugins/bigfile.lua new file mode 100644 index 0000000..7f308b5 --- /dev/null +++ b/lua/plugins/bigfile.lua @@ -0,0 +1,10 @@ +return { + "LunarVim/bigfile.nvim", + event = "BufReadPre", + opts = { + filesize = 1, + }, + config = function(_, opts) + require("bigfile").setup(opts) + end, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua new file mode 100644 index 0000000..d59c0f8 --- /dev/null +++ b/lua/plugins/bufferline.lua @@ -0,0 +1,17 @@ +return { + 'akinsho/bufferline.nvim', + dependencies = 'nvim-tree/nvim-web-devicons', + event = "VeryLazy", + keys = { + { "bp", "BufferLineTogglePin", desc = "Toggle Pin" }, + { "bP", "BufferLineGroupClose ungrouped", desc = "Delete Non-Pinned Buffers" }, + { "br", "BufferLineCloseRight", desc = "Delete Buffers to the Right" }, + { "bl", "BufferLineCloseLeft", desc = "Delete Buffers to the Left" }, + { "bs", "Telescope buffers", desc = "Search Buffer" }, + { "", "BufferLineCyclePrev", desc = "Prev Buffer" }, + { "", "BufferLineCycleNext", desc = "Next Buffer" }, + }, + config = function() + require("bufferline").setup() + end +} diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua new file mode 100644 index 0000000..452499b --- /dev/null +++ b/lua/plugins/colorizer.lua @@ -0,0 +1,19 @@ +return { + { + "norcalli/nvim-colorizer.lua", + event = "BufEnter", + config = function() + require("colorizer").setup({ "*" }, { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + RRGGBBAA = true, -- #RRGGBBAA hex codes + names = true, -- "Name" codes like Blue + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + }) + end, + + }, +} diff --git a/lua/plugins/colorschema.lua b/lua/plugins/colorschema.lua new file mode 100644 index 0000000..d3d84a2 --- /dev/null +++ b/lua/plugins/colorschema.lua @@ -0,0 +1,16 @@ +return { + "folke/tokyonight.nvim", + priority = 1000, + config = function() + ---@diagnostic disable-next-line: missing-fields + require("tokyonight").setup({ + transparent = true, + style = "night", + styles = { + sidebars = "transparent", + floats = "transparent", + }, + }) + vim.cmd("colorscheme tokyonight") + end, +} diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua new file mode 100644 index 0000000..4f29207 --- /dev/null +++ b/lua/plugins/copilot.lua @@ -0,0 +1,215 @@ +-- Some Parts from: https://github.com/jellydn/lazy-nvim-ide/blob/main/lua/plugins/extras/copilot-chat-v2.lua +local prompts = { + -- Code related prompts + Explain = "Please explain how the following code works.", + Review = "Please review the following code and provide suggestions for improvement.", + Tests = "Please explain how the selected code works, then generate unit tests for it.", + Refactor = "Please refactor the following code to improve its clarity and readability.", + FixCode = "Please fix the following code to make it work as intended.", + FixError = "Please explain the error in the following text and provide a solution.", + BetterNamings = "Please provide better names for the following variables and functions.", + Documentation = "Please provide documentation for the following code.", + SwaggerApiDocs = "Please provide documentation for the following API using Swagger.", + SwaggerJsDocs = "Please write JSDoc for the following API using Swagger.", + -- Text related prompts + Summarize = "Please summarize the following text.", + Spelling = "Please correct any grammar and spelling errors in the following text.", + Wording = "Please improve the grammar and wording of the following text.", + Concise = "Please rewrite the following text to make it more concise.", +} + +return { + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + build = ":Copilot auth", + event = "InsertEnter", + config = function() + require("copilot").setup({ + suggestion = { + enabled = false, + auto_trigger = true, + keymap = { + accept = false, + next = false, + prev = false, + }, + }, + panel = { enabled = false }, + }) + end, + }, + { + "zbirenbaum/copilot-cmp", + config = function() + require("copilot_cmp").setup() + end, + }, + -- Copilot Chat + { + "CopilotC-Nvim/CopilotChat.nvim", + -- version = "v3.3.0", -- Use a specific version to prevent breaking changes + dependencies = { + { "zbirenbaum/copilot.vim" }, -- or zbirenbaum/copilot.lua + { "nvim-telescope/telescope.nvim" }, -- Use telescope for help actions + { "nvim-lua/plenary.nvim" }, + }, + opts = { + question_header = " " .. (vim.env.GITHUB_USER or vim.env.USER or "User") .. " ", + answer_header = "ο’Έ Copilot ", + error_header = "## Error ", + prompts = prompts, + mappings = { + -- Use tab for completion + complete = { + detail = "Use @ or / for options.", + insert = "", + }, + -- Close the chat + close = { + normal = "q", + insert = "", + }, + -- Reset the chat buffer + reset = { + normal = "", + insert = "", + }, + -- Show help + show_help = { + normal = "g?", + }, + }, + window = { + layout = "vertical", + width = 0.4, + }, + }, + config = function(_, opts) + local chat = require("CopilotChat") + chat.setup(opts) + + local select = require("CopilotChat.select") + vim.api.nvim_create_user_command("CopilotChatVisual", function(args) + chat.ask(args.args, { selection = select.visual }) + end, { nargs = "*", range = true }) + + -- Inline chat with Copilot + vim.api.nvim_create_user_command("CopilotChatInline", function(args) + chat.ask(args.args, { + selection = select.visual, + window = { + layout = "float", + relative = "cursor", + width = 1, + height = 0.4, + row = 1, + }, + }) + end, { nargs = "*", range = true }) + + -- Restore CopilotChatBuffer + vim.api.nvim_create_user_command("CopilotChatBuffer", function(args) + chat.ask(args.args, { selection = select.buffer }) + end, { nargs = "*", range = true }) + + -- Custom buffer for CopilotChat + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "copilot-*", + callback = function() + vim.opt_local.relativenumber = true + vim.opt_local.number = true + + -- Get current filetype and set it to markdown if the current filetype is copilot-chat + local ft = vim.bo.filetype + if ft == "copilot-chat" then + vim.bo.filetype = "markdown" + end + end, + }) + end, + event = "VeryLazy", + keys = { + { + "a", + "", + desc = "+ai", + mode = { "n", "v" }, + }, + -- Show prompts actions with telescope + { + "ap", + function() + local actions = require("CopilotChat.actions") + require("CopilotChat.integrations.telescope").pick(actions.prompt_actions()) + end, + desc = "CopilotChat - Prompt actions", + }, + { + "ap", + ":lua require('CopilotChat.integrations.telescope').pick(require('CopilotChat.actions').prompt_actions({selection = require('CopilotChat.select').visual}))", + mode = "x", + desc = "CopilotChat - Prompt actions", + }, + -- Code related commands + { "ae", "CopilotChatExplain", desc = "CopilotChat - Explain code" }, + { "at", "CopilotChatTests", desc = "CopilotChat - Generate tests" }, + { "ar", "CopilotChatReview", desc = "CopilotChat - Review code" }, + { "aR", "CopilotChatRefactor", desc = "CopilotChat - Refactor code" }, + { "an", "CopilotChatBetterNamings", desc = "CopilotChat - Better Naming" }, + -- Chat with Copilot in visual mode + { + "av", + ":CopilotChatVisual", + mode = "x", + desc = "CopilotChat - Open in vertical split", + }, + { + "ax", + ":CopilotChatInline", + mode = "x", + desc = "CopilotChat - Inline chat", + }, + -- Custom input for CopilotChat + { + "ai", + function() + local input = vim.fn.input("Ask Copilot: ") + if input ~= "" then + vim.cmd("CopilotChat " .. input) + end + end, + desc = "CopilotChat - Ask input", + }, + -- Generate commit message based on the git diff + { + "am", + "CopilotChatCommit", + desc = "CopilotChat - Generate commit message for all changes", + }, + -- Quick chat with Copilot + { + "aq", + function() + local input = vim.fn.input("Quick Chat: ") + if input ~= "" then + vim.cmd("CopilotChatBuffer " .. input) + end + end, + desc = "CopilotChat - Quick chat", + }, + -- Debug + { "ad", "CopilotChatDebugInfo", desc = "CopilotChat - Debug Info" }, + -- Fix the issue with diagnostic + { "af", "CopilotChatFixDiagnostic", desc = "CopilotChat - Fix Diagnostic" }, + -- Clear buffer and chat history + { "al", "CopilotChatReset", desc = "CopilotChat - Clear buffer and chat history" }, + -- Toggle Copilot Chat Vsplit + { "aa", "CopilotChatToggle", desc = "CopilotChat - Toggle" }, + -- Copilot Chat Models + { "a?", "CopilotChatModels", desc = "CopilotChat - Select Models" }, + -- Copilot Chat Agents + { "as", "CopilotChatAgents", desc = "CopilotChat - Select Agents" }, + }, + }, +} diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua new file mode 100644 index 0000000..f45f634 --- /dev/null +++ b/lua/plugins/dadbod.lua @@ -0,0 +1,27 @@ +return { + 'kristijanhusak/vim-dadbod-ui', + dependencies = { + { 'tpope/vim-dadbod', lazy = true }, + { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, + }, + keys = { + { "D", "DBUIToggle", desc = "Toggle DBUI" }, + }, + cmd = { + 'DBUI', + 'DBUIToggle', + 'DBUIAddConnection', + 'DBUIFindBuffer', + }, + init = function() + local data_path = vim.fn.stdpath("data") + + vim.g.db_ui_auto_execute_table_helpers = 1 + vim.g.db_ui_save_location = data_path .. "/dadbod_ui" + vim.g.db_ui_show_database_icon = true + vim.g.db_ui_tmp_query_location = data_path .. "/dadbod_ui/tmp" + vim.g.db_ui_use_nerd_fonts = true + vim.g.db_ui_use_nvim_notify = true + vim.g.db_ui_execute_on_save = false + end, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..e4a3402 --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,3 @@ +return { + "sindrets/diffview.nvim", +} diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua new file mode 100644 index 0000000..32df64b --- /dev/null +++ b/lua/plugins/dressing.lua @@ -0,0 +1,4 @@ +return { + "stevearc/dressing.nvim", + event = "VeryLazy", +} diff --git a/lua/plugins/folke-noice.lua b/lua/plugins/folke-noice.lua new file mode 100644 index 0000000..7639fbb --- /dev/null +++ b/lua/plugins/folke-noice.lua @@ -0,0 +1,48 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + }, + config = function() + ---@diagnostic disable-next-line: missing-fields + require("noice").setup({ + views = { + cmdline_popup = { + position = { + row = 5, + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + popupmenu = { + relative = "editor", + position = { + row = 8, + col = "50%", + }, + size = { + width = 60, + height = 10, + }, + border = { + style = "rounded", + padding = { 0, 1 }, + }, + win_options = { + winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" }, + }, + }, + }, + }) + + local set = vim.keymap.set + + set("n", "mx", "Noice dismiss", { noremap = true, silent = true, desc = "Dismiss Messages" }) + set("n", "ml", "Noice last", { noremap = true, silent = true, desc = "Last Message" }) + set("n", "mh", "Noice telescope", { noremap = true, silent = true, desc = "History" }) + end, +} diff --git a/lua/plugins/folke-snacks.lua b/lua/plugins/folke-snacks.lua new file mode 100644 index 0000000..bbba0ea --- /dev/null +++ b/lua/plugins/folke-snacks.lua @@ -0,0 +1,70 @@ +local logo = [[ +`8.`888b ,8' 8 8888 ,8. ,8. + `8.`888b ,8' 8 8888 ,888. ,888. + `8.`888b ,8' 8 8888 .`8888. .`8888. + `8.`888b ,8' 8 8888 ,8.`8888. ,8.`8888. + `8.`888b ,8' 8 8888 ,8'8.`8888,8^8.`8888. + `8.`888b ,8' 8 8888 ,8' `8.`8888' `8.`8888. + `8.`888b8' 8 8888 ,8' `8.`88' `8.`8888. + `8.`888' 8 8888 ,8' `8.`' `8.`8888. + `8.`8' 8 8888 ,8' `8 `8.`8888. + `8.` 8 8888 ,8' ` `8.`8888. + +github.com/fschuermeyer/nvim-setup +]] + +return { + "folke/snacks.nvim", + lazy = false, + opts = { + dashboard = { + preset = { + header = logo, + }, + sections = { + { section = "header" }, + { section = "keys", gap = 1, padding = 1 }, + { + icon = "ο…› ", + title = "Recent Files", + cwd = true, + section = "recent_files", + indent = 2, + padding = 1, + }, + { icon = " ", title = "Projects", section = "projects", indent = 2, padding = 2 }, + { section = "startup" }, + }, + }, + indent = { + enabled = true, + animate = { + duration = { + step = 5, + total = 250, + }, + }, + }, + scope = { enabled = true }, + scroll = { enabled = true }, + notifier = { enabled = true }, + }, + config = function(_, opts) + require("snacks").setup(opts) + + vim.api.nvim_set_hl(0, "SnacksDashboardHeader", { fg = "#FFA500" }) -- Orange Farbe + vim.keymap.set("n", "cR", Snacks.rename.rename_file, { desc = "Rename File" }) + + vim.keymap.set("n", "bd", function() + Snacks.bufdelete() + end, { desc = "Delete Buffer" }) + vim.keymap.set("n", "bo", function() + Snacks.bufdelete.other() + end, { desc = "Delete Other Buffers" }) + + Snacks.toggle.option("wrap", { name = "Line Wrap" }):map("uw") + Snacks.toggle.option("number", { name = "Line Numbers" }):map("un") + Snacks.toggle.option("relativenumber", { name = "Relative Line Numbers" }):map("ur") + Snacks.toggle.option("cursorline", { name = "Cursorline" }):map("uc") + end, +} diff --git a/lua/plugins/folke-todo-comments.lua b/lua/plugins/folke-todo-comments.lua new file mode 100644 index 0000000..0009823 --- /dev/null +++ b/lua/plugins/folke-todo-comments.lua @@ -0,0 +1,5 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, +} diff --git a/lua/plugins/folke-which-key.lua b/lua/plugins/folke-which-key.lua new file mode 100644 index 0000000..7d8ddb2 --- /dev/null +++ b/lua/plugins/folke-which-key.lua @@ -0,0 +1,20 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + preset = "modern", + sort = { "alphanum" }, + spec = { + mode = { "n", "v" }, + { "m", group = "message", icon = { icon = " ", color = "blue" } }, + { "e", icon = { icon = " ", color = "yellow" } }, + { "t", icon = { icon = "󰙨 ", color = "green" }, group = "test" }, + { "b", group = "buffer", icon = { icon = "ξΎ– ", color = "yellow" } }, + { "c", group = "code" }, + { "d", group = "debug" }, + { "f", group = "file/find" }, + { "g", group = "git" }, + { "u", group = "ui", icon = { icon = "σ°™΅ ", color = "cyan" } }, + }, + }, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..7c5d6c7 --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,49 @@ +return { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "β–Ž" }, + change = { text = "β–Ž" }, + delete = { text = "οƒš" }, + topdelete = { text = "οƒš" }, + changedelete = { text = "β–Ž" }, + untracked = { text = "β–Ž" }, + }, + signs_staged = { + add = { text = "β–Ž" }, + change = { text = "β–Ž" }, + delete = { text = "οƒš" }, + topdelete = { text = "οƒš" }, + changedelete = { text = "β–Ž" }, + }, + current_line_blame = true, + current_line_blame_opts = { + delay = 400, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function setMap(mode, key, action, desc) + vim.keymap.set(mode, key, action, { buffer = buffer, desc = desc }) + end + + -- git + setMap("n", "gb", function() + gs.blame_line({ full = true }) + end, "Git Blame") + + -- ui + setMap("n", "ub", ":Gitsigns toggle_current_line_blame", "Toggle Current Line Git Blame") + + Snacks.toggle({ + name = "Git Signs", + get = function() + return require("gitsigns.config").config.signcolumn + end, + set = function(state) + require("gitsigns").toggle_signs(state) + end, + }):map("ug") + end, + }, +} diff --git a/lua/plugins/go.lua b/lua/plugins/go.lua deleted file mode 100644 index 912f771..0000000 --- a/lua/plugins/go.lua +++ /dev/null @@ -1,15 +0,0 @@ --- Go Plugins - -return { - { - "fatih/vim-go", - run = ":GoUpdateBinaries", - config = function() - -- vim-go Einstellungen hier - vim.g.go_def_mode = "gopls" - vim.g.go_info_mode = "gopls" - vim.g.go_fmt_command = "goimports" - vim.g.go_auto_type_info = 1 - end, - }, -} diff --git a/lua/plugins/lsp/lspconfig.lua b/lua/plugins/lsp/lspconfig.lua new file mode 100644 index 0000000..65fc8b7 --- /dev/null +++ b/lua/plugins/lsp/lspconfig.lua @@ -0,0 +1,169 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "antosha417/nvim-lsp-file-operations", config = true }, + { "folke/neodev.nvim", opts = {} }, + }, + config = function() + -- import lspconfig plugin + local lspconfig = require("lspconfig") + + -- import mason_lspconfig plugin + local mason_lspconfig = require("mason-lspconfig") + + -- import cmp-nvim-lsp plugin + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + + local keymap = vim.keymap -- for conciseness + + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf, silent = true } + + -- set keybinds + opts.desc = "Show references" + keymap.set("n", "gr", "Telescope lsp_references", opts) -- show definition, references + + opts.desc = "Go to declaration" + keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = "Show definitions" + keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions + + opts.desc = "Show implementations" + keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations + + opts.desc = "Show type definitions" + keymap.set("n", "gy", "Telescope lsp_type_definitions", opts) -- show lsp type definitions + + opts.desc = "See available code actions" + keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = "Rename" + keymap.set("n", "cr", vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = "Show buffer diagnostics" + keymap.set("n", "d", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file + + opts.desc = "Go to previous diagnostic" + keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer + + opts.desc = "Go to next diagnostic" + keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer + + opts.desc = "Show documentation for what is under cursor" + keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = "Restart LSP" + keymap.set("n", "cs", ":LspRestart", opts) -- mapping to restart lsp if necessary + end, + }) + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = cmp_nvim_lsp.default_capabilities() + + -- Change the Diagnostic symbols in the sign column (gutter) + -- (not in youtube nvim video) + local signs = { Error = " ", Warn = " ", Hint = "σ°   ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- Format on Save + local on_attach = function(client, bufnr) + if client.server_capabilities.documentFormattingProvider then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("LspFormatting", { clear = true }), + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + async = false, + timeout_ms = 3000, + }) + end, + }) + end + end + + local on_attach_disable_formatting = function(client, _) + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + end + + mason_lspconfig.setup_handlers({ + -- default handler for installed servers + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end, + ["emmet_ls"] = function() + -- configure emmet language server + lspconfig["emmet_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + filetypes = { + "html", + "typescriptreact", + "javascriptreact", + "css", + "sass", + "scss", + "less", + "svelte", + }, + }) + end, + ["lua_ls"] = function() + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, + }, + }, + }) + end, + ["cssls"] = function() + lspconfig["cssls"].setup({ + capabilities = capabilities, + on_attach = on_attach_disable_formatting, + settings = { + init_options = { + provideFormatter = false, + }, + }, + }) + end, + ["stylelint_lsp"] = function() + lspconfig["stylelint_lsp"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { + stylelintplus = { + autoFixOnSave = true, + autoFixOnFormat = true + } + }, + filetypes = { "css", "less", "scss", "sugarss", "vue", "wxss", "sass" } + }) + end, + }) + end, +} diff --git a/lua/plugins/lsp/mason.lua b/lua/plugins/lsp/mason.lua new file mode 100644 index 0000000..b35585d --- /dev/null +++ b/lua/plugins/lsp/mason.lua @@ -0,0 +1,89 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + -- import mason + local mason = require("mason") + -- import mason-lspconfig + local mason_lspconfig = require("mason-lspconfig") + + local mason_tool_installer = require("mason-tool-installer") + + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "βœ“", + package_pending = "➜", + package_uninstalled = "βœ—", + }, + }, + }) + + mason_lspconfig.setup({ + automatic_installation = true, + -- list of servers for mason to install + ensure_installed = { + "bashls", -- Bash language support + "cssls", -- CSS language support + "css_variables", -- CSS Variables support + "docker_compose_language_service", -- Docker Compose language support + "dockerls", -- Dockerfile language support + "emmet_ls", -- Emmet language support + "eslint", -- ESLint language support + "gopls", -- Go language server + "groovyls", -- Groovy language support + "hls", -- Haskell language server + "html", -- HTML language support + "intelephense", -- PHP language support + "jedi_language_server", -- Python language server + "jsonls", -- JSON language support + "kotlin_language_server", -- Kotlin language support + "lua_ls", -- Lua language server + "pyright", -- Python language server + "tailwindcss", -- Tailwind CSS language support + "ts_ls", -- TypeScript language support + "yamlls", -- YAML language support + "vtsls", -- Vue and TypeScript support + "volar", -- Vue.js language support + "stimulus_ls", -- Stimulus language support + "stylelint_lsp" -- Stylint LSP + }, + }) + + mason_tool_installer.setup({ + ensure_installed = { + "autoflake", -- Python tool + "debugpy", -- Python debugger + "delve", -- Go debugger + "eslint_d", -- Faster ESLint + "gofumpt", -- Go formatter + "goimports", -- Go imports formatter + "golangci-lint-langserver", -- Go linter + "hadolint", -- Dockerfile linter + "haskell-debug-adapter", -- Haskell debugger + "isort", -- Python import sorter + "markdownlint-cli2", -- Markdown linter + "marksman", -- Markdown language server + "php-cs-fixer", -- PHP formatter + "php-debug-adapter", -- PHP debugger + "phpactor", -- PHP language server + "phpcs", -- PHP linter + "prettier", -- Code formatter + "ruff", -- Python linter + "shfmt", -- Shell formatter + "sqlfluff", -- SQL formatter and linter + "stylua", -- Lua formatter + "taplo", -- TOML language server + "markdown-toc", -- Markdown TOC generator + "shellcheck", -- Shell script analysis + "shfmt", -- Shell script formatter + "ruff-lsp", -- Python linter support + "js-debug-adapter", -- JavaScript debug adapter + }, + }) + end, +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..9164971 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,19 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons", "AndreM222/copilot-lualine" }, + config = function() + local lualine = require("lualine") + + lualine.setup({ + extensions = { "neo-tree" }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { 'filename' }, + lualine_x = { 'copilot', 'encoding', 'fileformat', 'filetype' }, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + }, + }) + end, +} diff --git a/lua/plugins/mason-lock.lua b/lua/plugins/mason-lock.lua deleted file mode 100644 index 0eaf393..0000000 --- a/lua/plugins/mason-lock.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - "zapling/mason-lock.nvim", - init = function() - require("mason-lock").setup({ - lockfile_path = vim.fn.stdpath("config") .. "/mason-lock.json", -- (default) - }) - end, - }, -} diff --git a/lua/plugins/mini-ai.lua b/lua/plugins/mini-ai.lua new file mode 100644 index 0000000..7c4555b --- /dev/null +++ b/lua/plugins/mini-ai.lua @@ -0,0 +1,92 @@ +return { + { + "echasnovski/mini.ai", + version = "*", -- Use the latest version + event = "VeryLazy", + config = function(_, opts) + local ai = require("mini.ai") + ai.setup({ + mappings = { + around = "a", -- Default mapping for "around" textobject + inside = "i", -- Default mapping for "inside" textobject + }, + custom_textobjects = { + o = ai.gen_spec.treesitter({ -- code block + a = { "@block.outer", "@conditional.outer", "@loop.outer" }, + i = { "@block.inner", "@conditional.inner", "@loop.inner" }, + }), + f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }), -- function + c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }), -- class + t = { "<([%p%w]-)%f[^<%w][^<>]->.-", "^<.->().*()$" }, -- tags + d = { "%f[%d]%d+" }, -- digits + e = { -- Word with case + { + "%u[%l%d]+%f[^%l%d]", + "%f[%S][%l%d]+%f[^%l%d]", + "%f[%P][%l%d]+%f[^%l%d]", + "^[%l%d]+%f[^%l%d]", + }, + "^().*()$", + }, + u = ai.gen_spec.function_call(), -- u for "Usage" + U = ai.gen_spec.function_call({ name_pattern = "[%w_]" }), -- without dot in function name + }, + }) + + local objects = { + { " ", desc = "whitespace" }, + { '"', desc = '" string' }, + { "'", desc = "' string" }, + { "(", desc = "() block" }, + { ")", desc = "() block with ws" }, + { "<", desc = "<> block" }, + { ">", desc = "<> block with ws" }, + { "?", desc = "user prompt" }, + { "U", desc = "use/call without dot" }, + { "[", desc = "[] block" }, + { "]", desc = "[] block with ws" }, + { "_", desc = "underscore" }, + { "`", desc = "` string" }, + { "a", desc = "argument" }, + { "b", desc = ")]} block" }, + { "c", desc = "class" }, + { "d", desc = "digit(s)" }, + { "e", desc = "CamelCase / snake_case" }, + { "f", desc = "function" }, + { "i", desc = "indent" }, + { "o", desc = "block, conditional, loop" }, + { "q", desc = "quote `\"'" }, + { "t", desc = "tag" }, + { "u", desc = "use/call" }, + { "{", desc = "{} block" }, + { "}", desc = "{} with ws" }, + } + ---@type wk.Spec[] + local ret = { mode = { "o", "x" } } + ---@type table + local mappings = vim.tbl_extend("force", {}, { + around = "a", + inside = "i", + around_next = "an", + inside_next = "in", + around_last = "al", + inside_last = "il", + }, opts.mappings or {}) + mappings.goto_left = nil + mappings.goto_right = nil + + for name, prefix in pairs(mappings) do + name = name:gsub("^around_", ""):gsub("^inside_", "") + ret[#ret + 1] = { prefix, group = name } + for _, obj in ipairs(objects) do + local desc = obj.desc + if prefix:sub(1, 1) == "i" then + desc = desc:gsub(" with ws", "") + end + ret[#ret + 1] = { prefix .. obj[1], desc = obj.desc } + end + end + require("which-key").add(ret, { notify = false }) + end, + }, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..040028d --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,69 @@ +local function get_javascript_adapter_test() + local jestCommand = vim.fn.executable("yarn") == 1 and "yarn jest" or "npx jest" + + if vim.fn.findfile("jest.config.js", ".;") ~= "" or vim.fn.findfile("jest.config.ts", ".;") ~= "" then + return require("neotest-jest")({ + jestConfigFile = "jest.config.js", + jestCommand = jestCommand, + }) + end + + if vim.fn.findfile("vite.config.js", ".;") ~= "" or vim.fn.findfile("vite.config.ts", ".;") ~= "" then + return require("neotest-vitest")({ + is_test_file = function(file_path) + if string.match(file_path, "test.ts") then + return true + end + end, + }) + end + + return nil +end + +return { + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-neotest/neotest-go", + "nvim-neotest/neotest-python", + "nvim-neotest/neotest-jest", + "marilari88/neotest-vitest", + }, + keys = { + { "t", "", desc = "+test" }, + { "tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File (Neotest)" }, + { "tr", function() require("neotest").run.run() end, desc = "Run Nearest (Neotest)" }, + { "tl", function() require("neotest").run.run_last() end, desc = "Run Last (Neotest)" }, + { "ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary (Neotest)" }, + { "to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output (Neotest)" }, + { "tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel (Neotest)" }, + { "tS", function() require("neotest").run.stop() end, desc = "Stop (Neotest)" }, + }, + config = function() + local goAdapter = require("neotest-go")({ + args = { "-v" }, + }) + + local pyAdapter = require("neotest-python")({ + args = { "-s", "-vv" }, + runner = "pytest", + }) + + local jsAdapter = get_javascript_adapter_test() + + ---@diagnostic disable-next-line: missing-fields + require("neotest").setup({ + adapters = { goAdapter, pyAdapter, jsAdapter }, + ---@diagnostic disable-next-line: missing-fields + diagnostic = { + enable = true, + }, + }) + end, + }, +} diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index aba0273..93fd69b 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -1,17 +1,39 @@ return { - "nvim-neo-tree/neo-tree.nvim", - config = function() - local neo_tree = require("neo-tree") + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + local neo_tree = require("neo-tree") - neo_tree.setup({ - filesystem = { - filtered_items = { - visible = true, - }, - }, - source_selector = { - winbar = true, - }, - }) - end, + neo_tree.setup({ + window = { + mappings = { + -- fix: german layout + ["<"] = "next_source", + [">"] = "prev_source", + }, + }, + filesystem = { + filtered_items = { + visible = true, + }, + }, + source_selector = { + winbar = true, + }, + }) + + local setKey = vim.keymap.set + + setKey( + "n", + "e", + "Neotree right toggle", + { noremap = true, silent = true, desc = "Explorer NeoTree" } + ) + end, } diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..dc4a4cc --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,95 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + -- follow latest release. + version = "v2.*", -- Replace by the latest released major (first number of latest release) + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "saadparwaiz1/cmp_luasnip", -- for autocompletion + "rafamadriz/friendly-snippets", -- useful snippets + "onsails/lspkind.nvim", -- vs-code like pictograms + "kristijanhusak/vim-dadbod-completion", -- completion for vim-dadbod-ui + { + "zbirenbaum/copilot-cmp", + opts = {}, + config = function(_, opts) + local copilot_cmp = require("copilot_cmp") + copilot_cmp.setup(opts) + + local lspkind = require("lspkind") + lspkind.init({ + symbol_map = { + Copilot = "ο„“", + }, + }) + + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#CA2222" }) + end, + }, + }, + config = function() + local cmp = require("cmp") + + local luasnip = require("luasnip") + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + window = { + completion = { + border = "rounded", + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", + col_offset = -3, + side_padding = 0, + }, + }, + completion = { + completeopt = "menu,menuone,preview,noinsert", + }, + preselect = cmp.PreselectMode.Item, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item(), -- next suggestion + [""] = cmp.mapping.select_prev_item(), -- previous suggestion + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), + }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "copilot" }, + { name = "vim-dadbod-completion" }, -- completion for vim-dadbod-ui + { name = "nvim_lsp" }, + { name = "luasnip" }, -- snippets + { name = "path" }, -- file system paths + { name = "buffer" }, -- text within current buffer + }), + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + kind.kind = " " .. (strings[1] or "") .. " " + kind.menu = " (" .. (strings[2] or "") .. ")" + + return kind + end, + expandable_indicator = true, + }, + experimental = { + -- required for inline preview of completion items + ghost_text = true, + }, + }) + end, +} diff --git a/lua/plugins/refactoring.lua b/lua/plugins/refactoring.lua new file mode 100644 index 0000000..4633ff2 --- /dev/null +++ b/lua/plugins/refactoring.lua @@ -0,0 +1,19 @@ +return { + "ThePrimeagen/refactoring.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + }, + lazy = false, + config = function() + local promptLanguage = { + go = true, + java = true, + } + + require("refactoring").setup({ + prompt_func_return_type = promptLanguage, + prompt_func_param_type = promptLanguage, + }) + end, +} diff --git a/lua/plugins/surround.lua b/lua/plugins/surround.lua deleted file mode 100644 index 38e1872..0000000 --- a/lua/plugins/surround.lua +++ /dev/null @@ -1,33 +0,0 @@ -return { - { - "folke/flash.nvim", - event = "VeryLazy", - keys = { - { "S", false, mode = { "v", "n", "x" } }, - { "s", false, mode = { "v", "n", "x" } }, - { - "ΓΌ", - mode = { "n", "x", "o" }, - function() - require("flash").jump() - end, - desc = "Flash", - }, - { - "Ü", - mode = { "n", "x", "o" }, - function() - require("flash").treesitter() - end, - desc = "Flash Treesitter", - }, - }, - }, - { - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - config = function() - require("nvim-surround").setup({}) - end, - }, -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..818f336 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,90 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-tree/nvim-web-devicons", + "folke/todo-comments.nvim", + "BurntSushi/ripgrep", + "andrew-george/telescope-themes", + "ThePrimeagen/refactoring.nvim", + "debugloop/telescope-undo.nvim", + }, + config = function() + local telescope = require("telescope") + local actions = require("telescope.actions") + local layout = require("telescope.actions.layout") + + telescope.setup({ + defaults = { + path_display = { "truncate" }, + mappings = { + i = { + [""] = actions.move_selection_previous, -- move to prev result + [""] = actions.move_selection_next, -- move to next result + [""] = layout.toggle_preview, -- toggle preview + }, + }, + }, + extensions = { + undo = { + use_delta = true, + }, + }, + }) + + -- Enable Preview for gohtml files in Telescope + vim.api.nvim_create_autocmd("User", { + pattern = "TelescopePreviewerLoaded", + callback = function(args) + print("TelescopePreviewerLoaded", args.data.bufname) + local gotmpl = { "%.gohtmltmpl$", "%.gohtml$", "%.gotmpl$", "%.tmpl$" } + for _, ext in ipairs(gotmpl) do + if args.data.bufname:match(ext) then + vim.cmd("setlocal filetype=gohtmltmpl") + end + end + end, + }) + + for _, ext in ipairs({ "fzf", "themes", "refactoring", "undo" }) do + telescope.load_extension(ext) + end + + -- set keymaps + local keymap = vim.keymap -- for conciseness + keymap.set( + "n", + "", + "Telescope find_files sort_mru=true", + { desc = "Find Files (Root Dir)" } + ) + keymap.set("n", ":", "Telescope command_history", { desc = "Command History" }) + keymap.set( + "n", + "fb", + "Telescope buffers sort_mru=true sort_lastused=true ignore_current_buffer=true", + { desc = "Buffers" } + ) + + keymap.set("n", "fg", "Telescope live_grep", { desc = "Find Grep" }) + keymap.set("n", "fr", "Telescope oldfiles", { desc = "Find Recent" }) + keymap.set("n", "ft", "TodoTelescope", { desc = "Find TODOs" }) + + -- git + keymap.set("n", "gs", "Telescope git_status", { desc = "Git Status" }) + keymap.set("n", "gc", "Telescope git_commits", { desc = "Git Commits" }) + keymap.set("n", "gb", "Telescope git_branches", { desc = "Git Branches" }) + + -- code action + keymap.set({ "n", "x" }, "cf", function() + require('telescope').extensions.refactoring.refactors() + end, { desc = "Refactoring Actions" }) + + -- ui + keymap.set("n", "ut", "Telescope themes", { desc = "UI Themes" }) + + -- undo + keymap.set("n", "fu", "Telescope undo", { desc = "Find Undo" }) + end, +} diff --git a/lua/plugins/test.lua b/lua/plugins/test.lua deleted file mode 100644 index 71132c2..0000000 --- a/lua/plugins/test.lua +++ /dev/null @@ -1,59 +0,0 @@ -local function get_javascript_adapter_test() - if vim.fn.findfile("jest.config.js", ".;") ~= "" or vim.fn.findfile("jest.config.ts", ".;") ~= "" then - return require("neotest-jest")({ - jestConfigFile = "jest.config.js", - jestCommand = "yarn jest", - }) - end - - if vim.fn.findfile("vite.config.js", ".;") ~= "" or vim.fn.findfile("vite.config.ts", ".;") ~= "" then - return require("neotest-vitest")({ - is_test_file = function(file_path) - if string.match(file_path, "test.ts") then - return true - end - end, - }) - end - - return nil -end - -return { - { "fredrikaverpil/neotest-golang", enabled = false }, - { "mrcjkb/neotest-haskell", enabled = false }, - { - "nvim-neotest/neotest", - dependencies = { - "nvim-neotest/nvim-nio", - "nvim-lua/plenary.nvim", - "antoinemadec/FixCursorHold.nvim", - "nvim-treesitter/nvim-treesitter", - "nvim-neotest/neotest-go", - "nvim-neotest/neotest-python", - "nvim-neotest/neotest-jest", - "marilari88/neotest-vitest", - }, - config = function() - local goAdapter = require("neotest-go")({ - args = { "-v" }, - }) - - local pyAdapter = require("neotest-python")({ - args = { "-s", "-vv" }, - runner = "pytest", - }) - - local jsAdapter = get_javascript_adapter_test() - - ---@diagnostic disable-next-line: missing-fields - require("neotest").setup({ - adapters = { goAdapter, pyAdapter, jsAdapter }, - ---@diagnostic disable-next-line: missing-fields - diagnostic = { - enable = true, - }, - }) - end, - }, -} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..aa7f7c7 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,76 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + }, + config = function() + -- import nvim-treesitter plugin + local treesitter = require("nvim-treesitter.configs") + + -- configure treesitter + treesitter.setup({ -- enable syntax highlighting + highlight = { + enable = true, + }, + -- enable indentation + indent = { enable = true }, + -- enable autotagging (w/ nvim-ts-autotag plugin) + autotag = { + enable = true, + }, + -- ensure these language parsers are installed + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "markdown", + "markdown_inline", + "graphql", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "query", + "vimdoc", + "go", + "php", + "csv", + "dart", + "diff", + "editorconfig", + "gomod", + "gosum", + "gotmpl", + "haskell", + "java", + "jq", + "kotlin", + "python", + "sql", + "tmux", + "vue", + "xml", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + -- some default options + sync_install = true, + ignore_install = {}, + auto_install = false, + }) + end, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua deleted file mode 100644 index e3692ab..0000000 --- a/lua/plugins/ui.lua +++ /dev/null @@ -1,62 +0,0 @@ -local logo = [[ -`8.`888b ,8' 8 8888 ,8. ,8. - `8.`888b ,8' 8 8888 ,888. ,888. - `8.`888b ,8' 8 8888 .`8888. .`8888. - `8.`888b ,8' 8 8888 ,8.`8888. ,8.`8888. - `8.`888b ,8' 8 8888 ,8'8.`8888,8^8.`8888. - `8.`888b ,8' 8 8888 ,8' `8.`8888' `8.`8888. - `8.`888b8' 8 8888 ,8' `8.`88' `8.`8888. - `8.`888' 8 8888 ,8' `8.`' `8.`8888. - `8.`8' 8 8888 ,8' `8 `8.`8888. - `8.` 8 8888 ,8' ` `8.`8888. -]] - --- define the colorscheme for nvim -return { - { - "norcalli/nvim-colorizer.lua", - event = "BufEnter", - opts = { "*" }, - }, - { - "folke/tokyonight.nvim", - opts = { - transparent = true, - style = "night", - styles = { - sidebars = "transparent", - floats = "transparent", - }, - }, - }, - { - "nvim-lualine/lualine.nvim", - opts = { - sections = { - lualine_z = {}, - }, - }, - }, - { - "folke/snacks.nvim", - opts = { - dashboard = { - preset = { - header = logo, - }, - sections = { - { section = "header" }, - { section = "keys", gap = 1, padding = 1 }, - { icon = "ο…› ", title = "Recent Files", cwd = true, section = "recent_files", indent = 2, padding = 1 }, - { icon = " ", title = "Projects", section = "projects", indent = 2, padding = 2 }, - { section = "startup" }, - }, - }, - }, - config = function(_, opts) - require("snacks").setup(opts) - - vim.api.nvim_set_hl(0, "SnacksDashboardHeader", { fg = "#FFA500" }) -- Orange Farbe - end, - }, -} diff --git a/lua/plugins/vim-go.lua b/lua/plugins/vim-go.lua new file mode 100644 index 0000000..fe7900b --- /dev/null +++ b/lua/plugins/vim-go.lua @@ -0,0 +1,13 @@ +return { + { + "fatih/vim-go", + build = ":GoInstallBinaries", + run = ":GoUpdateBinaries", + config = function() + vim.g.go_def_mode = "gopls" + vim.g.go_info_mode = "gopls" + vim.g.go_fmt_command = "goimports" + vim.g.go_auto_type_info = 1 + end, + }, +} diff --git a/lua/plugins/vim-tmux-navigator.lua b/lua/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..aee4317 --- /dev/null +++ b/lua/plugins/vim-tmux-navigator.lua @@ -0,0 +1,16 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + }, +} diff --git a/mason-lock.json b/mason-lock.json deleted file mode 100644 index ff9c571..0000000 --- a/mason-lock.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "autoflake": "2.3.1", - "bash-language-server": "5.4.0", - "css-lsp": "4.10.0", - "css-variables-language-server": "2.7.0", - "debugpy": "1.8.5", - "delve": "v1.23.1", - "docker-compose-language-service": "0.2.0", - "dockerfile-language-server": "0.13.0", - "emmet-ls": "0.4.2", - "eslint-lsp": "4.10.0", - "eslint_d": "14.0.4", - "gofumpt": "v0.7.0", - "goimports": "v0.25.0", - "golangci-lint-langserver": "v0.0.9", - "gopls": "v0.16.2", - "groovy-language-server": "0c40ec136525b592f1d798bb52ced9d8d2d7945c", - "hadolint": "v2.12.0", - "haskell-debug-adapter": "0.0.39.0", - "haskell-language-server": "2.8.0.0", - "html-lsp": "4.10.0", - "intelephense": "1.12.5", - "isort": "5.13.2", - "jedi-language-server": "0.41.4", - "js-debug-adapter": "v1.94.0", - "json-lsp": "4.10.0", - "kotlin-language-server": "1.3.12", - "lua-language-server": "3.10.6", - "markdown-toc": "1.2.0", - "markdownlint-cli2": "0.14.0", - "marksman": "2023-12-09", - "php-cs-fixer": "v3.64.0", - "php-debug-adapter": "v1.35.0", - "phpactor": "2024.06.30.0", - "phpcs": "3.10.3", - "prettier": "3.3.3", - "pyright": "1.1.373", - "ruff": "0.6.9", - "ruff-lsp": "0.0.56", - "shellcheck": "v0.10.0", - "shfmt": "v3.9.0", - "sqlfluff": "3.1.1", - "stimulus-language-server": "1.0.4", - "stylua": "v0.20.0", - "tailwindcss-language-server": "0.0.24", - "taplo": "0.9.2", - "typescript-language-server": "4.3.3", - "vtsls": "0.2.5", - "vue-language-server": "2.1.6", - "yaml-language-server": "1.15.0" -} diff --git a/stylua.toml b/stylua.toml deleted file mode 100644 index 5d6c50d..0000000 --- a/stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Spaces" -indent_width = 2 -column_width = 120 \ No newline at end of file