From b630c43c079c232641d1468090ed47c3ea73dba1 Mon Sep 17 00:00:00 2001 From: Anton Shuvalov Date: Tue, 29 Oct 2024 13:57:00 +0700 Subject: [PATCH] Update nvim config --- configs/nvim/.editorconfig | 18 ++ configs/nvim/.gitignore | 9 +- configs/nvim/.luarc.json | 4 - configs/nvim/.neoconf.json | 15 ++ configs/nvim/LICENSE | 201 ++++++++++++++++++ configs/nvim/README.md | 4 + .../after/queries/markdown/highlights.scm | 18 +- configs/nvim/ftplugin/java.lua | 5 - configs/nvim/init.lua | 9 +- configs/nvim/lazy-lock.json | 48 +++++ configs/nvim/lazyvim.json | 9 + configs/nvim/lua/colorscheme.lua | 2 +- configs/nvim/lua/config.lua | 69 ------ configs/nvim/lua/config/autocmds.lua | 6 + configs/nvim/lua/config/keymaps.lua | 3 + configs/nvim/lua/config/lazy.lua | 29 +++ configs/nvim/lua/config/options.lua | 74 +++++++ configs/nvim/lua/lib/filepath.lua | 15 ++ .../obsidian}/cmp_source.lua | 42 ++-- .../nvim-obsidian => lib/obsidian}/lib.lua | 55 +++-- .../nvim/lua/lib/obsidian/md_buffer_au.lua | 30 +++ configs/nvim/lua/lib/obsidian/obsidian.lua | 29 +++ configs/nvim/lua/lib/utils/has_prop.lua | 14 -- configs/nvim/lua/lib/utils/print_table.lua | 97 --------- configs/nvim/lua/lib/utils/table_merge.lua | 16 -- configs/nvim/lua/lib/utils/table_slice.lua | 11 - configs/nvim/lua/opts.lua | 68 ------ configs/nvim/lua/packages/close-buffers.lua | 9 - configs/nvim/lua/packages/cmp-completion.lua | 109 ---------- configs/nvim/lua/packages/comment.lua | 21 -- configs/nvim/lua/packages/editorconfig.lua | 7 - configs/nvim/lua/packages/extended-syntax.lua | 8 - configs/nvim/lua/packages/fzf.lua | 76 ------- configs/nvim/lua/packages/git.lua | 26 --- configs/nvim/lua/packages/glow.lua | 27 --- configs/nvim/lua/packages/import-cost.lua | 15 -- .../nvim/lua/packages/indent-blankline.lua | 7 - configs/nvim/lua/packages/lsp/format.lua | 34 --- configs/nvim/lua/packages/lsp/init.lua | 70 ------ configs/nvim/lua/packages/lsp/keys.lua | 36 ---- configs/nvim/lua/packages/lsp/lsp_efm.lua | 19 -- configs/nvim/lua/packages/lsp/lsp_python.lua | 49 ----- .../lua/packages/lsp/lsp_status_config.lua | 13 -- configs/nvim/lua/packages/lsp/on_attach.lua | 30 --- configs/nvim/lua/packages/lualine.lua | 27 --- configs/nvim/lua/packages/neo-tree.lua | 51 ----- configs/nvim/lua/packages/nerdtree.lua | 22 -- configs/nvim/lua/packages/null-ls.lua | 42 ---- configs/nvim/lua/packages/nvim-colorizer.lua | 12 -- configs/nvim/lua/packages/nvim-java.lua | 11 - configs/nvim/lua/packages/nvim-metals.lua | 29 --- .../nvim/lua/packages/nvim-obsidian/init.lua | 43 ---- .../packages/nvim-obsidian/md_buffer_au.lua | 28 --- .../lua/packages/nvim-obsidian/wikilinks.lua | 10 - configs/nvim/lua/packages/nvim-session.lua | 13 -- configs/nvim/lua/packages/obsidian.lua | 117 ---------- configs/nvim/lua/packages/packer.lua | 22 -- configs/nvim/lua/packages/pretty-fold.lua | 15 -- .../nvim/lua/packages/quickfix-to-bottom.lua | 10 - configs/nvim/lua/packages/theme.lua | 28 --- configs/nvim/lua/packages/tmux-navigation.lua | 60 ------ configs/nvim/lua/packages/todo-comments.lua | 28 --- configs/nvim/lua/packages/todo-txt.lua | 7 - configs/nvim/lua/packages/treesitter.lua | 24 --- configs/nvim/lua/packages/trouble.lua | 28 --- configs/nvim/lua/packages/which-key.lua | 17 -- configs/nvim/lua/plugins.lua | 41 ---- configs/nvim/lua/plugins/chatgpt.lua | 10 + configs/nvim/lua/plugins/colorizer.lua | 7 + configs/nvim/lua/plugins/conform.lua | 47 ++++ configs/nvim/lua/plugins/editorconfig.lua | 3 + configs/nvim/lua/plugins/fzf.lua | 68 ++++++ configs/nvim/lua/plugins/git.lua | 21 ++ configs/nvim/lua/plugins/indent-blankline.lua | 51 +++++ configs/nvim/lua/plugins/lsp-saga.lua | 64 ++++++ configs/nvim/lua/plugins/lualine.lua | 30 +++ configs/nvim/lua/plugins/mason.lua | 40 ++++ configs/nvim/lua/plugins/nerdtree.lua | 13 ++ configs/nvim/lua/plugins/nvim-cmp.lua | 86 ++++++++ configs/nvim/lua/plugins/nvim-dev.lua | 25 +++ configs/nvim/lua/plugins/nvim-lspconfig.lua | 127 +++++++++++ configs/nvim/lua/plugins/nvim-notify.lua | 10 + configs/nvim/lua/plugins/obsidian.lua | 9 + configs/nvim/lua/plugins/pretty-fold.lua | 8 + configs/nvim/lua/plugins/tailwind-lsp.lua | 31 +++ configs/nvim/lua/plugins/tmux-navigation.lua | 15 ++ configs/nvim/lua/plugins/trash-polka.lua | 17 ++ configs/nvim/lua/plugins/treesitter.lua | 25 +++ configs/nvim/lua/plugins/whichkey.lua | 45 ++++ configs/nvim/stylua.toml | 3 + 90 files changed, 1321 insertions(+), 1575 deletions(-) create mode 100644 configs/nvim/.editorconfig delete mode 100644 configs/nvim/.luarc.json create mode 100644 configs/nvim/.neoconf.json create mode 100644 configs/nvim/LICENSE create mode 100644 configs/nvim/README.md delete mode 100644 configs/nvim/ftplugin/java.lua mode change 100755 => 100644 configs/nvim/init.lua create mode 100644 configs/nvim/lazy-lock.json create mode 100644 configs/nvim/lazyvim.json delete mode 100644 configs/nvim/lua/config.lua create mode 100644 configs/nvim/lua/config/autocmds.lua create mode 100644 configs/nvim/lua/config/keymaps.lua create mode 100644 configs/nvim/lua/config/lazy.lua create mode 100644 configs/nvim/lua/config/options.lua create mode 100644 configs/nvim/lua/lib/filepath.lua rename configs/nvim/lua/{packages/nvim-obsidian => lib/obsidian}/cmp_source.lua (60%) rename configs/nvim/lua/{packages/nvim-obsidian => lib/obsidian}/lib.lua (61%) create mode 100644 configs/nvim/lua/lib/obsidian/md_buffer_au.lua create mode 100644 configs/nvim/lua/lib/obsidian/obsidian.lua delete mode 100644 configs/nvim/lua/lib/utils/has_prop.lua delete mode 100644 configs/nvim/lua/lib/utils/print_table.lua delete mode 100644 configs/nvim/lua/lib/utils/table_merge.lua delete mode 100644 configs/nvim/lua/lib/utils/table_slice.lua delete mode 100644 configs/nvim/lua/opts.lua delete mode 100644 configs/nvim/lua/packages/close-buffers.lua delete mode 100644 configs/nvim/lua/packages/cmp-completion.lua delete mode 100644 configs/nvim/lua/packages/comment.lua delete mode 100644 configs/nvim/lua/packages/editorconfig.lua delete mode 100644 configs/nvim/lua/packages/extended-syntax.lua delete mode 100644 configs/nvim/lua/packages/fzf.lua delete mode 100644 configs/nvim/lua/packages/git.lua delete mode 100644 configs/nvim/lua/packages/glow.lua delete mode 100644 configs/nvim/lua/packages/import-cost.lua delete mode 100644 configs/nvim/lua/packages/indent-blankline.lua delete mode 100644 configs/nvim/lua/packages/lsp/format.lua delete mode 100644 configs/nvim/lua/packages/lsp/init.lua delete mode 100644 configs/nvim/lua/packages/lsp/keys.lua delete mode 100644 configs/nvim/lua/packages/lsp/lsp_efm.lua delete mode 100644 configs/nvim/lua/packages/lsp/lsp_python.lua delete mode 100644 configs/nvim/lua/packages/lsp/lsp_status_config.lua delete mode 100644 configs/nvim/lua/packages/lsp/on_attach.lua delete mode 100644 configs/nvim/lua/packages/lualine.lua delete mode 100644 configs/nvim/lua/packages/neo-tree.lua delete mode 100644 configs/nvim/lua/packages/nerdtree.lua delete mode 100644 configs/nvim/lua/packages/null-ls.lua delete mode 100644 configs/nvim/lua/packages/nvim-colorizer.lua delete mode 100644 configs/nvim/lua/packages/nvim-java.lua delete mode 100644 configs/nvim/lua/packages/nvim-metals.lua delete mode 100644 configs/nvim/lua/packages/nvim-obsidian/init.lua delete mode 100644 configs/nvim/lua/packages/nvim-obsidian/md_buffer_au.lua delete mode 100644 configs/nvim/lua/packages/nvim-obsidian/wikilinks.lua delete mode 100644 configs/nvim/lua/packages/nvim-session.lua delete mode 100644 configs/nvim/lua/packages/obsidian.lua delete mode 100644 configs/nvim/lua/packages/packer.lua delete mode 100644 configs/nvim/lua/packages/pretty-fold.lua delete mode 100644 configs/nvim/lua/packages/quickfix-to-bottom.lua delete mode 100644 configs/nvim/lua/packages/theme.lua delete mode 100644 configs/nvim/lua/packages/tmux-navigation.lua delete mode 100644 configs/nvim/lua/packages/todo-comments.lua delete mode 100644 configs/nvim/lua/packages/todo-txt.lua delete mode 100644 configs/nvim/lua/packages/treesitter.lua delete mode 100644 configs/nvim/lua/packages/trouble.lua delete mode 100644 configs/nvim/lua/packages/which-key.lua delete mode 100644 configs/nvim/lua/plugins.lua create mode 100644 configs/nvim/lua/plugins/chatgpt.lua create mode 100644 configs/nvim/lua/plugins/colorizer.lua create mode 100644 configs/nvim/lua/plugins/conform.lua create mode 100644 configs/nvim/lua/plugins/editorconfig.lua create mode 100644 configs/nvim/lua/plugins/fzf.lua create mode 100644 configs/nvim/lua/plugins/git.lua create mode 100644 configs/nvim/lua/plugins/indent-blankline.lua create mode 100644 configs/nvim/lua/plugins/lsp-saga.lua create mode 100644 configs/nvim/lua/plugins/lualine.lua create mode 100644 configs/nvim/lua/plugins/mason.lua create mode 100644 configs/nvim/lua/plugins/nerdtree.lua create mode 100644 configs/nvim/lua/plugins/nvim-cmp.lua create mode 100644 configs/nvim/lua/plugins/nvim-dev.lua create mode 100644 configs/nvim/lua/plugins/nvim-lspconfig.lua create mode 100644 configs/nvim/lua/plugins/nvim-notify.lua create mode 100644 configs/nvim/lua/plugins/obsidian.lua create mode 100644 configs/nvim/lua/plugins/pretty-fold.lua create mode 100644 configs/nvim/lua/plugins/tailwind-lsp.lua create mode 100644 configs/nvim/lua/plugins/tmux-navigation.lua create mode 100644 configs/nvim/lua/plugins/trash-polka.lua create mode 100644 configs/nvim/lua/plugins/treesitter.lua create mode 100644 configs/nvim/lua/plugins/whichkey.lua create mode 100644 configs/nvim/stylua.toml diff --git a/configs/nvim/.editorconfig b/configs/nvim/.editorconfig new file mode 100644 index 0000000..6f65692 --- /dev/null +++ b/configs/nvim/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: https://editorconfig.org + +# Top-most EditorConfig file +root = true + +# All files +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# Lua files +[*.lua] +indent_style = space +indent_size = 2 diff --git a/configs/nvim/.gitignore b/configs/nvim/.gitignore index 5a02d10..cc5457a 100644 --- a/configs/nvim/.gitignore +++ b/configs/nvim/.gitignore @@ -1 +1,8 @@ -plugins +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/configs/nvim/.luarc.json b/configs/nvim/.luarc.json deleted file mode 100644 index c8b8dd2..0000000 --- a/configs/nvim/.luarc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", - "diagnostics.globals": ["vim"] -} diff --git a/configs/nvim/.neoconf.json b/configs/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/configs/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/configs/nvim/LICENSE b/configs/nvim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/configs/nvim/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/configs/nvim/README.md b/configs/nvim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/configs/nvim/README.md @@ -0,0 +1,4 @@ +# πŸ’€ LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/configs/nvim/after/queries/markdown/highlights.scm b/configs/nvim/after/queries/markdown/highlights.scm index 0b86cf3..d714b1c 100644 --- a/configs/nvim/after/queries/markdown/highlights.scm +++ b/configs/nvim/after/queries/markdown/highlights.scm @@ -63,16 +63,16 @@ ((list_marker_plus) @list_marker.plus (#offset! @list_marker.plus 0 0 0 -1) - (#set! conceal " ") + (#set! conceal "⁃") ) ((list_marker_minus) @list_marker.minus (#offset! @list_marker.minus 0 0 0 -1) - (#set! conceal "") + (#set! conceal "⁃") ) ((list_marker_star) @list_marker.star (#offset! @list_marker.star 0 0 0 -1) - (#set! conceal "") + (#set! conceal "⁃") ) ; ((list_marker_dot) @list_marker.dot @@ -82,19 +82,25 @@ ((list_marker_parenthesis) @list_marker.parenthesis (#offset! @list_marker.parenthesis 0 0 0 -1) - (#set! conceal "") + (#set! conceal "⁃") ) ;; replace '[x]' with σ°„² ((task_list_marker_checked) @text.todo.checked (#offset! @text.todo.checked 0 -2 0 0) - (#set! conceal "ο‘„") + (#set! conceal "β€’") ) ;; replace '[ ]' with σ°„± ((task_list_marker_unchecked) @text.todo.unchecked (#offset! @text.todo.unchecked 0 -2 0 0) - (#set! conceal "") + (#set! conceal "β—¦") ) ([(minus_metadata)] @comment) + +(fenced_code_block + (fenced_code_block_delimiter) @markup.raw.block + + (#set! conceal "`")) + diff --git a/configs/nvim/ftplugin/java.lua b/configs/nvim/ftplugin/java.lua deleted file mode 100644 index 8c1c715..0000000 --- a/configs/nvim/ftplugin/java.lua +++ /dev/null @@ -1,5 +0,0 @@ -local config = { - cmd = {'/usr/bin/jdtls'}, - root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw', 'metals.log'}, { upward = true })[1]), -} -require('jdtls').start_or_attach(config) diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua old mode 100755 new mode 100644 index 5a34e39..2514f9e --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -1,7 +1,2 @@ -require 'opts' - -local plugins = require('plugins') -local config = require('config') - -plugins.init(config) - +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json new file mode 100644 index 0000000..5fe85f2 --- /dev/null +++ b/configs/nvim/lazy-lock.json @@ -0,0 +1,48 @@ +{ + "CodeGPT.nvim": { "branch": "master", "commit": "9d0a58a0bdc858f2e9729b8b5ac8b994c3453c8f" }, + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "1a99fdc1d3aa9ccdf3021e67982a679a8c5c740c" }, + "editorconfig-vim": { "branch": "master", "commit": "8b7da79e9daee7a3f3a8d4fe29886b9756305aff" }, + "friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" }, + "fzf-lua": { "branch": "main", "commit": "a1f834b37506ca77c47fa99cd3f5e9ed3f4102d2" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "indent-blankline.nvim": { "branch": "master", "commit": "18603eb949eba08300799f64027af11ef922283f" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" }, + "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, + "lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lspsaga.nvim": { "branch": "main", "commit": "e64351d0e6335eadf089aa2b9f17221e54ca10a4" }, + "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.icons": { "branch": "main", "commit": "a2742459f0ee32806c2438ca06b4d8b331f3f4d4" }, + "nerdtree": { "branch": "master", "commit": "9b465acb2745beb988eff3c1e4aa75f349738230" }, + "nerdtree-git-plugin": { "branch": "master", "commit": "e1fe727127a813095854a5b063c15e955a77eafb" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "0671e0eabc6842676d3310370e8fae4e1c51d7f9" }, + "nvim-fzf": { "branch": "master", "commit": "c89b15aee136eeb4649901552da37a404415c356" }, + "nvim-lspconfig": { "branch": "master", "commit": "6d25cf12a0e8321fee48a67347a5bf29a411b6a8" }, + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, + "nvim-treesitter": { "branch": "master", "commit": "3af8476530caa0906aa68f4dc911f76e77b478a9" }, + "nvim-web-devicons": { "branch": "master", "commit": "6b53401918a9033a41159d012160c5fb5eb249ae" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "pretty-fold.nvim": { "branch": "master", "commit": "a7d8b424abe0eedf50116c460fbe6dfd5783b1d5" }, + "tailwind-tools": { "branch": "master", "commit": "4b2d88cc7d49a92f28b9942712f1a53d2c3d5b27" }, + "vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } +} diff --git a/configs/nvim/lazyvim.json b/configs/nvim/lazyvim.json new file mode 100644 index 0000000..b1aed37 --- /dev/null +++ b/configs/nvim/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "6077" + }, + "version": 6 +} \ No newline at end of file diff --git a/configs/nvim/lua/colorscheme.lua b/configs/nvim/lua/colorscheme.lua index e727911..b9d8638 100644 --- a/configs/nvim/lua/colorscheme.lua +++ b/configs/nvim/lua/colorscheme.lua @@ -1 +1 @@ -vim.cmd 'colorscheme trash-polka' +vim.cmd 'colorscheme trash-polka-light' diff --git a/configs/nvim/lua/config.lua b/configs/nvim/lua/config.lua deleted file mode 100644 index a275959..0000000 --- a/configs/nvim/lua/config.lua +++ /dev/null @@ -1,69 +0,0 @@ -local enabled_packages = { - 'packages/packer', - 'packages/which-key', - 'packages/theme', - 'packages/indent-blankline', - 'packages/git', - 'packages/lualine', - 'packages/fzf', - 'packages/editorconfig', - 'packages/comment', - 'packages/cmp-completion', - -- 'packages/nvim-java', - 'packages/lsp', - 'packages/tmux-navigation', - 'packages/nvim-session', - 'packages/quickfix-to-bottom', - 'packages/nerdtree', - 'packages/treesitter', -'packages/null-ls', -'packages/trouble', -'packages/todo-comments', -'packages/extended-syntax', -'packages/glow', - -- 'packages/obsidian', - 'packages/nvim-colorizer', - 'packages/pretty-fold', - 'packages/nvim-metals', - -- 'packages/neo-tree', - 'packages/nvim-obsidian', - -- 'packages/close-buffers', - -- 'packages/import-cost', - -- 'packages/todo-txt', -} - -local enabled_treesitter_configs = { - 'javascript', - 'tsx', - 'typescript', - 'php', - 'dockerfile', - 'python', -} - -local enabled_lsp_servers = { - 'ansiblels', - 'efm', - 'pyright', - 'rust_analyzer', - 'lua_ls', - 'taplo', - 'tsserver', - 'vimls', - 'yamlls', - 'hls', - 'sourcekit' - -- 'java_language_server', - -- 'jdtls' - -- 'jdtls', -} - --- base whichkeys config. Mutated in `.keybindings_hook` -local keys = {} - -return { - enabled_packages = enabled_packages, - enabled_lsp_servers = enabled_lsp_servers, - enabled_treesitter_configs = enabled_treesitter_configs, - keys = keys, -} diff --git a/configs/nvim/lua/config/autocmds.lua b/configs/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..89230dc --- /dev/null +++ b/configs/nvim/lua/config/autocmds.lua @@ -0,0 +1,6 @@ +-- 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.api.nvim_command('au BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!') + vim.api.nvim_command('autocmd BufWinEnter ?* silent! loadview') diff --git a/configs/nvim/lua/config/keymaps.lua b/configs/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/configs/nvim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- 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 diff --git a/configs/nvim/lua/config/lazy.lua b/configs/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..6df7f09 --- /dev/null +++ b/configs/nvim/lua/config/lazy.lua @@ -0,0 +1,29 @@ +-- 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" + vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "trash-polka" } }, + -- automatically check for plugin updates + checker = { enabled = false }, + -- dev = { path = "~/.config/nvim/lua/lib/" }, +}) + +require("config.options") diff --git a/configs/nvim/lua/config/options.lua b/configs/nvim/lua/config/options.lua new file mode 100644 index 0000000..1d5cc86 --- /dev/null +++ b/configs/nvim/lua/config/options.lua @@ -0,0 +1,74 @@ +local g = vim.g +local opt = vim.opt + +g.mapleader = " " +g.markdown_fenced_languages = { + "bash=sh", + "css", + "html", + "javascript", + "js=javascript", + "json=javascript", + "php", + "python", + "ruby", + "rust", + "sql", + "ts=typescript", + "typescript", + "vim", + -- 'dbml', + "sass", +} +-- g.markdown_folding = 1 + +opt.backup = false +opt.clipboard = "unnamedplus" +opt.colorcolumn = "120" +opt.completeopt = { "menuone", "noinsert", "noselect" } +opt.cursorline = true +opt.encoding = "utf-8" +opt.expandtab = true +opt.grepprg = "rg --color=never --vimgrep" +opt.hidden = true +opt.ignorecase = true +opt.laststatus = 2 +opt.lcs = "eol:Β·" +opt.list = true +opt.mouse = "a" +opt.mouse = "a" +opt.number = true +opt.rnu = true +opt.scrolloff = 8 +opt.sessionoptions = "folds" +opt.shiftwidth = 2 +opt.showtabline = 0 +opt.spelllang = { "en_us", "ru" } +opt.splitbelow = true +opt.splitright = true +opt.swapfile = false +opt.tabstop = 2 +opt.termguicolors = false +opt.updatetime = 750 +opt.viewoptions = "cursor,folds" +opt.wildignore = { "package-lock.json", "yarn.lock" } +opt.wrap = false +opt.writebackup = false +opt.termguicolors = true +opt.conceallevel = 0 + +-- opt.statuscolumn = " " +-- vim.wo.signcolumn = "yes" + +opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" +opt.foldtext = "v:lua.vim.treesitter.foldtext()" + +-- opt.verbose = 2 +-- opt.verbosefile = "/users/anton/.logs/nvim.log" + +vim.cmd([[iabbrev ymd% strftime("%y%m%d")]]) + +-- vim.api.nvim_create_autocmd({ "insertenter" }, { command = "hi cursorline ctermbg=16" }) +-- vim.api.nvim_create_autocmd({ "insertleave" }, { command = "hi cursorline ctermbg=none" }) +-- +vim.o.winbar = " ξ©» %{%v:lua.require'lib.filepath'.eval()%} %{%v:lua.require'nvim-navic'.get_location()%}" diff --git a/configs/nvim/lua/lib/filepath.lua b/configs/nvim/lua/lib/filepath.lua new file mode 100644 index 0000000..9137f3f --- /dev/null +++ b/configs/nvim/lua/lib/filepath.lua @@ -0,0 +1,15 @@ +local M = {} + +function M.eval() + local file_path = vim.api.nvim_eval_statusline('%f', {}).str + local modified = vim.api.nvim_eval_statusline('%M', {}).str == '+' and '⊚' or '' + + return '%#WinBarPath#' + .. file_path + .. '%*' + .. '%#WinBarModified#' + .. modified + .. '%*' +end + +return M diff --git a/configs/nvim/lua/packages/nvim-obsidian/cmp_source.lua b/configs/nvim/lua/lib/obsidian/cmp_source.lua similarity index 60% rename from configs/nvim/lua/packages/nvim-obsidian/cmp_source.lua rename to configs/nvim/lua/lib/obsidian/cmp_source.lua index 28b477d..0c08411 100644 --- a/configs/nvim/lua/packages/nvim-obsidian/cmp_source.lua +++ b/configs/nvim/lua/lib/obsidian/cmp_source.lua @@ -8,24 +8,32 @@ local Source = {} -- end Source.new = function() - local self = setmetatable({}, { __index = Source }) - return self + local self = setmetatable({}, { __index = Source }) + return self end function Source:is_available() return vim.bo.filetype == "markdown" end +function Source.get_debug_name() + return "obsidian" +end + -- Return keyword pattern for triggering completion. (Optional) -- If this is ommited, nvim-cmp will use default keyword pattern. See |cmp-config.completion.keyword_pattern| -- @return string function Source:get_keyword_pattern() - return "\\w\\+" + return '\\[\\[\\a\\+' end function Source:complete(request, callback) + print(request) local word = string.sub(request.context.cursor_before_line, request.offset) - local cmd = "rg --files | rg --no-line-number "..word + -- remove first [[ + word = word:sub(3) + + local cmd = "rg --files | rg --no-line-number " .. word local handle_file_list = io.popen(cmd) @@ -37,13 +45,13 @@ function Source:complete(request, callback) local name = filename:match("(.+)%..+$") if name ~= nil then if string.match(filename, ".md") then - t[i] = { - label = "[["..name.."]]", + t[i] = { + label = "[[" .. name .. "]]", filename = filename, documentation = documentation, } else - t[i] = { label = "![["..filename.."]]" } + t[i] = { label = "![[" .. filename .. "]]" } end end end @@ -57,16 +65,20 @@ function Source:complete(request, callback) end function Source:resolve(completion_item, callback) - local cmd = 'cat ' .. '"' .. completion_item.filename .. '"' - local handle_file_content = io.popen(cmd) + if completion_item.filename == nil then + return callback(completion_item) + end - -- completion_item.documentation = cmd - if handle_file_content ~= nil then - completion_item.documentation = handle_file_content:read("*a") - handle_file_content:close() - end + local cmd = "cat " .. '"' .. completion_item.filename .. '"' + local handle_file_content = io.popen(cmd) + + -- completion_item.documentation = cmd + if handle_file_content ~= nil then + completion_item.documentation = handle_file_content:read("*a") + handle_file_content:close() + end - callback(completion_item) + callback(completion_item) end local source = Source.new() diff --git a/configs/nvim/lua/packages/nvim-obsidian/lib.lua b/configs/nvim/lua/lib/obsidian/lib.lua similarity index 61% rename from configs/nvim/lua/packages/nvim-obsidian/lib.lua rename to configs/nvim/lua/lib/obsidian/lib.lua index 8f2f3c7..3f478f2 100644 --- a/configs/nvim/lua/packages/nvim-obsidian/lib.lua +++ b/configs/nvim/lua/lib/obsidian/lib.lua @@ -1,25 +1,34 @@ -local table_slice = require('lib/utils/table_slice').table_slice local cmd = vim.cmd local api = vim.api local ui = vim.ui local fn = vim.fn local lsp = vim.lsp +local function table_slice(tbl, first, last, step) + local sliced = {} + + for i = first or 1, last or #tbl, step or 1 do + sliced[#sliced + 1] = tbl[i] + end + + return sliced +end + local function get_file_under_cursor() - local filename = fn.expand("") .. '.md' + local filename = fn.expand("") .. ".md" local path = fn.system('find . -name "' .. filename .. '"') - return path:gsub('\n', '') + return path:gsub("\n", "") end local function read_file_content(path) local content = fn.system('cat "' .. path .. '"') local raw_lines = lsp.util.convert_input_to_markdown_lines(content) local lines = raw_lines - if (raw_lines[1] == '---') then + if raw_lines[1] == "---" then local content_start local pointer = 1 for i, l in pairs(raw_lines) do - if (pointer ~= 1 and l == '---') then + if pointer ~= 1 and l == "---" then content_start = pointer + 1 end pointer = pointer + 1 @@ -53,13 +62,19 @@ end local function rename() local basename = get_cur_note_name() - if (basename == nil) then + if basename == nil then return end - ui.input({ prompt = 'Enter a new name for ' .. basename ..': ' }, function(input) - cmd(':w ' .. input .. '.md') - cmd('!find . -name "*.md" -type f -exec sed -i "" "s/\\[\\[' .. basename .. '\\([ \\t]*\\|[ \\t]*.*\\)\\{0,1\\}\\]\\]/[[' .. input ..'\\1]]/g" {} +') + ui.input({ prompt = "Enter a new name for " .. basename .. ": " }, function(input) + cmd(":w " .. input .. ".md") + cmd( + '!find . -name "*.md" -type f -exec sed -i "" "s/\\[\\[' + .. basename + .. "\\([ \\t]*\\|[ \\t]*.*\\)\\{0,1\\}\\]\\]/[[" + .. input + .. '\\1]]/g" {} +' + ) remove_cur_note() end) end @@ -67,27 +82,27 @@ end local function show_backlinks() local basename = get_cur_note_name() - if (basename == nil) then + if basename == nil then return end cmd('silent! grep "\\[\\[' .. basename .. '(\\s*\\|.*)?\\]\\]"') - cmd('TroubleToggle quickfix') + cmd("TroubleToggle quickfix") end local function hover_link() - local file = get_file_under_cursor() - local lines = read_file_content(file) + local file = get_file_under_cursor() + local lines = read_file_content(file) - if (lines == nil) then - return - end + if lines == nil then + return + end - local ok = pcall(lsp.util.open_floating_preview, lines, 'markdown') + local ok = pcall(lsp.util.open_floating_preview, lines, "markdown") - if (not ok) then - print('Nothing to preview...') - end + if not ok then + print("Nothing to preview...") + end end local function open_link() diff --git a/configs/nvim/lua/lib/obsidian/md_buffer_au.lua b/configs/nvim/lua/lib/obsidian/md_buffer_au.lua new file mode 100644 index 0000000..58625b6 --- /dev/null +++ b/configs/nvim/lua/lib/obsidian/md_buffer_au.lua @@ -0,0 +1,30 @@ +-- Markdown Buffer Settings +-- +local api = vim.api +local cmd = vim.cmd + +api.nvim_command("augroup obsidian") +-- add any nested dirs to the `gf` path, like in obsidian +api.nvim_command("au FileType markdown :setlocal path+=./**") + +-- - Filenames may contain spaces +api.nvim_command("au FileType markdown :setlocal isfname+=32") +api.nvim_command("au FileType markdown :setlocal isfname+=&") + +-- Automatically add .md ext +api.nvim_command("au FileType markdown :setlocal suffixesadd+=.md") + +-- Force markdown content wrapping +api.nvim_command("au FileType markdown :setlocal wrap linebreak") +-- api.nvim_command('au FileType markdown :silent SoftWrapMode') + +--- Let's `gf` edits file even if it hasn't been created before +api.nvim_command("au FileType markdown :map gf :e .md") +api.nvim_command("au FileType markdown :nmap zo") +api.nvim_command("au FileType markdown :nmap zc") + +api.nvim_command( + "au FileType markdown :syn region markdownWikiLink matchgroup=markdownLinkDelimiter start='\\[\\[' end='\\]\\]' contains=markdownLinkUrl keepend oneline concealends" +) +api.nvim_command([[au! BufEnter,BufNewFile,BufRead *.md syn match markdownTag "#[0-9A-Za-z:._]\+"]]) +api.nvim_command("augroup END") diff --git a/configs/nvim/lua/lib/obsidian/obsidian.lua b/configs/nvim/lua/lib/obsidian/obsidian.lua new file mode 100644 index 0000000..ef00d55 --- /dev/null +++ b/configs/nvim/lua/lib/obsidian/obsidian.lua @@ -0,0 +1,29 @@ +local function setup_cmp() + local cmp = require("cmp") + local obsidian_source = require("lib/obsidian/cmp_source").source + cmp.register_source("obsidian", obsidian_source) + + local sources = { { name = "obsidian" } } + + for _, source in pairs(cmp.get_config().sources) do + if source.name ~= "obsidian" then + table.insert(sources, source) + end + end + + cmp.setup.filetype("markdown", { sources = sources }) + cmp.setup.buffer({ sources = sources }) +end + +local function setup() + print(123123) + setup_cmp() + require("lib/obsidian/md_buffer_au") + -- require("lib/obsidian/wikilinks") +end + +return { + setup = setup, + hover_link = require("lib/obsidian/lib").hover_link, + open_link = require("lib/obsidian/lib").open_link, +} diff --git a/configs/nvim/lua/lib/utils/has_prop.lua b/configs/nvim/lua/lib/utils/has_prop.lua deleted file mode 100644 index 6cefcae..0000000 --- a/configs/nvim/lua/lib/utils/has_prop.lua +++ /dev/null @@ -1,14 +0,0 @@ -local function has_prop(packages, hook, callback) - for _,p in pairs(packages) do - local package = require(p) - - if package[hook]~=nil then - callback(package) - end - end -end - - -return { - has_prop = has_prop, -} diff --git a/configs/nvim/lua/lib/utils/print_table.lua b/configs/nvim/lua/lib/utils/print_table.lua deleted file mode 100644 index fe6ee59..0000000 --- a/configs/nvim/lua/lib/utils/print_table.lua +++ /dev/null @@ -1,97 +0,0 @@ ---[[ -Most pure lua print table functions I've seen have a problem with deep recursion and tend to cause a stack overflow when -going too deep. This print table function that I've written does not have this problem. It should also be capable of handling -really large tables due to the way it handles concatenation. In my personal usage of this function, it outputted 63k lines to -file in about a second. - -The output also keeps lua syntax and the script can easily be modified for simple persistent storage by writing the output to -file if modified to allow only number, boolean, string and table data types to be formatted. - -author: Alundaio (aka Revolucas) ---]] - -local function print_table(node) - -- to make output beautiful - local function tab(amt) - local str = "" - for i=1,amt do - str = str .. " " - end - return str - end - - local cache, stack, output = {},{},{} - local depth = 1 - local output_str = "{\n" - - while true do - local size = 0 - for k,v in pairs(node) do - size = size + 1 - end - - local cur_index = 1 - for k,v in pairs(node) do - if (cache[node] == nil) or (cur_index >= cache[node]) then - - if (string.find(output_str,"}",output_str:len())) then - output_str = output_str .. ",\n" - elseif not (string.find(output_str,"\n",output_str:len())) then - output_str = output_str .. "\n" - end - - -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings - table.insert(output,output_str) - output_str = "" - local key - - if (type(k) == "number" or type(k) == "boolean") then - key = "["..tostring(k).."]" - else - key = "['"..tostring(k).."']" - end - - if (type(v) == "number" or type(v) == "boolean") then - output_str = output_str .. tab(depth) .. key .. " = "..tostring(v) - elseif (type(v) == "table") then - output_str = output_str .. tab(depth) .. key .. " = {\n" - table.insert(stack,node) - table.insert(stack,v) - cache[node] = cur_index+1 - break - else - output_str = output_str .. tab(depth) .. key .. " = '"..tostring(v).."'" - end - - if (cur_index == size) then - output_str = output_str .. "\n" .. tab(depth-1) .. "}" - else - output_str = output_str .. "," - end - else - -- close the table - if (cur_index == size) then - output_str = output_str .. "\n" .. tab(depth-1) .. "}" - end - end - - cur_index = cur_index + 1 - end - - if (#stack > 0) then - node = stack[#stack] - stack[#stack] = nil - depth = cache[node] == nil and depth + 1 or depth - 1 - else - break - end - end - - -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings - table.insert(output,output_str) - output_str = table.concat(output) - - print(output_str) -end - -return { print_table = print_table } diff --git a/configs/nvim/lua/lib/utils/table_merge.lua b/configs/nvim/lua/lib/utils/table_merge.lua deleted file mode 100644 index 4fd0d7d..0000000 --- a/configs/nvim/lua/lib/utils/table_merge.lua +++ /dev/null @@ -1,16 +0,0 @@ -local function table_merge(t1, t2) - for k,v in pairs(t2) do - if type(v) == "table" then - if type(t1[k] or false) == "table" then - table_merge(t1[k] or {}, t2[k] or {}) - else - t1[k] = v - end - else - t1[k] = v - end - end - return t1 -end - -return { table_merge = table_merge } diff --git a/configs/nvim/lua/lib/utils/table_slice.lua b/configs/nvim/lua/lib/utils/table_slice.lua deleted file mode 100644 index 4ccdbc2..0000000 --- a/configs/nvim/lua/lib/utils/table_slice.lua +++ /dev/null @@ -1,11 +0,0 @@ -local function table_slice(tbl, first, last, step) - local sliced = {} - - for i = first or 1, last or #tbl, step or 1 do - sliced[#sliced+1] = tbl[i] - end - - return sliced -end - -return { table_slice = table_slice } diff --git a/configs/nvim/lua/opts.lua b/configs/nvim/lua/opts.lua deleted file mode 100644 index 84e89e9..0000000 --- a/configs/nvim/lua/opts.lua +++ /dev/null @@ -1,68 +0,0 @@ -local g = vim.g -local opt = vim.opt - -g.mapleader = ' ' -g.markdown_fenced_languages = { - 'bash=sh', - 'css', - 'html', - 'javascript', - 'js=javascript', - 'json=javascript', - 'php', - 'python', - 'ruby', - 'rust', - 'sql', - 'ts=typescript', - 'typescript', - 'vim', - 'dbml', - 'sass', -} - -opt.backup = false -opt.clipboard = 'unnamedplus' -opt.colorcolumn = '120' -opt.completeopt = {'menuone', 'noinsert', 'noselect'}; -opt.cursorline = true -opt.encoding = 'utf-8' -opt.expandtab = true -opt.grepprg = 'rg --color=never --vimgrep' -opt.hidden = true -opt.ignorecase = true -opt.laststatus = 2 -opt.lcs = 'eol:Β·' -opt.list = true -opt.mouse = 'a' -opt.mouse = 'a' -opt.number = true -opt.rnu = true -opt.scrolloff = 8 -opt.sessionoptions = 'folds' -opt.shiftwidth = 2 -opt.showtabline = 0 -opt.spelllang = {'en_us', 'ru'} -opt.splitbelow = true -opt.splitright = true -opt.swapfile = false -opt.tabstop = 2 -opt.termguicolors = false -opt.updatetime = 750 -opt.viewoptions = 'cursor,folds' -opt.wildignore = {'package-lock.json','yarn.lock'} -opt.wrap = false -opt.writebackup = false -opt.termguicolors = true -opt.conceallevel = 2 - -opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" -opt.foldtext = "v:lua.vim.treesitter.foldtext()" - --- opt.verbose = 2 --- opt.verbosefile = "/Users/anton/.logs/nvim.log" - -vim.cmd([[iabbrev ymd% strftime("%Y%m%d")]]) - --- vim.api.nvim_create_autocmd({ "InsertEnter" }, { command = "hi CursorLine ctermbg=16" }) --- vim.api.nvim_create_autocmd({ "InsertLeave" }, { command = "hi CursorLine ctermbg=none" }) diff --git a/configs/nvim/lua/packages/close-buffers.lua b/configs/nvim/lua/packages/close-buffers.lua deleted file mode 100644 index 0560f64..0000000 --- a/configs/nvim/lua/packages/close-buffers.lua +++ /dev/null @@ -1,9 +0,0 @@ --- TODO: Keys - -local function install(use) - use 'Asheq/close-buffers.vim' -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/cmp-completion.lua b/configs/nvim/lua/packages/cmp-completion.lua deleted file mode 100644 index 5593294..0000000 --- a/configs/nvim/lua/packages/cmp-completion.lua +++ /dev/null @@ -1,109 +0,0 @@ -local function install(use) - use { - { "hrsh7th/nvim-cmp", - config = function() - local cmp = require "cmp" - local lspkind = require("lspkind") - - lspkind.init({ - symbol_map = { - Text = "", - Method = "", - Function = "οž”", - Constructor = "", - Field = "ο° ", - Variable = "ο”ͺ", - Class = "ο΄―", - Interface = "", - Module = "ο’‡", - Property = "ο° ", - Unit = "呞", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "ο£—", - File = "", - Reference = "οœ†", - Folder = "", - EnumMember = "", - Constant = "ο£Ύ", - Struct = "Χ€ΦΌ", - Event = "", - Operator = "οš”", - TypeParameter = "" - } - }) - - cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - formatting = { - format = lspkind.cmp_format { - with_text = false, - maxwidth = 50, - menu = { - buffer = "BUF", - nvim_lsp = "LSP", - path = "PATH", - calc = "CALC", - spell = "SPELL", - emoji = "EMOJI" - } - } - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - -- [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - - experimental = {native_menu = false, ghost_text = false}, - - sources = { - {name = "nvim_lsp"}, - {name = 'luasnip' }, - {name = "buffer", keyword_length = 5}, - {name = "calc"}, - {name = "emoji"}, - {name = "spell"}, - {name = "path"}, - } - }) - - -- Use buffer source for `/`. - cmp.setup.cmdline("/", {sources = {{name = "buffer"}}}) - - -- Use cmdline & path source for ':'. - cmp.setup.cmdline(":", { - sources = cmp.config.sources({{name = "path"}}, {{name = "cmdline"}}) - }) - end - }, - - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "f3fora/cmp-spell", - "hrsh7th/cmp-calc", - "hrsh7th/cmp-emoji", - "onsails/lspkind-nvim", - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "rafamadriz/friendly-snippets", - } -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/comment.lua b/configs/nvim/lua/packages/comment.lua deleted file mode 100644 index 4757936..0000000 --- a/configs/nvim/lua/packages/comment.lua +++ /dev/null @@ -1,21 +0,0 @@ -local keys = { - c = { - name = 'Code Stuff', - c = { "CommentToggle", 'Comment' }, - }, -} - - -local function install(use) - use({ 'terrortylor/nvim-comment', - config = function() - require('nvim_comment').setup() - end - }) -end - - -return { - install = install, - keys = keys, -} diff --git a/configs/nvim/lua/packages/editorconfig.lua b/configs/nvim/lua/packages/editorconfig.lua deleted file mode 100644 index 8d562cf..0000000 --- a/configs/nvim/lua/packages/editorconfig.lua +++ /dev/null @@ -1,7 +0,0 @@ -local function install(use) - use 'editorconfig/editorconfig-vim' -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/extended-syntax.lua b/configs/nvim/lua/packages/extended-syntax.lua deleted file mode 100644 index 350ccc1..0000000 --- a/configs/nvim/lua/packages/extended-syntax.lua +++ /dev/null @@ -1,8 +0,0 @@ -local function install(use) - use 'nono/vim-handlebars' - use 'jidn/vim-dbml' -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/fzf.lua b/configs/nvim/lua/packages/fzf.lua deleted file mode 100644 index d2a3752..0000000 --- a/configs/nvim/lua/packages/fzf.lua +++ /dev/null @@ -1,76 +0,0 @@ -local keys = { - f = { - name = 'fzf', - f = { - name = 'Files & Buffers', - p = { "lua require('fzf-lua').files()", 'Search in files'}, - b = { "lua require('fzf-lua').buffers()", 'Search in buffers'}, - q = { "lua require('fzf-lua').quickfix()", 'Search in quickfix'}, - h = { "lua require('fzf-lua').oldfiles()", 'Search in opened files history'}, - l = { "lua require('fzf-lua').blines()", 'Search in current buffer lines'}, - v = { "lua require('fzf-lua').grep_visual()", 'Grep in visual selection'}, - L= { "lua require('fzf-lua').loclist()", 'Search in location list'}, - }, - s = { - name = 'Search', - g = { "lua require('fzf-lua').grep()", 'Search' }, - l = { "lua require('fzf-lua').grep_last()", 'Search last pattern again' }, - c = { "lua require('fzf-lua').grep_cword()", 'Search the word under cursor' }, - C = { "lua require('fzf-lua').grep_cWORD()", 'Search the WORD under cursor' }, - v = { "lua require('fzf-lua').grep_visual()", 'Search the visual selection' }, - b = { "lua require('fzf-lua').grep_curbuf()", 'Live grep in the current buffer' }, - p = { "lua require('fzf-lua').live_grep()", 'Live grep in the current project' }, - }, - l = { - name = 'LSP', - r = { "lua require('fzf-lua').lsp_references()", 'Search for references' }, - f = { "lua require('fzf-lua').lsp_definitions()", 'Search for definitions' }, - F = { "lua require('fzf-lua').lsp_declarations()", 'Search for declarations' }, - t = { "lua require('fzf-lua').lsp_typedefs()", 'Search for type definitions' }, - i = { "lua require('fzf-lua').lsp_implementations()", 'Search for implementations' }, - s = { "lua require('fzf-lua').lsp_document_symbols()", 'Search for document symbols' }, - S = { "lua require('fzf-lua').lsp_workspace_symbols()", 'Search for workspace symbols' }, - a = { "lua require('fzf-lua').lsp_code_actions()", 'Search for code actions' }, - d = { "lua require('fzf-lua').lsp_document_diagnostics()", 'Search for document diagnostics' }, - D = { "lua require('fzf-lua').lsp_workspace_diagnostics()", 'Search for workspace diagnostics' }, - }, - m = { - name = 'Misc', - b = { "lua require('fzf-lua').builtin()", 'fzf-lua builtin methods' }, - t = { "lua require('fzf-lua').help_tags()", 'help tags' }, - M = { "lua require('fzf-lua').man_pages()", 'man pages' }, - c = { "lua require('fzf-lua').colorschemes()", 'color schemes' }, - r = { "lua require('fzf-lua').commands()", 'commands' }, - h = { "lua require('fzf-lua').command_history()", 'commands history' }, - H = { "lua require('fzf-lua').search_history()", 'search history' }, - m = { "lua require('fzf-lua').marks()", 'marks' }, - R = { "lua require('fzf-lua').registers()", 'registers' }, - k = { "lua require('fzf-lua').keymaps()", 'keymaps' }, - }, - g = { - name = 'Git', - f = { "lua require('fzf-lua').git_files()", 'Search in git ls-files' }, - s = { "lua require('fzf-lua').git_status()", 'Search in git status' }, - c = { - name = "Search in git commit log", - c = { "lua require('fzf-lua').git_commits()", 'Search in git commit log' }, - b = { "lua require('fzf-lua').git_bcommits()", 'Search in git commit log for a buffer' }, - }, - b = { "lua require('fzf-lua').git_branch()", 'Search in git branches' }, - }, - } -} - - -local function install(use) - use { - 'ibhagwan/fzf-lua', - 'vijaymarupudi/nvim-fzf', - } -end - - -return { - install = install, - keys = keys, -} diff --git a/configs/nvim/lua/packages/git.lua b/configs/nvim/lua/packages/git.lua deleted file mode 100644 index 510f48a..0000000 --- a/configs/nvim/lua/packages/git.lua +++ /dev/null @@ -1,26 +0,0 @@ -local keys = { - g = { - name = 'git', - b = { ':G blame', 'blame'}, - d = { ':G diff', 'diff'}, - l = { ':G log', 'log'}, - s = { ':G', 'status'}, - o = { ':G browse', 'open url to this file' }, - }, -} - - -local function install(use) - use 'tpope/vim-fugitive' - use 'tpope/vim-rhubarb' - use { 'lewis6991/gitsigns.nvim', - config = function() - require('gitsigns').setup() - end - } -end - -return { - install = install, - keys = keys, -} diff --git a/configs/nvim/lua/packages/glow.lua b/configs/nvim/lua/packages/glow.lua deleted file mode 100644 index b528dd2..0000000 --- a/configs/nvim/lua/packages/glow.lua +++ /dev/null @@ -1,27 +0,0 @@ -local keys = { - m = { - name = "markdown", - p = { "Glow keep", "Preview" }, - h = { "Glow preview", "Hover Preview" }, - s = { "Glow split", "Split Preview" }, - } -} - -local function install(use) - -- use {"ellisonleao/glow.nvim"} - use {"lnc3l0t/glow.nvim", branch = "advanced_window"} -end - -local function setup() - require("glow").setup({ - in_place = true, - -- pager = true, - }) -end - - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/import-cost.lua b/configs/nvim/lua/packages/import-cost.lua deleted file mode 100644 index 0015028..0000000 --- a/configs/nvim/lua/packages/import-cost.lua +++ /dev/null @@ -1,15 +0,0 @@ -local api = vim.api - -local function install(use) - use({ "yardnsm/vim-import-cost", run = "npm install" }) -end - -local function post_setup() - api.nvim_command(':highlight link ImportCostVirtualText Comment') - api.nvim_command('au FileType typescript,typescriptreact,javascript,javascriptreact :silent! ImportCost') -end - -return { - install = install, - post_setup = post_setup, -} diff --git a/configs/nvim/lua/packages/indent-blankline.lua b/configs/nvim/lua/packages/indent-blankline.lua deleted file mode 100644 index 4b11d23..0000000 --- a/configs/nvim/lua/packages/indent-blankline.lua +++ /dev/null @@ -1,7 +0,0 @@ -local function install(use) - use 'lukas-reineke/indent-blankline.nvim' -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/lsp/format.lua b/configs/nvim/lua/packages/lsp/format.lua deleted file mode 100644 index 57d56e9..0000000 --- a/configs/nvim/lua/packages/lsp/format.lua +++ /dev/null @@ -1,34 +0,0 @@ -local eslint = { - lintCommand = 'eslint_d -f unix --stdin --stdin-filename ${INPUT}', - lintIgnoreExitCode = true, - lintStdin = true, - lintFormats = { '%f:%l:%c: %m' }, - formatCommand = 'eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}', - formatStdin = true, -} - -local prettier = { formatCommand = './node_modules/.bin/prettier --stdin-filepath ${INPUT}', formatStdin = true } -local stylua = { formatCommand = 'stylua -s -', formatStdin = true } -local blue = { formatCommand = 'blue --quiet -', formatStdin = true } -local pylint = { - lintCommand = 'pylint --output-format text --score no --msg-template {path}:{line}:{column}:{C}:pylint:{msg} --load-plugins=pylint_django --load-plugins=pylint_django.checkers.migrations ${INPUT}', - lintFormats = {"%f:%l:%c:%t:%m"}, - lintStdin = false, - lintOffsetColumns = 1, - lintCategoryMap = {I = 'H', R = 'I', C = 'I', W = 'W', E = 'E', F = 'E'} - } - -return { - -- css = { prettier }, - -- html = { prettier }, - -- javascript = { prettier, eslint }, - -- javascriptreact = { prettier, eslint }, - -- json = { prettier }, - lua = { stylua }, - -- markdown = { prettier }, - python = { blue }, - -- scss = { prettier }, - -- typescript = { prettier, eslint }, - -- typescriptreact = { prettier, eslint }, - -- yaml = { prettier }, -} diff --git a/configs/nvim/lua/packages/lsp/init.lua b/configs/nvim/lua/packages/lsp/init.lua deleted file mode 100644 index 14d7cca..0000000 --- a/configs/nvim/lua/packages/lsp/init.lua +++ /dev/null @@ -1,70 +0,0 @@ -local enabled_lsp_servers = require('config').enabled_lsp_servers -local lsp_status_config = require('packages/lsp/lsp_status_config').lsp_status_config -local keys = require('packages/lsp/keys').keys - -local function install(use) - use 'neovim/nvim-lspconfig' - use 'williamboman/nvim-lsp-installer' - use 'ray-x/lsp_signature.nvim' - use 'jose-elias-alvarez/nvim-lsp-ts-utils' - use 'nvim-lua/lsp-status.nvim' - use 'arkav/lualine-lsp-progress' - -- use { - -- 'mrcjkb/haskell-tools.nvim', - -- requires = { - -- 'nvim-lua/plenary.nvim', - -- 'nvim-telescope/telescope.nvim', -- optional - -- }, - -- branch = '1.x.x', -- recommended - -- } -end - -local function setup() - local ok, wf = pcall(require, "vim.lsp._watchfiles") - if ok then - -- disable lsp watcher. Too slow on linux - wf._watchfunc = function() - return function() end - end - end - - require('lsp-status').config(lsp_status_config) - require('nvim-lsp-installer').setup({}) -end - -local function post_setup() - local lsp_installer_servers = require('nvim-lsp-installer.servers') - - local pyright_settings = require('packages/lsp/lsp_python').settings - local efm_settings = require('packages/lsp/lsp_efm').settings - - local server_configs = { - efm = efm_settings, - pyright = pyright_settings, - } - - -- Loop through the servers listed above. - for _, server_name in pairs(enabled_lsp_servers) do - local lspconfig = require('lspconfig') - local config = server_configs[server_name] or {} - - config.on_attach = function(client) - if client.name ~= 'null_ls' then - -- client.resolved_capabilities.document_formatting = false - client.server_capabilities.documentFormattingProvider = false - end - end - - lspconfig[server_name].setup(config) - vim.cmd [[ do User LspAttachBuffers ]] - end -end - - -return { - install = install, - setup = setup, - post_setup = post_setup, - keys = keys, -} - diff --git a/configs/nvim/lua/packages/lsp/keys.lua b/configs/nvim/lua/packages/lsp/keys.lua deleted file mode 100644 index 5147539..0000000 --- a/configs/nvim/lua/packages/lsp/keys.lua +++ /dev/null @@ -1,36 +0,0 @@ -local keys = { - l = { - name = 'LSP', - a = { 'lua vim.lsp.buf.code_action()', 'Select a code action' }, - d = { - name = 'Diagnostic actions..', - d = {'lua vim.diagnostic.open_float()', 'Open diagnostics window for current line' }, - e = {'lua vim.lsp.diagnostic.goto_prev()', 'Go to previous diagnostic'}, - n = {'lua vim.lsp.diagnostic.goto_next()', 'Go to next diagnostic'}, - O = {'lua vim.diagnostic.config({virtual_text = true})', 'enable virtual text'}, - o = {'lua vim.diagnostic.config({virtual_text = false})', 'disable virtual text'}, - }, - E = {'lua vim.lsp.buf.declaration()', 'Jump to symbol declaration'}, - e = {'lua vim.lsp.buf.definition()', 'Jump to symbol definition'}, - -- f = {"lua vim.lsp.buf.formatting()", 'Format the current buffer'}, - f = {"lua vim.lsp.buf.format({ async = true })", "Format the current buffer"}, - h = {'lua vim.lsp.buf.hover()', 'Display hover information for symbol'}, - H = {'lua vim.lsp.buf.hover();vim.lsp.buf.hover()', 'Jump into hover information for symbol'}, - i = {'lua vim.lsp.buf.implementation()', 'List implementations for symbol'}, - l = {'lua vim.lsp.diagnostic.set_loclist()', 'Set location list'}, - r = {'lua vim.lsp.buf.references()', 'List references for symbol'}, - R = {'lua vim.lsp.buf.rename()', 'Rename all symbol references'}, - s = {'lua vim.lsp.buf.signature_help()', 'Display signature information for symbol'}, - t = {'lua vim.lsp.buf.type_definition()', 'Jump to symbol type definition'}, - w = { - name = 'Workspace actions...', - a = {'lua vim.lsp.buf.add_workspace_folder()', 'Add folder to workspace'}, - r = {'lua vim.lsp.buf.remove_workspace_folder()', 'Remove folder from workspace'}, - l = {'lua print()vim.inspect()vim.lsp.buf.list_workspace_folders()', 'List folders in workspace'}, - }, - }, -} - -return { - keys = keys, -} diff --git a/configs/nvim/lua/packages/lsp/lsp_efm.lua b/configs/nvim/lua/packages/lsp/lsp_efm.lua deleted file mode 100644 index 6b39196..0000000 --- a/configs/nvim/lua/packages/lsp/lsp_efm.lua +++ /dev/null @@ -1,19 +0,0 @@ -local lspconfig = require('lspconfig') -local format_config = require('packages/lsp/format') - -local settings = { - filetypes = vim.tbl_keys(format_config), - init_options = { - documentFormatting = true, - hover = true, - documentSymbol = true, - codeAction = true, - completion = true, - }, - root_dir = lspconfig.util.root_pattern { '.git/', '.' }, - settings = { languages = format_config }, -} - -return { - settings = settings, -} diff --git a/configs/nvim/lua/packages/lsp/lsp_python.lua b/configs/nvim/lua/packages/lsp/lsp_python.lua deleted file mode 100644 index da69f18..0000000 --- a/configs/nvim/lua/packages/lsp/lsp_python.lua +++ /dev/null @@ -1,49 +0,0 @@ -local util = require('lspconfig/util') -local path = util.path -local env = vim.env -local fn = vim.fn - --- We need to set up the virtual env when using poetry like this, because of the following bug: --- This was copy pasted -- see GitHub issue https://github.com/neovim/nvim-lspconfig/issues/500 --- https://github.com/neovim/nvim-lspconfig/issues/500#issuecomment-876700701 --- https://github.com/neovim/nvim-lspconfig/issues/500#issuecomment-877293306 -local function get_python_path(workspace) - print("get python path") - - -- Use activated virtualenv. - if env.VIRTUAL_ENV then - return path.join(env.VIRTUAL_ENV, 'bin', 'python') - end - - -- Find and use virtualenv via poetry in workspace directory. - local match = fn.glob(path.join(workspace, 'poetry.lock')) - if match ~= '' then - local venv = fn.trim(fn.system('poetry env info -p')) - local p = path.join(venv, 'bin', 'python') - return p - end - - -- Fallback to system Python. - return fn.exepath('python3') or fn.exepath('python') or 'python' -end - - -local function on_init(client) - client.config.settings.python.pythonPath = get_python_path(client.config.root_dir) -end - - -local settings = { - analysis = { - autoSearchPaths = true, - diagnosticMode = "workspace", - useLibraryCodeForTypes = true, - typeCheckingMode = "off", -- this needs to be turned off if Django type stubs are not installed - }, - on_init = on_init, -} - - -return { - settings = settings, -} diff --git a/configs/nvim/lua/packages/lsp/lsp_status_config.lua b/configs/nvim/lua/packages/lsp/lsp_status_config.lua deleted file mode 100644 index 10f24ea..0000000 --- a/configs/nvim/lua/packages/lsp/lsp_status_config.lua +++ /dev/null @@ -1,13 +0,0 @@ -local lsp_status_config = { - indicator_errors = 'E:', - indicator_warnings = 'W:', - indicator_info = 'I:', - indicator_hint = 'H:', - indicator_ok = 'Ok', - current_function = false, - show_filename = false, -} - -return { - lsp_status_config = lsp_status_config, -} diff --git a/configs/nvim/lua/packages/lsp/on_attach.lua b/configs/nvim/lua/packages/lsp/on_attach.lua deleted file mode 100644 index 6ee286b..0000000 --- a/configs/nvim/lua/packages/lsp/on_attach.lua +++ /dev/null @@ -1,30 +0,0 @@ -return function(client) - -- client.resolved_capabilities.document_formatting = true - -- client.resolved_capabilities.goto_definition = false - - if client.name == 'tsserver' then - local ts_utils = require('nvim-lsp-ts-utils') - if ts_utils then - ts_utils.setup {} - ts_utils.setup_client(client) - end - end - - if client.name ~= 'efm' then - client.resolved_capabilities.document_formatting = false - end - - local lsp_signature = require('lsp_signature') - if lsp_signature then - lsp_signature.on_attach() - end - - if client.resolved_capabilities.document_formatting then - vim.cmd [[ - augroup Format - au! * - au BufWritePre lua vim.lsp.buf.formatting_sync(nil, 1000) - augroup END - ]] - end -end diff --git a/configs/nvim/lua/packages/lualine.lua b/configs/nvim/lua/packages/lualine.lua deleted file mode 100644 index e985cc9..0000000 --- a/configs/nvim/lua/packages/lualine.lua +++ /dev/null @@ -1,27 +0,0 @@ -local function install(use) - use { 'hoob3rt/lualine.nvim', - requires = { - 'kyazdani42/nvim-web-devicons', opt = true, - config = function() - require('lualine').setup({ - options = { - theme = '16color', - section_separators = { left = '|', right = '|'}, - component_separators = { left = '|', right = '|'}, - }, - sections = { - lualine_b = {{'diagnostics', sources={'nvim_lsp'}}, 'lsp_progress'}, - lualine_c = {{'filename', path = 1}}, - lualine_x = {{'diff', colored = false}, 'filetype'} - }, - extensions = {'quickfix', 'fugitive', 'fzf'} - }) - end - }, - } -end - -return { - install = install, -} - diff --git a/configs/nvim/lua/packages/neo-tree.lua b/configs/nvim/lua/packages/neo-tree.lua deleted file mode 100644 index d31dab4..0000000 --- a/configs/nvim/lua/packages/neo-tree.lua +++ /dev/null @@ -1,51 +0,0 @@ -local keys = { - n = { - name = 'Neotree', - o = { "Neotree", 'Open' }, - t = { "Neotree toggle", 'Toggle' }, - b = { "Neotree action=show source=buffers position=right toggle=true", 'Toggle Buffers' }, - f = { "Neotree reveal", 'Show current file' }, - g = { "Neotree float git_status", 'Git Status' }, - } -} - - -local function install(use) - vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) - use { - "nvim-neo-tree/neo-tree.nvim", - branch = "v2.x", - requires = { - "nvim-lua/plenary.nvim", - "kyazdani42/nvim-web-devicons", - "MunifTanjim/nui.nvim", - } - } -end - -local function setup() - require("neo-tree").setup({ - window = { - position = "left", - width = 40, - mappings = { - ["F"] = "fuzzy_finder", - ["/"] = "none", - ["D"] = "none", - } - }, - default_component_configs = { - indent = { - highlight = "Comment", - }, - }, - }) - - vim.cmd([[nnoremap \ :Neotree reveal]]) -end - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/nerdtree.lua b/configs/nvim/lua/packages/nerdtree.lua deleted file mode 100644 index f8dc114..0000000 --- a/configs/nvim/lua/packages/nerdtree.lua +++ /dev/null @@ -1,22 +0,0 @@ -local function install(use) - use { - 'preservim/nerdtree', - 'Xuyuanp/nerdtree-git-plugin', - } -end - - -local keys = { - n = { - name = 'NERDTree', - o = { "NERDTree", 'Open' }, - t = { "NERDTreeToggle", 'Toggle' }, - f = { "NERDTreeFind", 'Find' }, - R = { "NERDTreeRefreshRoot", 'Refresh' }, - }, -} - -return { - install = install, - keys = keys, -} diff --git a/configs/nvim/lua/packages/null-ls.lua b/configs/nvim/lua/packages/null-ls.lua deleted file mode 100644 index 3189081..0000000 --- a/configs/nvim/lua/packages/null-ls.lua +++ /dev/null @@ -1,42 +0,0 @@ -local function install(use) - use 'jose-elias-alvarez/null-ls.nvim' -end - -local function setup() - local null_ls = require('null-ls') - local lspconfig = require('lspconfig') - - null_ls.setup({ - root_dir = lspconfig.util.root_pattern(".null-ls-root", "Makefile", "tsconfig.json", "go.mod", "poetry.toml", ".git"), - sources = { - -- null_ls.builtins.completion.spell, - null_ls.builtins.code_actions.eslint_d, - null_ls.builtins.code_actions.gitsigns, - null_ls.builtins.code_actions.refactoring, - null_ls.builtins.code_actions.shellcheck, - - null_ls.builtins.diagnostics.actionlint, - null_ls.builtins.diagnostics.eslint_d, - null_ls.builtins.diagnostics.ansiblelint, - null_ls.builtins.diagnostics.commitlint, - null_ls.builtins.diagnostics.gitlint, - null_ls.builtins.diagnostics.luacheck, - null_ls.builtins.diagnostics.markdownlint, - null_ls.builtins.diagnostics.checkmake, - - null_ls.builtins.formatting.eslint_d, - null_ls.builtins.formatting.blue, - null_ls.builtins.formatting.fixjson, - null_ls.builtins.formatting.lua_format, - null_ls.builtins.formatting.markdownlint, - null_ls.builtins.formatting.prettierd, - - null_ls.builtins.hover.dictionary, - }, - }) -end - -return { - install = install, - setup = setup, -} diff --git a/configs/nvim/lua/packages/nvim-colorizer.lua b/configs/nvim/lua/packages/nvim-colorizer.lua deleted file mode 100644 index fc8a9ae..0000000 --- a/configs/nvim/lua/packages/nvim-colorizer.lua +++ /dev/null @@ -1,12 +0,0 @@ -local function install(use) - use 'NvChad/nvim-colorizer.lua' -end - -local function setup() - require'colorizer'.setup() -end - -return { - install = install, - setup = setup, -} diff --git a/configs/nvim/lua/packages/nvim-java.lua b/configs/nvim/lua/packages/nvim-java.lua deleted file mode 100644 index 94f3a5f..0000000 --- a/configs/nvim/lua/packages/nvim-java.lua +++ /dev/null @@ -1,11 +0,0 @@ -local function install(use) - use("mfussenegger/nvim-jdtls") -end - -local function setup() -end - -return { - install = install, - setup = setup, -} diff --git a/configs/nvim/lua/packages/nvim-metals.lua b/configs/nvim/lua/packages/nvim-metals.lua deleted file mode 100644 index a6d39c1..0000000 --- a/configs/nvim/lua/packages/nvim-metals.lua +++ /dev/null @@ -1,29 +0,0 @@ -local function install(use) - use({ - "scalameta/nvim-metals", - requires = { "nvim-lua/plenary.nvim" } - }) -end - -local function setup() - local metals_config = require("metals").bare_config() - - metals_config.settings = { - showImplicitArguments = true, - serverVersion = 'latest.snapshot', - } - local group = vim.api.nvim_create_augroup("metals", { clear = true }) - - vim.api.nvim_create_autocmd({ "FileType" }, { - group = group, - pattern = { "scala", "sbt", "java" }, - callback = function() - require("metals").initialize_or_attach(metals_config) - end, - }) -end - -return { - install = install, - setup = setup, -} diff --git a/configs/nvim/lua/packages/nvim-obsidian/init.lua b/configs/nvim/lua/packages/nvim-obsidian/init.lua deleted file mode 100644 index b162e65..0000000 --- a/configs/nvim/lua/packages/nvim-obsidian/init.lua +++ /dev/null @@ -1,43 +0,0 @@ -local keys = { - o = { - name = 'Obsidian', - r = { "lua require('packages/nvim-obsidian/lib').rename()", "Rename a note" }, - b = { "lua require('packages/nvim-obsidian/lib').show_backlinks()", "Show backlinks" }, - h = { "lua require('packages/nvim-obsidian/lib').hover_link()", "Preview a link under cursor" }, - x = { "lua require('packages/nvim-obsidian/lib').open_link()", "Open a link under cursor" }, - } -} - -local function install(use) - use 'cdutboy928/vim_markdown_shortcuts.vim' -end - -local function setup_cmp() - local cmp = require("cmp") - local obsidian_source = require('packages/nvim-obsidian/cmp_source').source - cmp.register_source('obsidian', obsidian_source) - - local sources = {{ name = "obsidian" }} - - for _, source in pairs(cmp.get_config().sources) do - if source.name ~= "obsidian" then - table.insert(sources, source) - end - end - - cmp.setup.filetype('markdown', { sources = sources }) - cmp.setup.buffer({ sources = sources }) -end - -local function setup() - setup_cmp() - require('packages/nvim-obsidian/md_buffer_au') - require('packages/nvim-obsidian/wikilinks') -end - - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/nvim-obsidian/md_buffer_au.lua b/configs/nvim/lua/packages/nvim-obsidian/md_buffer_au.lua deleted file mode 100644 index 43d7258..0000000 --- a/configs/nvim/lua/packages/nvim-obsidian/md_buffer_au.lua +++ /dev/null @@ -1,28 +0,0 @@ --- Markdown Buffer Settings --- -local api = vim.api -local cmd = vim.cmd - -api.nvim_command('augroup obsidian') - -- add any nested dirs to the `gf` path, like in obsidian - api.nvim_command('au FileType markdown :setlocal path+=./**') - - -- - Filenames may contain spaces - api.nvim_command('au FileType markdown :setlocal isfname+=32') - api.nvim_command('au FileType markdown :setlocal isfname+=&') - - -- Automatically add .md ext - api.nvim_command('au FileType markdown :setlocal suffixesadd+=.md') - - -- Force markdown content wrapping - api.nvim_command('au FileType markdown :setlocal wrap linebreak') - -- api.nvim_command('au FileType markdown :silent SoftWrapMode') - - --- Let's `gf` edits file even if it hasn't been created before - api.nvim_command('au FileType markdown :map gf :e .md') - api.nvim_command('au FileType markdown :nmap zo') - api.nvim_command('au FileType markdown :nmap zc') - - api.nvim_command("au FileType markdown :syn region markdownWikiLink matchgroup=markdownLinkDelimiter start='\\[\\[' end='\\]\\]' contains=markdownLinkUrl keepend oneline concealends") - api.nvim_command([[au! BufEnter,BufNewFile,BufRead *.md syn match markdownTag "#[0-9A-Za-z:._]\+"]]) -api.nvim_command('augroup END') diff --git a/configs/nvim/lua/packages/nvim-obsidian/wikilinks.lua b/configs/nvim/lua/packages/nvim-obsidian/wikilinks.lua deleted file mode 100644 index bebd36a..0000000 --- a/configs/nvim/lua/packages/nvim-obsidian/wikilinks.lua +++ /dev/null @@ -1,10 +0,0 @@ -local cmd = vim.cmd - --- markdownWikiLink is a new region -cmd('syn region markdownWikiLink matchgroup=markdownLinkDelimiter start="\\[\\[" end="\\]\\]" contains=markdownUrl keepend oneline concealends') - --- markdownLinkText is copied from runtime files with 'concealends' appended -cmd('syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\\=\\[\\%(\\%(\\_[^][]\\|\\[\\_[^][]*\\]\\)*]\\%( \\=[[(]\\)\\)\\@=" end="\\]\\%( \\=[[(]\\)\\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart concealends') - --- markdownLink is copied from runtime files with 'conceal' appended -cmd('syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained conceal') diff --git a/configs/nvim/lua/packages/nvim-session.lua b/configs/nvim/lua/packages/nvim-session.lua deleted file mode 100644 index 73a610c..0000000 --- a/configs/nvim/lua/packages/nvim-session.lua +++ /dev/null @@ -1,13 +0,0 @@ -local api = vim.api - --- Save / Load session -local function post_setup() - api.nvim_command('au BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!') - api.nvim_command('autocmd BufWinEnter ?* silent! loadview') -end - -return { - post_setup = post_setup, -} - - diff --git a/configs/nvim/lua/packages/obsidian.lua b/configs/nvim/lua/packages/obsidian.lua deleted file mode 100644 index 18e33bf..0000000 --- a/configs/nvim/lua/packages/obsidian.lua +++ /dev/null @@ -1,117 +0,0 @@ -local cmd = vim.cmd -local keymap = vim.keymap -local ui = vim.ui -local fn = vim.fn -local autocmd = vim.api.nvim_create_autocmd - - -local keys = { - o = { - name = 'Obsidian', - r = { "lua require('packages/nvim-obsidian/lib').rename()", "Rename a note" }, - b = { "ObsidianBacklinks", "Show backlinks" }, - h = { "lua require('packages/nvim-obsidian/lib').hover_link()", "Preview a link under cursor" }, - s = { "ObsidianSearch", "Search notes" }, - p = { "ObsidianQuickSwitch", "Quick switch to a note" }, - t = { "ObsidianTemplate", "Insert Template" }, - n = { "lua require('packages/obsidian').new_note()", "Create a new note" }, - x = { "lua require('packages/nvim-obsidian/lib').open_link()", "Open a link under cursor" }, - o = { "ObsidianFollowLink", "Follow link"}, - } -} - -local function new_note() - ui.input({ prompt = 'Enter a new note name: ' }, function(input) - cmd(":ObsidianNew "..input) - end) -end - -local function install(use) - -- use "MDeiml/tree-sitter-markdown" - use { - "epwalsh/obsidian.nvim", - -- lazy = true, - -- opt = true, - -- event = { "BufRead $NOTES_DIR*" }, - config = function () - require('obsidian').setup({ - dir = "~/Dev/@A/notes", - -- log_level = vim.log.levels.DEBUG, - daily_notes = { - folder = "daily", - date_format = "%Y%m%d" - }, - completion = { - nvim_cmp = true, - min_chars = 2, - new_notes_location = "current_dir" - }, - - note_id_func = function(title) - return title - end, - disable_frontmatter = true, - templates = { - subdir = "templates", - date_format = "%Y-%m-%d-%a", - time_format = "%H:%M", - }, - follow_url_func = function(url) - -- Open the URL in the default web browser. - -- vim.fn.jobstart({"open", url}) -- Mac OS - fn.jobstart({"xdg-open", url}) -- linux - end, - - -- Optional, set to true if you use the Obsidian Advanced URI plugin. - -- https://github.com/Vinzent03/obsidian-advanced-uri - use_advanced_uri = true, - - -- Optional, set to true to force ':ObsidianOpen' to bring the app to the foreground. - open_app_foreground = false, - - -- Optional, by default commands like `:ObsidianSearch` will attempt to use - -- telescope.nvim, fzf-lua, and fzf.nvim (in that order), and use the - -- first one they find. By setting this option to your preferred - -- finder you can attempt it first. Note that if the specified finder - -- is not installed, or if it the command does not support it, the - -- remaining finders will be attempted in the original order. - finder = "fzf-lua", - mappings = {}, - - }) - - - -- Optional, override the 'gf' keymap to utilize Obsidian's search functionality. - -- see also: 'follow_url_func' config option above. - -- vim.keymap.set("n", "gf", function() - -- if require("obsidian").util.cursor_on_markdown_link() then - -- return "ObsidianFollowLink" - -- else - -- return "gf" - -- end - -- end, { noremap = false, expr = true }) - end, - } -end - -local function post_setup() - -- vim.cmd(":au FileType mkd set filetype=lsp_markdown") - vim.cmd(":au! BufEnter,BufNewFile,BufRead *.md set ft=lsp_markdown") - vim.cmd(":syn region markdownWikiLink matchgroup=markdownLinkDelimiter start='\\[\\[' end='\\]\\]' contains=markdownLinkUrl keepend oneline concealends") - vim.cmd([[:au! BufEnter,BufNewFile,BufRead *.md syn match markdownTag "#[0-9A-Za-z:._]\+"]]) - - - local cwd = fn.getcwd() - -- TODO: ignore if current buffer is not empty - if cwd:find('^/home/anton/Dev/@A/notes') ~= nil then - cmd.edit('Index.md') - end -end - - -return { - new_note = new_note, - keys = keys, - install = install, - post_setup = post_setup, -} diff --git a/configs/nvim/lua/packages/packer.lua b/configs/nvim/lua/packages/packer.lua deleted file mode 100644 index 99bf28e..0000000 --- a/configs/nvim/lua/packages/packer.lua +++ /dev/null @@ -1,22 +0,0 @@ -local fn = vim.fn -local execute = vim.api.nvim_command - - -local function pre_install() - -- Auto-install packer if it hasn't been installed - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) - execute 'packadd packer.nvim' - end -end - -local function install(use) - use 'wbthomason/packer.nvim' -end - -return { - pre_install = pre_install, - install = install, -} diff --git a/configs/nvim/lua/packages/pretty-fold.lua b/configs/nvim/lua/packages/pretty-fold.lua deleted file mode 100644 index e644d45..0000000 --- a/configs/nvim/lua/packages/pretty-fold.lua +++ /dev/null @@ -1,15 +0,0 @@ -local function install(use) - use 'anuvyklack/pretty-fold.nvim' -end - -local function setup() - require('pretty-fold').setup({ - fill_char = 'Β·', - }) -end - - -return { - install = install, - setup = setup, -} diff --git a/configs/nvim/lua/packages/quickfix-to-bottom.lua b/configs/nvim/lua/packages/quickfix-to-bottom.lua deleted file mode 100644 index 8ede152..0000000 --- a/configs/nvim/lua/packages/quickfix-to-bottom.lua +++ /dev/null @@ -1,10 +0,0 @@ --- Always open quickfix window at the bottom of the screen -local api = vim.api - -local function install() - api.nvim_command('autocmd FileType qf wincmd J') -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/theme.lua b/configs/nvim/lua/packages/theme.lua deleted file mode 100644 index 66f1b56..0000000 --- a/configs/nvim/lua/packages/theme.lua +++ /dev/null @@ -1,28 +0,0 @@ - - -local keys = { - u = { - name = 'UI & Theme', - d = { ':lua vim.cmd(":colorscheme trash-polka")', 'Toggle dark theme'}, - l = { ':lua vim.cmd(":colorscheme trash-polka-light")', 'Toggle light theme'}, - } -} - - -local function install(use) - use({ - '~/Dev/@A/vim-trash-polka', - }) -end - - -local function setup() - require("colorscheme") -end - - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/tmux-navigation.lua b/configs/nvim/lua/packages/tmux-navigation.lua deleted file mode 100644 index 5c129d2..0000000 --- a/configs/nvim/lua/packages/tmux-navigation.lua +++ /dev/null @@ -1,60 +0,0 @@ -local fn = vim.fn -local cmd = vim.cmd -local api = vim.api -local keymap = vim.keymap - -local M = {} - -function install() - local navigation_map = { - left = { - vim = 'h', - tmux = 'L', - }, - right = { - vim = 'l', - tmux = 'R', - }, - up = { - vim = 'k', - tmux = 'U', - }, - down = { - vim = 'j', - tmux = 'D', - }, - } - - function M.navigate(direction) - return function() - if navigation_map[direction] == nil then - print('Unknown direction to navigate to "'..direction..'"') - return nil - end - - local win_num_before = fn.winnr() - cmd('execute "wincmd ' .. navigation_map[direction].vim..'"') - - -- if current window id and before the navigation are the same, - -- than we are at the edge of vim panes and should try tmux navigation - if fn.winnr() == win_num_before then - cmd('silent ! tmux select-pane -' .. navigation_map[direction].tmux) - end - - -- empty status line - -- cmd('echo') - end - end -end - -local function post_setup() - keymap.set('n', '', M.navigate('down'), { noremap = true }) - keymap.set('n', '', M.navigate('up'), { noremap = true}) - keymap.set('n', '', M.navigate('right'), { noremap = true}) - keymap.set('n', '', M.navigate('left'), { noremap = true}) -end - -return { - install = install, - post_setup = post_setup, -} diff --git a/configs/nvim/lua/packages/todo-comments.lua b/configs/nvim/lua/packages/todo-comments.lua deleted file mode 100644 index 8652c43..0000000 --- a/configs/nvim/lua/packages/todo-comments.lua +++ /dev/null @@ -1,28 +0,0 @@ -local keys = { - T = { - name = 'Trouble', - i = { 'TroubleToggle todo', 'ToDo Comments' }, - }, -} - - -local function install(use) - use { - 'folke/todo-comments.nvim', - requires = 'nvim-lua/plenary.nvim', - } -end - -local function setup() - require('todo-comments').setup({ - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - }) -end - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/todo-txt.lua b/configs/nvim/lua/packages/todo-txt.lua deleted file mode 100644 index 0bc4cb9..0000000 --- a/configs/nvim/lua/packages/todo-txt.lua +++ /dev/null @@ -1,7 +0,0 @@ -local function install(use) - use 'freitass/todo.txt-vim' -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/treesitter.lua b/configs/nvim/lua/packages/treesitter.lua deleted file mode 100644 index ebcfff8..0000000 --- a/configs/nvim/lua/packages/treesitter.lua +++ /dev/null @@ -1,24 +0,0 @@ -local enabled_treesitter_configs = require('config').enabled_treesitter_configs; - -local function install(use) - -- use "MDeiml/tree-sitter-markdown" - use { - { 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate', - config = function() - require('nvim-treesitter.configs').setup({ - ensure_installed = enabled_treesitter_configs, - auto_install = true, - highlight = { - enable = true, - } - }) - end - }, - { 'nvim-treesitter/playground' }, - } -end - -return { - install = install, -} diff --git a/configs/nvim/lua/packages/trouble.lua b/configs/nvim/lua/packages/trouble.lua deleted file mode 100644 index 7fb0e36..0000000 --- a/configs/nvim/lua/packages/trouble.lua +++ /dev/null @@ -1,28 +0,0 @@ -local keys = { - T = { - name = "Trouble", - T = { 'TroubleToggle', 'Toggle' }, - D = { 'TroubleToggle workspace_diagnostics', 'Workspace Diagnostics' }, - d = { 'Trouble document_diagnostics', 'Document Diagnostics' }, - q = { 'Trouble quickfix', 'Quickfix' }, - l = { 'Trouble loclist', 'Loclist' }, - r = { 'Trouble lsp_references', 'References' }, - }, -} - -local function install(use) - use 'folke/trouble.nvim' - use 'kyazdani42/nvim-web-devicons' -end - - -local function setup() - require('trouble').setup({}) -end - - -return { - install = install, - setup = setup, - keys = keys, -} diff --git a/configs/nvim/lua/packages/which-key.lua b/configs/nvim/lua/packages/which-key.lua deleted file mode 100644 index ed2278d..0000000 --- a/configs/nvim/lua/packages/which-key.lua +++ /dev/null @@ -1,17 +0,0 @@ --- local print_table = require('lib/utils/print_table').print_table -local keys = require('config').keys - -local function install(use) - use 'folke/which-key.nvim' -end - -local function post_setup() - local wk = require("which-key") - -- print_table(keys) - wk.register(keys, { prefix = "", mode = 'n' }) -end - -return { - install = install, - post_setup = post_setup -} diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua deleted file mode 100644 index 7d1b4f7..0000000 --- a/configs/nvim/lua/plugins.lua +++ /dev/null @@ -1,41 +0,0 @@ -local has_prop = require('lib/utils/has_prop').has_prop -local table_merge = require('lib/utils/table_merge').table_merge --- local dump = require('lib.utils.dump').dump - - -local init = function(config) - local keys = config.keys - local enabled_packages = config.enabled_packages - - -- Call pre_install hooks - has_prop(enabled_packages, 'pre_install', function(package) - package.pre_install() - end) - - require('packer').startup(function (use) - -- Call install hooks - has_prop(enabled_packages, 'install', function(package) - package.install(use) - end) - - -- Call setup hooks - has_prop(enabled_packages, 'setup', function(package) - package.setup() - end) - - -- Get keybindings - has_prop(enabled_packages, 'keys', function(package) - table_merge(keys, package.keys) - end) - end) - - -- Call post_setup hooks - has_prop(enabled_packages, 'post_setup', function(package) - package.post_setup() - end) -end - - -return { - init = init, -} diff --git a/configs/nvim/lua/plugins/chatgpt.lua b/configs/nvim/lua/plugins/chatgpt.lua new file mode 100644 index 0000000..ee3579b --- /dev/null +++ b/configs/nvim/lua/plugins/chatgpt.lua @@ -0,0 +1,10 @@ +return { + "dpayne/CodeGPT.nvim", + dependencies = { + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + }, + config = function() + require("codegpt.config") + end +} diff --git a/configs/nvim/lua/plugins/colorizer.lua b/configs/nvim/lua/plugins/colorizer.lua new file mode 100644 index 0000000..58145fb --- /dev/null +++ b/configs/nvim/lua/plugins/colorizer.lua @@ -0,0 +1,7 @@ +return { + "NvChad/nvim-colorizer.lua", + event = "VimEnter", + config = function() + require("colorizer").setup({}) + end, +} diff --git a/configs/nvim/lua/plugins/conform.lua b/configs/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..49ac40a --- /dev/null +++ b/configs/nvim/lua/plugins/conform.lua @@ -0,0 +1,47 @@ +return { + "stevearc/conform.nvim", + opts = {}, + + keys = { + { "lF", 'lua require("conform").format()', desc = "Format" }, + }, + + config = function() + require("conform").setup({ + format_on_save = function(bufnr) + local ignore_filetypes = { "helm", "lua" } + + if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then + return + end + + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + -- Disable autoformat for files in a certain path + local bufname = vim.api.nvim_buf_get_name(bufnr) + if bufname:match("/node_modules/") then + return + end + + return { timeout_ms = 500, lsp_fallback = true } + end, + formatters_by_ft = { + go = { "goimports", "golines", "gofmt", "gofumpt" }, + javascript = { { "prettierd", "prettier" } }, + javascriptreact = { { "prettierd", "prettier" } }, + typescript = { { "prettierd", "prettier" } }, + typescriptreact = { { "prettierd", "prettier" } }, + json = { { "jq" } }, + + lua = { "stylua" }, + sh = { "shfmt" }, + terraform = { "terraform_fmt" }, + rust = { "rustfmt" }, + python = { "black" }, + }, + }) + end, +} diff --git a/configs/nvim/lua/plugins/editorconfig.lua b/configs/nvim/lua/plugins/editorconfig.lua new file mode 100644 index 0000000..052e93c --- /dev/null +++ b/configs/nvim/lua/plugins/editorconfig.lua @@ -0,0 +1,3 @@ +return { + "editorconfig/editorconfig-vim", +} diff --git a/configs/nvim/lua/plugins/fzf.lua b/configs/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..659c3ba --- /dev/null +++ b/configs/nvim/lua/plugins/fzf.lua @@ -0,0 +1,68 @@ +return { + "ibhagwan/fzf-lua", + dependencies = { "vijaymarupudi/nvim-fzf" }, + keys = { + { "f", group = "+fzf" }, + + { "ff", group = "Files & Buffers" }, + { "ffp", ":lua require('fzf-lua').files()", desc = "Search in files" }, + { "ffb", ":lua require('fzf-lua').buffers()", desc = "Search in buffers" }, + { "ffq", ":lua require('fzf-lua').quickfix()", desc = "Search in quickfix" }, + { "ffh", ":lua require('fzf-lua').oldfiles()", desc = "Search in opened files history" }, + { "ffl", ":lua require('fzf-lua').blines()", desc = "Search in buffer lines" }, + { "ffL", ":lua require('fzf-lua').loclist()", desc = "Search in location list" }, + + { "fs", group = "Search" }, + { "fsg", ":lua require('fzf-lua').grep()", desc = "Search" }, + { "fsl", ":lua require('fzf-lua').grep_last()", desc = "Search last pattern again" }, + { "fsc", ":lua require('fzf-lua').grep_cword()", desc = "Search the word under cursor" }, + { "fsC", ":lua require('fzf-lua').grep_cWORD()", desc = "Search the WORD under cursor" }, + { "fsv", ":lua require('fzf-lua').grep_visual()", desc = "Search the visual selection" }, + { "fsb", ":lua require('fzf-lua').grep_curbuf()", desc = "SearchLive grep in the current buffer" }, + { "fsp", ":lua require('fzf-lua').live_grep()", desc = "Live grep in the current project" }, + + { "fl", group = "LSP" }, + { "flr", "lua require('fzf-lua').lsp_references()", desc = "Search for references" }, + { "flf", "lua require('fzf-lua').lsp_definitions()", desc = "Search for definitions" }, + { "flF", "lua require('fzf-lua').lsp_declarations()", desc = "Search for declarations" }, + { "flt", "lua require('fzf-lua').lsp_typedefs()", desc = "Search for type definitions" }, + { "fli", "lua require('fzf-lua').lsp_implementations()", desc = "Search for implementations" }, + { "fls", "lua require('fzf-lua').lsp_document_symbols()", desc = "Search for document symbols" }, + { "flS", "lua require('fzf-lua').lsp_workspace_symbols()", desc = "Search for workspace symbols" }, + { "fla", "lua require('fzf-lua').lsp_code_actions()", desc = "Search for code actions" }, + { + "fld", + "lua require('fzf-lua').lsp_document_diagnostics()", + desc = "Search for document diagnostics", + }, + { + "flD", + "lua require('fzf-lua').lsp_workspace_diagnostics()", + desc = "Search for workspace diagnostics", + }, + + { "fm", group = "Misc" }, + { "fmb", "lua require('fzf-lua').builtin()", desc = "fzf-lua builtin methods" }, + { "fmt", "lua require('fzf-lua').help_tags()", desc = "help tags" }, + { "fmM", "lua require('fzf-lua').man_pages()", desc = "man pages" }, + { "fmc", "lua require('fzf-lua').colorschemes()", desc = "color schemes" }, + { "fmr", "lua require('fzf-lua').commands()", desc = "commands" }, + { "fmh", "lua require('fzf-lua').command_history()", desc = "commands history" }, + { "fmH", "lua require('fzf-lua').search_history()", desc = "search history" }, + { "fmm", "lua require('fzf-lua').marks()", desc = "marks" }, + { "fmR", "lua require('fzf-lua').registers()", desc = "registers" }, + { "fmk", "lua require('fzf-lua').keymaps()", desc = "keymaps" }, + + { "fg", group = "Git" }, + { "fgf", "lua require('fzf-lua').git_files()", desc = "Search in git ls-files" }, + { "fgs", "lua require('fzf-lua').git_status()", desc = "Search in git status" }, + { "fgc", desc = "Search in git commit log" }, + { "fgcc", "lua require('fzf-lua').git_commits()", desc = "Search in git commit log" }, + { + "fgcb", + "lua require('fzf-lua').git_bcommits()", + desc = "Search in git commit log for a buffer", + }, + { "fgb", "lua require('fzf-lua').git_branch()", desc = "Search in git branches" }, + }, +} diff --git a/configs/nvim/lua/plugins/git.lua b/configs/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..94de028 --- /dev/null +++ b/configs/nvim/lua/plugins/git.lua @@ -0,0 +1,21 @@ +return { + "tpope/vim-fugitive", + dependencies = { + "tpope/vim-rhubarb", + "lewis6991/gitsigns.nvim", + }, + event = "BufEnter", + + keys = { + { "g", group = "+Git" }, + { "gb", ":G blame", desc = "Git blame" }, + { "gd", ":G diff", desc = "Git diff" }, + { "gl", ":G log", desc = "Git log" }, + { "gs", ":G", desc = "Git status" }, + { "go", ":G browse", desc = "Open url to this file" }, + }, + + config = function() + require("gitsigns").setup() + end, +} diff --git a/configs/nvim/lua/plugins/indent-blankline.lua b/configs/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..ad05066 --- /dev/null +++ b/configs/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,51 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + event = { "BufReadPost", "BufWritePost", "BufNewFile" }, + + config = function() + local highlight = { + "Red", + "Blue", + "Red", + "Blue", + "Red", + "Blue", + "Red", + } + + local hooks = require("ibl.hooks") + hooks.register(hooks.type.HIGHLIGHT_SETUP, function() + vim.api.nvim_set_hl(0, "Red", { fg = "#9e8284" }) + vim.api.nvim_set_hl(0, "Blue", { fg = "#94a1ae" }) + vim.api.nvim_set_hl(0, "Red", { fg = "#9e8284" }) + vim.api.nvim_set_hl(0, "Blue", { fg = "#94a1ae" }) + vim.api.nvim_set_hl(0, "Red", { fg = "#9e8284" }) + vim.api.nvim_set_hl(0, "Blue", { fg = "#94a1ae" }) + vim.api.nvim_set_hl(0, "Red", { fg = "#9e8284" }) + end) + + require("ibl").setup({ + indent = { + highlight = highlight, + char = "┃", + tab_char = "┃", + }, + scope = { enabled = false }, + exclude = { + filetypes = { + "help", + "alpha", + "dashboard", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + "lazyterm", + }, + }, + }) + end, +} diff --git a/configs/nvim/lua/plugins/lsp-saga.lua b/configs/nvim/lua/plugins/lsp-saga.lua new file mode 100644 index 0000000..af5e0b9 --- /dev/null +++ b/configs/nvim/lua/plugins/lsp-saga.lua @@ -0,0 +1,64 @@ +return { + "nvimdev/lspsaga.nvim", + + dependencies = { + "nvim-treesitter/nvim-treesitter", -- optional + "nvim-tree/nvim-web-devicons", -- optional + }, + + cmd = { "Lspsaga" }, + + config = function() + require("lspsaga").setup({ + diagnostic = { + show_code_action = false, + }, + symbol_in_winbar = { + enable = false + }, + finder = { + methods = { + tyd = "textDocument/typeDefinition", + }, + keys = { + shuttle = '' + } + }, + lightbulb = { + enable = false + }, + }) + end, + + keys = { + { "l", group = "+Lspsaga" }, + { "lh", "Lspsaga hover_doc", desc = "Hover a symbol" }, + { "lH", "Lspsaga hover_doc ++keep", desc = "Pin Hover" }, + + { "lo", "Lspsaga outline", desc = "Toggle Outline" }, + + { "lf", group = "+Lspsaga Finder" }, + { "lff", "Lspsaga finder def+ref+imp+tyd", desc = "Lspsaga Finder" }, + { "lfr", "Lspsaga finder ref", desc = "List References" }, + { "lfd", "Lspsaga finder def", desc = "List Definitions" }, + { "lfi", "Lspsaga finder imp", desc = "List Implementations" }, + { "lft", "Lspsaga finder tyd", desc = "List Type Definitions" }, + + { "la", "Lspsaga code_action", desc = "List Code Actions" }, + { "le", "Lspsaga goto_definition", desc = "Go to Definition" }, + { "lE", "Lspsaga peek_definition", desc = "Peek Definition" }, + { "lt", "Lspsaga goto_type_definition", desc = "Go to Type Definition" }, + { "lT", "Lspsaga peek_type_definition", desc = "Peek Type Definition" }, + + { "ld", group = "+Diagnostic" }, + { "ldl", "Lspsaga show_line_diagnostics", desc = "Show Line Diagnostic" }, + { "ldw", "Lspsaga show_workspace_diagnostics", desc = "Show Line Diagnostic" }, + { "ldl", "Lspsaga show_line_diagnostics", desc = "Show Line Diagnostic" }, + { "lde", "Lspsaga diagnostic_jump_prev", desc = "Go to Previous Diagnostic" }, + { "ldn", "Lspsaga diagnostic_jump_next", desc = "Go to Next Diagnostic" }, + { "ldv", "lua vim.diagnostic.config({virtual_text = true})", desc = "Enable Virtual Text" }, + { "ldV", "lua vim.diagnostic.config({virtual_text = false})", desc = "Disable Virtual Text" }, + + { "lr", "Lspsaga rename", desc = "Rename all symbol references" }, + }, +} diff --git a/configs/nvim/lua/plugins/lualine.lua b/configs/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..6492e0a --- /dev/null +++ b/configs/nvim/lua/plugins/lualine.lua @@ -0,0 +1,30 @@ +return { + "hoob3rt/lualine.nvim", + event = "VimEnter", + dependencies = { + "kyazdani42/nvim-web-devicons", + }, + config = function() + local CodeGPTModule = require("codegpt") + require("lualine").setup({ + options = { + theme = "nord", + section_separators = { left = "|", right = "|" }, + component_separators = { left = "|", right = "|" }, + }, + sections = { + lualine_b = { { "diagnostics", sources = { "nvim_lsp" } }, "lsp_progress" }, + lualine_c = { + { "filename", path = 1 }, + -- { + -- function() + -- return require("lspsaga.symbol.winbar").get_bar() + -- end, + -- }, + }, + lualine_x = { CodeGPTModule.get_status, { "diff", colored = false }, "filetype" }, + }, + extensions = { "quickfix", "fugitive", "fzf" }, + }) + end, +} diff --git a/configs/nvim/lua/plugins/mason.lua b/configs/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..cab0a77 --- /dev/null +++ b/configs/nvim/lua/plugins/mason.lua @@ -0,0 +1,40 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + }, + cmd = "Mason", + keys = { { "cm", "Mason", desc = "Mason" } }, + build = ":MasonUpdate", + opts_extend = { "ensure_installed" }, + + opts = { + ensure_installed = { + "stylua", + "shfmt", + }, + }, + + config = function(_, opts) + require("mason").setup(opts) + local mr = require("mason-registry") + mr:on("package:install:success", function() + vim.defer_fn(function() + -- trigger FileType event to possibly load this newly installed LSP server + require("lazy.core.handler.event").trigger({ + event = "FileType", + buf = vim.api.nvim_get_current_buf(), + }) + end, 100) + end) + + mr.refresh(function() + for _, tool in ipairs(opts.ensure_installed) do + local p = mr.get_package(tool) + if not p:is_installed() then + p:install() + end + end + end) + end, +} diff --git a/configs/nvim/lua/plugins/nerdtree.lua b/configs/nvim/lua/plugins/nerdtree.lua new file mode 100644 index 0000000..0a4cf3c --- /dev/null +++ b/configs/nvim/lua/plugins/nerdtree.lua @@ -0,0 +1,13 @@ +return { + 'preservim/nerdtree', + dependencies = { + 'Xuyuanp/nerdtree-git-plugin', + }, + keys = { + { "n", group = "+Tree" }, + { "no", ":NERDTree", "Open" }, + { "nt", ":NERDTreeToggle", "Toggle" }, + { "nf", ":NERDTreeFind", "Find" }, + { "nR", ":NERDTreeRefreshRoot", "Refresh" }, + }, +} diff --git a/configs/nvim/lua/plugins/nvim-cmp.lua b/configs/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..3ff7b1e --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,86 @@ +return { + "hrsh7th/nvim-cmp", + version = false, -- last release is way too old + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "f3fora/cmp-spell", + "hrsh7th/cmp-calc", + "hrsh7th/cmp-emoji", + "onsails/lspkind-nvim", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + -- Not all LSP servers add brackets when completing a function. + -- To better deal with this, LazyVim adds a custom option to cmp, + -- that you can configure. For example: + -- + -- ```lua + -- opts = { + -- auto_brackets = { "python" } + -- } + -- ``` + opts = function() + vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) + local cmp = require("cmp") + local defaults = require("cmp.config.default")() + local auto_select = true + return { + auto_brackets = {}, -- configure any filetype to auto add brackets + completion = { + completeopt = "menu,menuone,noinsert" .. (auto_select and "" or ",noselect"), + }, + preselect = auto_select and cmp.PreselectMode.Item or cmp.PreselectMode.None, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + -- [""] = LazyVim.cmp.confirm({ select = auto_select }), + -- [""] = LazyVim.cmp.confirm({ select = true }), + -- [""] = LazyVim.cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = function(fallback) + cmp.abort() + fallback() + end, + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + formatting = { + format = function(entry, item) + -- local icons = LazyVim.config.icons.kinds + -- if icons[item.kind] then + -- item.kind = icons[item.kind] .. item.kind + -- end + + local widths = { + abbr = vim.g.cmp_widths and vim.g.cmp_widths.abbr or 40, + menu = vim.g.cmp_widths and vim.g.cmp_widths.menu or 30, + } + + for key, width in pairs(widths) do + if item[key] and vim.fn.strdisplaywidth(item[key]) > width then + item[key] = vim.fn.strcharpart(item[key], 0, width - 1) .. "…" + end + end + + return item + end, + }, + experimental = { + ghost_text = { + hl_group = "CmpGhostText", + }, + }, + sorting = defaults.sorting, + } + end, + -- main = "lazyvim.util.cmp", +} diff --git a/configs/nvim/lua/plugins/nvim-dev.lua b/configs/nvim/lua/plugins/nvim-dev.lua new file mode 100644 index 0000000..1e83c38 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-dev.lua @@ -0,0 +1,25 @@ +return { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "luvit-meta/library", words = { "vim%.uv" } }, + }, + }, + }, + { "Bilal2453/luvit-meta", lazy = true }, -- optional `vim.uv` typings + { -- optional completion source for require statements and module annotations + "hrsh7th/nvim-cmp", + opts = function(_, opts) + opts.sources = opts.sources or {} + table.insert(opts.sources, { + name = "lazydev", + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }) + end, + }, + -- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim +} diff --git a/configs/nvim/lua/plugins/nvim-lspconfig.lua b/configs/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..06dc7d9 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,127 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPost", "BufWritePost", "BufNewFile" }, + + dependencies = { + "williamboman/mason.nvim", + { "williamboman/mason-lspconfig.nvim", config = function() end }, + { "nvim-lua/lsp-status.nvim" }, + { "arkav/lualine-lsp-progress" }, + { "SmiteshP/nvim-navic" }, + }, + + config = function() + local navic = require("nvim-navic") + navic.setup({ + icons = { + File = "σ°ˆ™ ", + Module = " ", + Namespace = "σ°Œ— ", + Package = " ", + Class = "σ°Œ— ", + Method = "󰆧 ", + Property = "ξž› ", + Field = "ξœ– ", + Constructor = "ο₯ ", + Enum = "σ°•˜", + Interface = "σ°•˜", + Function = "σ°Š• ", + Variable = "󰆧 ", + Constant = "󰏿 ", + String = "󰀬 ", + Number = "󰎠 ", + Boolean = "β—© ", + Array = "σ°…ͺ ", + Object = "σ°…© ", + Key = "σ°Œ‹ ", + Null = "󰟒 ", + EnumMember = " ", + Struct = "σ°Œ— ", + Event = " ", + Operator = "󰆕 ", + TypeParameter = "σ°Š„ ", + }, + lsp = { + auto_attach = true, + preference = nil, + }, + highlight = true, + separator = " > ", + depth_limit = 0, + depth_limit_indicator = "..", + safe_output = true, + lazy_update_context = false, + click = false, + format_text = function(text) + return text + end, + }) + + local util = require("lspconfig/util") + + local enabled_servers = { "pyright", "ts_ls", "ansiblels", "rust_analyzer", "yamlls", "tailwindcss" } + + local settings = { + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "workspace", + useLibraryCodeForTypes = true, + }, + }, + }, + root_dir = function(fname) + local root_files = { + "pyproject.toml", + "setup.py", + "setup.cfg", + "requirements.txt", + "Pipfile", + "pyrightconfig.json", + } + return util.root_pattern(unpack(root_files))(fname) + or util.find_git_ancestor(fname) + or util.path.dirname(fname) + end, + }, + ts_ls = {}, + } + + -- nvim-cmp supports additional completion capabilities + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) + + local mason_lspconfig = require("mason-lspconfig") + mason_lspconfig.setup({ + ensure_installed = enabled_servers, + }) + + mason_lspconfig.setup_handlers({ + function(server_name) + require("lspconfig")[server_name].setup({ + capabilities = capabilities, + settings = (settings[server_name] or {}).settings, + filetypes = (settings[server_name] or {}).filetypes, + root_dir = (settings[server_name] or {}).root_dir, + on_attach = function(client, bufnr) + if client.server_capabilities.documentSymbolProvider then + require("nvim-navic").attach(client, bufnr) + end + end, + }) + end, + }) + + require("lsp-status").config({ + indicator_errors = "E:", + indicator_warnings = "W:", + indicator_info = "I:", + indicator_hint = "H:", + indicator_ok = "Ok", + current_function = false, + show_filename = false, + }) + end, +} diff --git a/configs/nvim/lua/plugins/nvim-notify.lua b/configs/nvim/lua/plugins/nvim-notify.lua new file mode 100644 index 0000000..c06c792 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-notify.lua @@ -0,0 +1,10 @@ +return { + 'rcarriga/nvim-notify', + event = "VimEnter", + opts = { + timeout = 3000, + }, + config = function () + require("notify").setup() + end +} diff --git a/configs/nvim/lua/plugins/obsidian.lua b/configs/nvim/lua/plugins/obsidian.lua new file mode 100644 index 0000000..0d78628 --- /dev/null +++ b/configs/nvim/lua/plugins/obsidian.lua @@ -0,0 +1,9 @@ +return { + dir = "~/.config/nvim/lua/lib/obsidian/", + ft = "markdown", + dev = true, + config = function() + local obsidian = require("lib.obsidian.obsidian") + obsidian.setup() + end, +} diff --git a/configs/nvim/lua/plugins/pretty-fold.lua b/configs/nvim/lua/plugins/pretty-fold.lua new file mode 100644 index 0000000..0959c6c --- /dev/null +++ b/configs/nvim/lua/plugins/pretty-fold.lua @@ -0,0 +1,8 @@ +return { + 'anuvyklack/pretty-fold.nvim', + config = function() + require('pretty-fold').setup({ + fill_char = 'Β·', + }) + end +} diff --git a/configs/nvim/lua/plugins/tailwind-lsp.lua b/configs/nvim/lua/plugins/tailwind-lsp.lua new file mode 100644 index 0000000..c575704 --- /dev/null +++ b/configs/nvim/lua/plugins/tailwind-lsp.lua @@ -0,0 +1,31 @@ +-- tailwind-tools.lua +return { + "luckasRanarison/tailwind-tools.nvim", + enabled = false, + name = "tailwind-tools", + build = ":UpdateRemotePlugins", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-telescope/telescope.nvim", -- optional + "neovim/nvim-lspconfig", -- optional + }, + opts = { + document_color = { + enabled = false, -- can be toggled by commands + kind = "inline", -- "inline" | "foreground" | "background" + inline_symbol = "󰝀 ", -- only used in inline mode + debounce = 200, -- in milliseconds, only applied in insert mode + }, + conceal = { + enabled = false, -- can be toggled by commands + min_length = nil, -- only conceal classes exceeding the provided length + symbol = "󱏿", -- only a single character is allowed + highlight = { -- extmark highlight options, see :h 'highlight' + fg = "#38BDF8", + }, + }, + }, -- your configuration + config = function(_, opts) + require("tailwind-tools").setup(opts) + end +} diff --git a/configs/nvim/lua/plugins/tmux-navigation.lua b/configs/nvim/lua/plugins/tmux-navigation.lua new file mode 100644 index 0000000..03179c8 --- /dev/null +++ b/configs/nvim/lua/plugins/tmux-navigation.lua @@ -0,0 +1,15 @@ +local keymap = vim.keymap + +return { + "alexghergh/nvim-tmux-navigation", + config = function() + require("nvim-tmux-navigation").setup({ + disable_when_zoomed = true, + }) + + keymap.set("n", "", ":NvimTmuxNavigateDown", { noremap = true }) + keymap.set("n", "", ":NvimTmuxNavigateUp", { noremap = true }) + keymap.set("n", "", ":NvimTmuxNavigateRight", { noremap = true }) + keymap.set("n", "", ":NvimTmuxNavigateLeft", { noremap = true }) + end, +} diff --git a/configs/nvim/lua/plugins/trash-polka.lua b/configs/nvim/lua/plugins/trash-polka.lua new file mode 100644 index 0000000..4d93575 --- /dev/null +++ b/configs/nvim/lua/plugins/trash-polka.lua @@ -0,0 +1,17 @@ +return { + dir = "~/Dev/@A/vim-trash-polka/", + name = "trash-polka", + lazy = false, + dev = true, + priority = 1000, + + keys = { + { "u", desc = "UI" }, + { "ul", ":colorscheme trash-polka-light", "Toggle light theme" }, + { "ud", ":colorscheme trash-polka", "Toggle dark theme" }, + }, + + config = function() + require("colorscheme") + end, +} diff --git a/configs/nvim/lua/plugins/treesitter.lua b/configs/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..5de7557 --- /dev/null +++ b/configs/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,25 @@ +return { + "nvim-treesitter/nvim-treesitter", + dependencies = { "nvim-treesitter/playground" }, + + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ignore_install = {}, + auto_install = false, + modules = {}, + ensure_installed = { + "html", + "javascript", + "markdown", + "markdown_inline", + "python", + }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, +} diff --git a/configs/nvim/lua/plugins/whichkey.lua b/configs/nvim/lua/plugins/whichkey.lua new file mode 100644 index 0000000..62cd250 --- /dev/null +++ b/configs/nvim/lua/plugins/whichkey.lua @@ -0,0 +1,45 @@ +return { + "folke/which-key.nvim", + event = "VimEnter", + + dependencies = { + "echasnovski/mini.icons", + }, + + opts = { + plugins = { spelling = true }, + defaults = {}, + spec = { + { + mode = { "n", "v" }, + { "", group = "tabs" }, + { "[", group = "prev" }, + { "]", group = "next" }, + { "g", group = "goto" }, + { "gs", group = "surround" }, + { "z", group = "fold" }, + { + "b", + group = "buffer", + expand = function() + return require("which-key.extras").expand.buf() + end, + }, + { + "w", + group = "windows", + proxy = "", + expand = function() + return require("which-key.extras").expand.win() + end, + }, + }, + }, + }, + + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.add(opts.spec) + end, +} diff --git a/configs/nvim/stylua.toml b/configs/nvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/configs/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file