From e6f78ecc3ad4a1e644623818ec4619a81b4c174f Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Mon, 25 Dec 2023 14:54:52 -0500 Subject: [PATCH 01/17] Add nvim config from scratch --- home/dot_config/nvim/LICENSE | 201 ------------- home/dot_config/nvim/README.md | 4 - home/dot_config/nvim/dot_gitignore | 8 - home/dot_config/nvim/dot_neoconf.json | 15 - home/dot_config/nvim/init.lua | 162 ++++++++++- home/dot_config/nvim/lazy-lock.json | 60 ++-- home/dot_config/nvim/lazyvim.json | 10 - home/dot_config/nvim/lua/config/autocmds.lua | 13 +- home/dot_config/nvim/lua/config/init.lua | 11 + home/dot_config/nvim/lua/config/keymaps.lua | 42 ++- home/dot_config/nvim/lua/config/lazy.lua | 149 +++++++--- home/dot_config/nvim/lua/config/options.lua | 45 ++- .../nvim/lua/config/plugins/bufferline.lua | 49 ++++ .../nvim/lua/config/plugins/catppuccin.lua | 12 + .../nvim/lua/config/plugins/conform.lua | 23 ++ .../nvim/lua/config/plugins/flash.lua | 19 ++ .../nvim/lua/config/plugins/gitsigns.lua | 92 ++++++ .../lua/config/plugins/indent-blankline.lua | 30 ++ .../nvim/lua/config/plugins/lualine.lua | 21 ++ .../nvim/lua/config/plugins/mini.lua | 65 +++++ .../nvim/lua/config/plugins/neo-tree.lua | 77 +++++ .../nvim/lua/config/plugins/notify.lua | 19 ++ .../nvim/lua/config/plugins/persistence.lua | 34 +++ .../nvim/lua/config/plugins/telescope.lua | 109 +++++++ .../config/plugins/torefactor/dashboard.lua | 59 ++++ .../config/plugins/torefactor/treesitter.lua | 78 ++++++ .../lua/config/plugins/vim-tmux-navigator.lua | 12 + .../nvim/lua/config/plugins/which-key.lua | 35 +++ .../nvim/lua/config/plugins/winshift.lua | 60 ++++ home/dot_config/nvim/lua/plugins/_example.lua | 265 ------------------ .../nvim/lua/plugins/completion.lua | 53 ---- home/dot_config/nvim/lua/plugins/edgy.lua | 132 --------- .../dot_config/nvim/lua/plugins/languages.lua | 7 - .../dot_config/nvim/lua/plugins/telescope.lua | 37 --- home/dot_config/nvim/lua/plugins/test.lua | 3 - home/dot_config/nvim/lua/plugins/theme.lua | 10 - .../nvim/lua/plugins/treesitter.lua | 111 -------- home/dot_config/nvim/lua/plugins/ui.lua | 132 --------- home/dot_config/nvim/stylua.toml | 5 +- 39 files changed, 1189 insertions(+), 1080 deletions(-) delete mode 100644 home/dot_config/nvim/LICENSE delete mode 100644 home/dot_config/nvim/README.md delete mode 100644 home/dot_config/nvim/dot_gitignore delete mode 100644 home/dot_config/nvim/dot_neoconf.json delete mode 100644 home/dot_config/nvim/lazyvim.json create mode 100644 home/dot_config/nvim/lua/config/init.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/bufferline.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/catppuccin.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/conform.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/flash.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/gitsigns.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/indent-blankline.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/lualine.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/mini.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/neo-tree.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/notify.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/persistence.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/telescope.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/torefactor/treesitter.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/vim-tmux-navigator.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/which-key.lua create mode 100644 home/dot_config/nvim/lua/config/plugins/winshift.lua delete mode 100644 home/dot_config/nvim/lua/plugins/_example.lua delete mode 100644 home/dot_config/nvim/lua/plugins/completion.lua delete mode 100644 home/dot_config/nvim/lua/plugins/edgy.lua delete mode 100644 home/dot_config/nvim/lua/plugins/languages.lua delete mode 100644 home/dot_config/nvim/lua/plugins/telescope.lua delete mode 100644 home/dot_config/nvim/lua/plugins/test.lua delete mode 100644 home/dot_config/nvim/lua/plugins/theme.lua delete mode 100644 home/dot_config/nvim/lua/plugins/treesitter.lua delete mode 100644 home/dot_config/nvim/lua/plugins/ui.lua diff --git a/home/dot_config/nvim/LICENSE b/home/dot_config/nvim/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/home/dot_config/nvim/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/home/dot_config/nvim/README.md b/home/dot_config/nvim/README.md deleted file mode 100644 index 185280b..0000000 --- a/home/dot_config/nvim/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# πŸ’€ 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/home/dot_config/nvim/dot_gitignore b/home/dot_config/nvim/dot_gitignore deleted file mode 100644 index cc5457a..0000000 --- a/home/dot_config/nvim/dot_gitignore +++ /dev/null @@ -1,8 +0,0 @@ -tt.* -.tests -doc/tags -debug -.repro -foo.* -*.log -data diff --git a/home/dot_config/nvim/dot_neoconf.json b/home/dot_config/nvim/dot_neoconf.json deleted file mode 100644 index 7c48087..0000000 --- a/home/dot_config/nvim/dot_neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/home/dot_config/nvim/init.lua b/home/dot_config/nvim/init.lua index 2514f9e..cf6445e 100644 --- a/home/dot_config/nvim/init.lua +++ b/home/dot_config/nvim/init.lua @@ -1,2 +1,160 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") + + +require('config') + +-- [[ Configure LSP ]] +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, { desc = 'Format current buffer with LSP' }) +end + + +-- mason-lspconfig requires that these setup functions are called in this order +-- before setting up the servers. +require('mason').setup() +require('mason-lspconfig').setup() + +-- Enable the following language servers +-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. +-- +-- Add any additional override configuration in the following tables. They will be passed to +-- the `settings` field of the server config. You must look up that documentation yourself. +-- +-- If you want to override the default filetypes that your language server will attach to you can +-- define the property 'filetypes' to the map in question. +local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- tsserver = {}, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, +} + +-- Setup neovim lua configuration +require('neodev').setup() + +-- nvim-cmp supports additional completion capabilities, so broadcast that to servers +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + +-- Ensure the servers above are installed +local mason_lspconfig = require('mason-lspconfig') + +mason_lspconfig.setup({ + ensure_installed = vim.tbl_keys(servers), +}) + +mason_lspconfig.setup_handlers({ + function(server_name) + require('lspconfig')[server_name].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + filetypes = (servers[server_name] or {}).filetypes, + }) + end, +}) + +-- [[ Configure nvim-cmp ]] +-- See `:help cmp` +local cmp = require('cmp') +local luasnip = require('luasnip') +require('luasnip.loaders.from_vscode').lazy_load() +luasnip.config.setup({}) + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { + completeopt = 'menu,menuone,noinsert', + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete({}), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, +}) + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/home/dot_config/nvim/lazy-lock.json b/home/dot_config/nvim/lazy-lock.json index cc13c3d..c75f634 100644 --- a/home/dot_config/nvim/lazy-lock.json +++ b/home/dot_config/nvim/lazy-lock.json @@ -1,66 +1,42 @@ { - "LazyVim": { "branch": "main", "commit": "879e29504d43e9f178d967ecc34d482f902e5a91" }, + "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "LuaSnip": { "branch": "master", "commit": "57c9f5c31b3d712376c704673eac8e948c82e9c1" }, - "SchemaStore.nvim": { "branch": "main", "commit": "c23407de1f76df30ca197b69d78a11be5ce26009" }, "bufferline.nvim": { "branch": "main", "commit": "e48ce1805697e4bb97bc171c081e849a65859244" }, - "catppuccin": { "branch": "main", "commit": "079500a625f3ae5aa6efb758f1a17fe4c7a57e52" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, + "catppuccin": { "branch": "main", "commit": "4fbab1f01488718c3d54034a473d0346346b90e3" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conform.nvim": { "branch": "master", "commit": "8b407bb6175846cdc4c499e2a8d28109615a2089" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, - "dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" }, - "edgy.nvim": { "branch": "main", "commit": "8355be45610afdf79a0bab32b91ee297997455b4" }, + "fidget.nvim": { "branch": "main", "commit": "1ba4ed7e4ee114df803ccda7ffedaf7ad2c26239" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, - "headlines.nvim": { "branch": "master", "commit": "e3d7bfdf40e41a020d966d35f8b48d75b90367d2" }, - "indent-blankline.nvim": { "branch": "master", "commit": "d4c718467d35bc93714425a7102d82e7e5065280" }, + "image.nvim": { "branch": "master", "commit": "41f0f2643a09631bc0d8e2837b514667d423e440" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3084950d1b66426d207064a509477cbfa96362c6" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, - "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, - "mini.ai": { "branch": "main", "commit": "f7787cff9cc42004f722ca1e64e6af4e64e34177" }, "mini.animate": { "branch": "main", "commit": "6cec625114007527ff8a82316dba858046f9746f" }, "mini.bufremove": { "branch": "main", "commit": "020243bfed8c8b941f2c20626faf3ea39c0c0e1b" }, - "mini.comment": { "branch": "main", "commit": "67f00d3ebbeae15e84584d971d0c32aad4f4f3a4" }, - "mini.indentscope": { "branch": "main", "commit": "5a8369475cd7cd6f207a4d288406d03b0fc48bdb" }, - "mini.pairs": { "branch": "main", "commit": "552062017ff207e1f35f7028bfb3f27c7421d22d" }, - "mini.surround": { "branch": "main", "commit": "7bf8915ba15d7a4f3c2afe7868d3c15a858d73f1" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" }, - "neoconf.nvim": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" }, - "neodev.nvim": { "branch": "main", "commit": "be6bf4f5d2d3b173c9291f074130a3d29e1af78a" }, - "neotest": { "branch": "master", "commit": "b8e29c0fba9a58bf6a5c37df77c7a6a31079c8d6" }, - "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, + "mini.nvim": { "branch": "main", "commit": "ea1af8c7d5e72148cae8a04e9887322a53fe66cf" }, + "neo-tree.nvim": { "branch": "main", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" }, + "neodev.nvim": { "branch": "main", "commit": "0afdcb703f265c3079a47857bda01e3ccf884558" }, "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, - "nvim-lint": { "branch": "master", "commit": "32f98300881f38f4e022391f240188fec42f74db" }, - "nvim-lspconfig": { "branch": "master", "commit": "eb81c7ea08d6f01d5fa4cf09e58c708efadf9b2f" }, - "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, - "nvim-spectre": { "branch": "master", "commit": "a18a58015b46f02b4fe537ebfffd82e46110ff24" }, - "nvim-treesitter": { "branch": "master", "commit": "24be1534dbd062907842601ae1e2e953ba02472e" }, - "nvim-treesitter-context": { "branch": "master", "commit": "c9f2b429a1d63023f7a33b5404616f4cd2a109c5" }, + "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, + "nvim-notify": { "branch": "master", "commit": "27a6649ba6b22828ccc67c913f95a5407a2d8bec" }, + "nvim-treesitter": { "branch": "master", "commit": "454c3a9ba86f841dc3b5bb17d150a873a16b77b4" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" }, - "nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, - "nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" }, - "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" }, + "nvim-web-devicons": { "branch": "master", "commit": "aff5f50b34754335a312c9b3dc5b245f605ce437" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, - "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, - "scope.nvim": { "branch": "main", "commit": "cd27af77ad61a7199af5c28d27013fb956eb0e3e" }, - "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "master", "commit": "6213322ab56eb27356fdc09a5078e41e3ea7f3bc" }, - "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, - "toggleterm.nvim": { "branch": "main", "commit": "cbd041d91b90cd3c02df03fe6133208888f8e008" }, - "tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" }, - "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, - "vim-startuptime": { "branch": "master", "commit": "454b3de856b7bd298700de33d79774ca9b9e3875" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "f336f8cfab38a82f9f00df380d28f0c2a572f862" }, + "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, + "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, + "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, + "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, - "window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" }, "winshift.nvim": { "branch": "main", "commit": "37468ed6f385dfb50402368669766504c0e15583" } } \ No newline at end of file diff --git a/home/dot_config/nvim/lazyvim.json b/home/dot_config/nvim/lazyvim.json deleted file mode 100644 index 3a50065..0000000 --- a/home/dot_config/nvim/lazyvim.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extras": [ - "lazyvim.plugins.extras.util.project", - "lazyvim.plugins.extras.vscode" - ], - "news": { - "NEWS.md": "2123" - }, - "version": 2 -} \ No newline at end of file diff --git a/home/dot_config/nvim/lua/config/autocmds.lua b/home/dot_config/nvim/lua/config/autocmds.lua index 27e9e06..58c0d38 100644 --- a/home/dot_config/nvim/lua/config/autocmds.lua +++ b/home/dot_config/nvim/lua/config/autocmds.lua @@ -1,3 +1,10 @@ --- 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 +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +}) diff --git a/home/dot_config/nvim/lua/config/init.lua b/home/dot_config/nvim/lua/config/init.lua new file mode 100644 index 0000000..a8f37f2 --- /dev/null +++ b/home/dot_config/nvim/lua/config/init.lua @@ -0,0 +1,11 @@ +-- Set as the leader key +-- See `:help mapleader` +-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +require('config.lazy') +require('config.options') +require('config.keymaps') +require('config.autocmds') + diff --git a/home/dot_config/nvim/lua/config/keymaps.lua b/home/dot_config/nvim/lua/config/keymaps.lua index 7a6d7f1..8006e53 100644 --- a/home/dot_config/nvim/lua/config/keymaps.lua +++ b/home/dot_config/nvim/lua/config/keymaps.lua @@ -1,6 +1,38 @@ --- 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 -vim.keymap.set("n", "tt", "terminali", { desc = "Open terminal in current window" }) -vim.keymap.set("n", "bn", "enew", { desc = "New empty buffer" }) +local set = vim.keymap.set +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help set()` +set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +-- Quit +set('n', 'qq', 'qa', { desc = 'Quit all' }) + +-- [[ Window/Tab Navigation Keymaps ]] + +-- Move between windows using keys +-- Note: this is now handled by vim-tmux-navigator +-- set('n', '', 'h', { desc = 'Go to left window', remap = true }) +-- set('n', '', 'j', { desc = 'Go to lower window', remap = true }) +-- set('n', '', 'k', { desc = 'Go to upper window', remap = true }) +-- set('n', '', 'l', { desc = 'Go to right window', remap = true }) + +-- Window Management +set('n', 'ww', 'p', { desc = 'Other window', remap = true }) +set('n', 'wd', 'c', { desc = 'Delete window', remap = true }) +set('n', 'w-', 's', { desc = 'Split window below', remap = true }) +set('n', 'w|', 'v', { desc = 'Split window right', remap = true }) +set('n', '-', 's', { desc = 'Split window below', remap = true }) +set('n', '|', 'v', { desc = 'Split window right', remap = true }) + +-- Diagnostic keymaps +set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +-- set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +-- set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + diff --git a/home/dot_config/nvim/lua/config/lazy.lua b/home/dot_config/nvim/lua/config/lazy.lua index 2ee9ee7..26b66f1 100644 --- a/home/dot_config/nvim/lua/config/lazy.lua +++ b/home/dot_config/nvim/lua/config/lazy.lua @@ -1,43 +1,120 @@ -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +-- [[ Install `lazy.nvim` plugin manager ]] +-- https://github.com/folke/lazy.nvim +-- `:help lazy.nvim.txt` for more info +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' if not vim.loop.fs_stat(lazypath) then - -- bootstrap lazy.nvim - -- stylua: ignore - vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) + vim.fn.system({ + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + }) end -vim.opt.rtp:prepend(vim.env.LAZY or lazypath) - -require("lazy").setup({ - spec = { - -- add LazyVim and import its plugins - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - -- import any extras modules here - -- import/override with your plugins - { import = "plugins" }, +vim.opt.rtp:prepend(lazypath) + +-- [[ Configure plugins ]] +-- NOTE: Here is where you install your plugins. +-- You can configure plugins using the `config` key. +-- +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require('lazy').setup({ + { import = 'config.plugins' }, + -- configs that are in progress and need to be cleaned up + { import = 'config.plugins.torefactor' }, + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { + -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + 'folke/neodev.nvim', + }, }, - defaults = { - -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. - -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, - -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, - -- have outdated releases, which may break your Neovim install. - version = false, -- always use the latest git commit - -- version = "*", -- try installing the latest stable version for plugins that support semver + + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + }, + + + { + -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help ibl` + main = 'ibl', + opts = {}, }, - install = { colorscheme = { "tokyonight", "habamax" } }, - checker = { enabled = true }, -- automatically check for plugin updates - performance = { - rtp = { - -- disable some rtp plugins - disabled_plugins = { - "gzip", - -- "matchit", - -- "matchparen", - -- "netrwPlugin", - "tarPlugin", - "tohtml", - "tutor", - "zipPlugin", + + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + + -- Fuzzy Finder (files, lsp, etc) + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable('make') == 1 + end, }, }, }, -}) + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + -- These are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them. + -- require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.debug', + + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping + -- up-to-date with whatever is in the kickstart repo. + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- { import = 'custom.plugins' }, +}, {}) diff --git a/home/dot_config/nvim/lua/config/options.lua b/home/dot_config/nvim/lua/config/options.lua index 3ea1454..60f9aaa 100644 --- a/home/dot_config/nvim/lua/config/options.lua +++ b/home/dot_config/nvim/lua/config/options.lua @@ -1,3 +1,42 @@ --- Options are automatically loaded before lazy.nvim startup --- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua --- Add any additional options here +-- [[ Setting options ]] +-- See `:help vim.o` +-- NOTE: You can change these options as you wish! + +-- Set highlight on search +vim.o.hlsearch = false + +-- Make line numbers default +vim.wo.number = true +-- Relative line numbers +vim.wo.relativenumber = true + +-- Enable mouse mode +vim.o.mouse = 'a' + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.o.clipboard = 'unnamedplus' + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = 'yes' + +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +vim.o.completeopt = 'menuone,noselect' + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true diff --git a/home/dot_config/nvim/lua/config/plugins/bufferline.lua b/home/dot_config/nvim/lua/config/plugins/bufferline.lua new file mode 100644 index 0000000..9eb53fa --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/bufferline.lua @@ -0,0 +1,49 @@ +---@type LazySpec +return { + { + 'akinsho/bufferline.nvim', + event = 'VeryLazy', + keys = { + { 'bp', 'BufferLineTogglePin', desc = 'Toggle pin' }, + { 'bP', 'BufferLineGroupClose ungrouped', desc = 'Delete non-pinned buffers' }, + { 'bo', 'BufferLineCloseOthers', desc = 'Delete other buffers' }, + { 'br', 'BufferLineCloseRight', desc = 'Delete buffers to the right' }, + { 'bl', 'BufferLineCloseLeft', desc = 'Delete buffers to the left' }, + { '', 'BufferLineCyclePrev', desc = 'Prev buffer' }, + { '', 'BufferLineCycleNext', desc = 'Next buffer' }, + { '[b', 'BufferLineCyclePrev', desc = 'Prev buffer' }, + { ']b', 'BufferLineCycleNext', desc = 'Next buffer' }, + }, + opts = { + ---@type bufferline.Options + options = { + close_command = function(n) + require('mini.bufremove').delete(n, false) + end, + offsets = { + { + filetype = 'neo-tree', + text = 'Neo-tree', + highlight = 'directory', + text_align = 'left', + }, + }, + }, + }, + config = function(_, opts) + require('bufferline').setup(opts) + -- Fix bufferline when restoring a session + vim.api.nvim_create_autocmd('BufAdd', { + callback = function() + vim.schedule(function() + pcall(nvim_bufferline) + end) + end, + }) + end, + dependencies = { + 'echasnovski/mini.nvim', + 'nvim-tree/nvim-web-devicons', + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/catppuccin.lua b/home/dot_config/nvim/lua/config/plugins/catppuccin.lua new file mode 100644 index 0000000..90a4ded --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/catppuccin.lua @@ -0,0 +1,12 @@ +---@type LazySpec +return { + -- Only the best color scheme ever + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + vim.cmd.colorscheme('catppuccin') + end, + } +} diff --git a/home/dot_config/nvim/lua/config/plugins/conform.lua b/home/dot_config/nvim/lua/config/plugins/conform.lua new file mode 100644 index 0000000..36d4ff9 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/conform.lua @@ -0,0 +1,23 @@ +---@type LazyConfig +return { + { + 'stevearc/conform.nvim', + event = 'BufWritePre', + cmd = { 'ConformInfo' }, + keys = { + { + 'cf', + function() + require('conform').format({ async = true, lsp_fallback = true }) + end, + mode = '', + desc = 'Format buffer', + }, + }, + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/flash.lua b/home/dot_config/nvim/lua/config/plugins/flash.lua new file mode 100644 index 0000000..bd1c958 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/flash.lua @@ -0,0 +1,19 @@ +---@type LazySpec +return { + { + 'folke/flash.nvim', + event = 'VeryLazy', + ---@type Flash.Config + opts = {}, + keys = function() + local flash = require('flash') + return { + { 's', mode = { 'n', 'x', 'o' }, flash.jump, desc = 'Flash' }, + { 'S', mode = { 'n', 'x', 'o' }, flash.treesitter, desc = 'Flash Treesitter' }, + { 'r', mode = 'o', flash.remote, desc = 'Remote Flash' }, + { 'R', mode = { 'x', 'o' }, flash.treesitter_search, desc = 'Treesitter Search' }, + { '', mode = { 'c' }, flash.toggle, desc = 'Toggle Flash Search' }, + } + end, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/gitsigns.lua b/home/dot_config/nvim/lua/config/plugins/gitsigns.lua new file mode 100644 index 0000000..e3295cf --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/gitsigns.lua @@ -0,0 +1,92 @@ +---@type LazySpec +return { + { + -- Adds git related signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = 'β€Ύ' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + -- local gs = package.loaded.gitsigns + local gs = require('gitsigns') + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map({ 'n', 'v' }, ']c', function() + if vim.wo.diff then + return ']c' + end + vim.schedule(function() + gs.next_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to next hunk' }) + + map({ 'n', 'v' }, '[c', function() + if vim.wo.diff then + return '[c' + end + vim.schedule(function() + gs.prev_hunk() + end) + return '' + end, { expr = true, desc = 'Jump to previous hunk' }) + + -- Actions + -- visual mode + map('v', 'ghs', function() + gs.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, { desc = 'stage git hunk' }) + map('v', 'ghr', function() + gs.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'ghs', gs.stage_hunk, { desc = 'git stage hunk' }) + map('n', 'ghr', gs.reset_hunk, { desc = 'git reset hunk' }) + map('n', 'ghS', gs.stage_buffer, { desc = 'git Stage buffer' }) + map('n', 'ghu', gs.undo_stage_hunk, { desc = 'undo stage hunk' }) + map('n', 'ghR', gs.reset_buffer, { desc = 'git Reset buffer' }) + map('n', 'ghp', gs.preview_hunk, { desc = 'preview git hunk' }) + map('n', 'ghb', function() + gs.blame_line({ full = false }) + end, { desc = 'git blame line' }) + map('n', 'ghd', gs.diffthis, { desc = 'git diff against index' }) + map('n', 'ghD', function() + gs.diffthis('~') + end, { desc = 'git diff against last commit' }) + + -- Toggles + map('n', 'tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' }) + map('n', 'td', gs.toggle_deleted, { desc = 'toggle git show deleted' }) + + -- Text object + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = 'select git hunk' }) + end, + }, + }, + { + 'folke/which-key.nvim', + opts = { + defaults = { + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['gh'] = { name = 'Git [H]unk', _ = 'which_key_ignore' }, + }, + defaults_visual = { + -- register which-key VISUAL mode + ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, + ['gh'] = { 'Git [H]unk' }, + } + } + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua b/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua new file mode 100644 index 0000000..cb3948a --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua @@ -0,0 +1,30 @@ +return { + -- indent guides for Neovim + { + 'lukas-reineke/indent-blankline.nvim', + event = 'VeryLazy', + opts = { + indent = { + char = 'β”‚', + tab_char = 'β”‚', + }, + scope = { enabled = false }, + exclude = { + filetypes = { + 'help', + 'alpha', + 'dashboard', + 'neo-tree', + 'Trouble', + 'trouble', + 'lazy', + 'mason', + 'notify', + 'toggleterm', + 'lazyterm', + }, + }, + }, + main = 'ibl', + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/lualine.lua b/home/dot_config/nvim/lua/config/plugins/lualine.lua new file mode 100644 index 0000000..3379941 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/lualine.lua @@ -0,0 +1,21 @@ +---@type LazySpec +return { + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = '|', + section_separators = '', + disabled_filetypes = { + statusline = { 'dashboard' } + }, + }, + -- sections = {}, + extensions = { 'neo-tree', 'lazy' }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/mini.lua b/home/dot_config/nvim/lua/config/plugins/mini.lua new file mode 100644 index 0000000..69e8020 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/mini.lua @@ -0,0 +1,65 @@ +---@type LazySpec +return { + { + 'echanovski/mini.animate', + event = 'VeryLazy', + opts = function() + -- disable animation when scrolling with the mouse + local mouse_scrolled = false + vim.keymap.set({ '', 'i' }, '', function() + mouse_scrolled = true + return '' + end, { expr = true }) + vim.keymap.set({ '', 'i' }, '', function() + mouse_scrolled = true + return '' + end, { expr = true }) + + local animate = require('mini.animate') + return { + resize = { + timing = animate.gen_timing.linear({ duration = 100, unit = 'total' }), + }, + scroll = { + timing = animate.gen_timing.linear({ duration = 150, unit = 'total' }), + subscroll = animate.gen_subscroll.equal({ + predicate = function(total) + if mouse_scrolled then + mouse_scrolled = false + return false + end + return total > 1 + end, + }), + }, + } + end, + }, + { + 'echasnovski/mini.bufremove', + keys = { + { + 'bd', + function() + local bd = require('mini.bufremove').delete + -- Confirm pending changes + if vim.bo.modified then + local choice = vim.fn.confirm(('Save changes to %q'):format(vim.fn.bufname()), '&Yes\n&No\n&Cancel') + if choice == 1 then -- Yes + vim.cmd.write() + bd(0) + elseif choice == 2 then -- No + bd(0, true) + end + else + bd(0) + end + end, + desc = 'Delete buffer', + }, + { + 'bD', function() require('mini.bufremove').delete(0, true) end, desc = 'Delete Buffer (Forced)', + }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/neo-tree.lua b/home/dot_config/nvim/lua/config/plugins/neo-tree.lua new file mode 100644 index 0000000..e289d88 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/neo-tree.lua @@ -0,0 +1,77 @@ +---@type LazySpec +return { + { + 'nvim-neo-tree/neo-tree.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + '3rd/image.nvim', + }, + keys = { + { 'e', 'Neotree toggle', desc = 'Toggle Neotree' }, + }, + init = function() + -- Disable builtin netrw plugin in favor of Neotree + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + if vim.fn.argc(-1) == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == 'directory' then + require('neo-tree') + end + end + end, + deactivate = function() + vim.cmd([[Neotree close]]) + end, + opts = { + sources = { + 'filesystem', + 'buffers', + 'git_status', + 'document_symbols', + }, + open_files_do_not_replace_types = { + 'terminal', + 'trouble', + 'Trouble', + 'qf', + 'Outline', + }, + filesystem = { + -- disable 2-way binding between cwd and neo-tree's root + bind_to_cwd = false, + -- find and focus the file in the active buffer + follow_current_file = { enabled = true }, + -- More performant file change detection + use_libuv_file_watcher = true, + }, + window = { + mappings = { + -- disable space key, since that is our leader key + [''] = 'none', + }, + }, + default_component_configs = { + indent = { + -- if nil and file nesting is enabled, will enable expanders + with_expanders = true, + expander_collapsed = 'ο‘ ', + expander_expanded = 'ο‘Ό', + expander_highlight = 'NeoTreeExpander', + }, + }, + }, + config = function (self, opts) + require('neo-tree').setup(opts) + + vim.api.nvim_create_autocmd('VimLeavePre', { + callback = function () + self:deactivate() + end + }) + end + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/notify.lua b/home/dot_config/nvim/lua/config/plugins/notify.lua new file mode 100644 index 0000000..935f65e --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/notify.lua @@ -0,0 +1,19 @@ +---@type LazySpec +return { + { + 'rcarriga/nvim-notify', + ---@type notify.Config + opts = { + minimum_width = 50, + stages = 'fade', + timeout = 2000, + fps = 60, + }, + config = function(_, opts) + local notify = require('notify') + vim.notify = notify + + notify.setup(opts) + end, + } +} diff --git a/home/dot_config/nvim/lua/config/plugins/persistence.lua b/home/dot_config/nvim/lua/config/plugins/persistence.lua new file mode 100644 index 0000000..37e0d4f --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/persistence.lua @@ -0,0 +1,34 @@ +---@type LazySpec +return { + { + 'folke/persistence.nvim', + event = 'BufReadPre', + init = function () + vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } + end, + opts = { options = vim.opt.sessionoptions:get() }, + keys = { + { + 'qs', + function() + require('persistence').load() + end, + desc = 'Restore Session', + }, + { + 'ql', + function() + require('persistence').load({ last = true }) + end, + desc = 'Restore Last Session', + }, + { + 'qd', + function() + require('persistence').stop() + end, + desc = "Don't Save Current Session", + }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/telescope.lua b/home/dot_config/nvim/lua/config/plugins/telescope.lua new file mode 100644 index 0000000..87ca4b7 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/telescope.lua @@ -0,0 +1,109 @@ +-- Function to find the git root directory based on the current buffer's path +local function find_git_root() + -- Use the current buffer's path as the starting point for the git search + local current_file = vim.api.nvim_buf_get_name(0) + local current_dir + local cwd = vim.fn.getcwd() + -- If the buffer is not associated with a file, return nil + if current_file == '' then + current_dir = cwd + else + -- Extract the directory from the current file's path + current_dir = vim.fn.fnamemodify(current_file, ':h') + end + + -- Find the Git root directory from the current file's path + local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1] + if vim.v.shell_error ~= 0 then + print('Not a git repository. Searching on current working directory') + return cwd + end + return git_root +end + +-- Custom live_grep function to search in git root +local function live_grep_git_root() + local git_root = find_git_root() + if git_root then + require('telescope.builtin').live_grep({ + search_dirs = { git_root }, + }) + end +end + +return { + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable('make') == 1 + end, + }, + }, + opts = { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + layout_strategy = 'horizontal', + layout_config = { prompt_position = 'top' }, + sorting_strategy = 'ascending', + winblend = 0, + }, + }, + keys = function() + -- See `:help telescope.builtin` + local builtin = require('telescope.builtin') + + local function telescope_live_grep_open_files() + require('telescope.builtin').live_grep({ + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + }) + end + + return { + { '?', builtin.oldfiles, desc = '[?] Find recently opened files' }, + { '', builtin.buffers, desc = '[ ] Find existing buffers' }, + { '/', builtin.current_buffer_fuzzy_find, desc = '[/] Fuzzily search in current buffer' }, + { 's/', telescope_live_grep_open_files, desc = '[S]earch [/] in Open Files' }, + { 'ss', builtin.builtin, desc = '[S]earch [S]elect Telescope' }, + { 'gf', builtin.git_files, desc = '[S]earch [G]it [F]iles' }, + { 'sf', builtin.find_files, desc = '[S]earch [F]iles' }, + + { 'gf', builtin.git_files, desc = 'Search [G]it [F]iles' }, + { 'sf', builtin.find_files, desc = '[S]earch [F]iles' }, + { 'sh', builtin.help_tags, desc = '[S]earch [H]elp' }, + { 'sw', builtin.grep_string, desc = '[S]earch current [W]ord' }, + { 'sg', builtin.live_grep, desc = '[S]earch by [G]rep' }, + { 'sG', ':LiveGrepGitRoot', desc = '[S]earch by [G]rep on Git Root' }, + { 'sd', builtin.diagnostics, desc = '[S]earch [D]iagnostics' }, + { 'sr', builtin.resume, desc = '[S]earch [R]esume' }, + } + end, + config = function(_, opts) + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup(opts) + + -- Enable telescope fzf native, if installed + pcall(require('telescope').load_extension, 'fzf') + + -- Telescope live_grep in git root + vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) + end, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua b/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua new file mode 100644 index 0000000..50cb2f0 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua @@ -0,0 +1,59 @@ +---@type LazySpec +return { + { + 'nvimdev/dashboard-nvim', + event = 'VimEnter', + opts = function() + local logo = { + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[ ξ‚Ίξ‚Έ ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ξ‚Ύβ–ˆβ–ˆξ‚Ό ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ξ‚Έ ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Όξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆξ‚Έ ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Έβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ]], + [[ ξ‚Ίβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Όξ‚Ίβ–ˆβ–ˆξ‚Ό ξ‚Ύβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Όξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Έ ξ‚Ίβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ]], + [[ ξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ύβ–ˆβ–ˆβ–ˆξ‚Όξ‚Ίβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό ξ‚Ύβ–ˆβ–ˆβ–ˆβ–ˆξ‚Ό β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆξ‚Έ ]], + [[ ]], + [[ ]], + [[ ]], + } + + local opts = { + theme = 'doom', + -- let lualine hide itself on the dashboard + hide = { statusline = false }, + config = { + header = logo, + center = { + { action = 'Telescope find_files', desc = ' Find file', icon = ' ', key = 'f' }, + { action = 'ene | startinsert', desc = ' New file', icon = 'ο…› ', key = 'n' }, + { action = 'Telescope oldfiles', desc = ' Recent files', icon = 'οƒ… ', key = 'r' }, + { action = 'Telescope live_grep', desc = ' Find text', icon = 'ο€’ ', key = 'g' }, + { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = ' Config', icon = ' ', key = 'c' }, + { action = 'lua require("persistence").load()', desc = ' Restore Session', icon = ' ', key = 's' }, + { action = 'LazyExtras', desc = ' Lazy Extras', icon = 'ξͺŒ ', key = 'x' }, + { action = 'Lazy', desc = ' Lazy', icon = 'σ°’² ', key = 'l' }, + { action = 'qa', desc = ' Quit', icon = ' ', key = 'q' }, + }, + footer = function() + local stats = require('lazy').stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + return { + '⚑ Neovim loaded ' .. stats.loaded .. '/' .. stats.count .. ' plugins in ' .. ms .. 'ms', + 'IMPORTANT NOTE: This page is under construction. These keys don\'t work (yet)!', + } + end, + }, + } + + return opts + end, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/torefactor/treesitter.lua b/home/dot_config/nvim/lua/config/plugins/torefactor/treesitter.lua new file mode 100644 index 0000000..e7fc829 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/torefactor/treesitter.lua @@ -0,0 +1,78 @@ +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +return { + -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ':TSUpdate', + init = function() + -- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' + vim.defer_fn(function() + require('nvim-treesitter.configs').setup({ + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, + }) + end, 0) + end, +} diff --git a/home/dot_config/nvim/lua/config/plugins/vim-tmux-navigator.lua b/home/dot_config/nvim/lua/config/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..69e4829 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/vim-tmux-navigator.lua @@ -0,0 +1,12 @@ +---@type LazySpec +return { + { + 'christoomey/vim-tmux-navigator', + keys = { + { '', 'TmuxNavigateLeft', desc = 'Go to left window' }, + { '', 'TmuxNavigateDown', desc = 'Go to lower window' }, + { '', 'TmuxNavigateUp', desc = 'Go to upper window' }, + { '', 'TmuxNavigateRight', desc = 'Go to right window' }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/which-key.lua b/home/dot_config/nvim/lua/config/plugins/which-key.lua new file mode 100644 index 0000000..0f6e3fb --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/which-key.lua @@ -0,0 +1,35 @@ +---@type LazySpec +return { + -- Useful plugin to show you pending keybinds. + { + 'folke/which-key.nvim', + init = function () + -- customize the timeout before the which-key popup appears + vim.o.timeout = true + vim.o.timeoutlen = 500 + end, + opts = { + defaults = { + -- document existing key chains + ['b'] = { name = '[B]uffer', _ = 'which_key_ignore' }, + ['c'] = { name = '[C]ode', _ = 'which_key_ignore' }, + ['d'] = { name = '[D]ocument', _ = 'which_key_ignore' }, + ['q'] = { name = '[Q]uit/session', _ = 'which_key_ignore' }, + ['r'] = { name = '[R]ename', _ = 'which_key_ignore' }, + ['s'] = { name = '[S]earch', _ = 'which_key_ignore' }, + ['t'] = { name = '[T]oggle', _ = 'which_key_ignore' }, + ['w'] = { name = '[W]orkspace', _ = 'which_key_ignore' }, + }, + defaults_visual = { + -- required for visual hs (hunk stage) to work + [''] = { name = 'VISUAL ' }, + }, + }, + config = function(_, opts) + require('which-key').setup(opts) + + require('which-key').register(opts.defaults) + require('which-key').register(opts.defaults_visual, { mode = 'v' }) + end, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/winshift.lua b/home/dot_config/nvim/lua/config/plugins/winshift.lua new file mode 100644 index 0000000..131d031 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/winshift.lua @@ -0,0 +1,60 @@ +---@type LazySpec +return { + { + 'sindrets/winshift.nvim', + event = 'VeryLazy', + config = true, + keys = { + { + 'wsh', + 'WinShift left', + desc = 'Shift window left', + }, + { + 'wsj', + 'WinShift down', + desc = 'Shift window down', + }, + { + 'wsk', + 'WinShift up', + desc = 'Shift window up', + }, + { + 'wsl', + 'WinShift right', + desc = 'Shift window right', + }, + { + 'wsH', + 'WinShift far_left', + desc = 'Shift window far left', + }, + { + 'wsJ', + 'WinShift far_down', + desc = 'Shift window far down', + }, + { + 'wsK', + 'WinShift far_up', + desc = 'Shift window far up', + }, + { + 'wsL', + 'WinShift far_right', + desc = 'Shift window far right', + }, + }, + }, + -- add description for whichkey + { + 'folke/which-key.nvim', + optional = true, + opts = { + defaults = { + ['ws'] = { name = '+shift' }, + }, + }, + }, +} diff --git a/home/dot_config/nvim/lua/plugins/_example.lua b/home/dot_config/nvim/lua/plugins/_example.lua deleted file mode 100644 index f84ebdc..0000000 --- a/home/dot_config/nvim/lua/plugins/_example.lua +++ /dev/null @@ -1,265 +0,0 @@ --- since this is just an example spec, don't actually load anything here and return an empty spec --- stylua: ignore -if true then return {} end - --- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim --- --- In your plugin files, you can: --- * add extra plugins --- * disable/enabled LazyVim plugins --- * override the configuration of LazyVim plugins -return { - -- add gruvbox - { "ellisonleao/gruvbox.nvim" }, - - -- Configure LazyVim to load gruvbox - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - }, - }, - - -- change trouble config - { - "folke/trouble.nvim", - -- opts will be merged with the parent spec - opts = { use_diagnostic_signs = true }, - }, - - -- disable trouble - { "folke/trouble.nvim", enabled = false }, - - -- add symbols-outline - { - "simrat39/symbols-outline.nvim", - cmd = "SymbolsOutline", - keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, - config = true, - }, - - -- override nvim-cmp and add cmp-emoji - { - "hrsh7th/nvim-cmp", - dependencies = { "hrsh7th/cmp-emoji" }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - table.insert(opts.sources, { name = "emoji" }) - end, - }, - - -- change some telescope options and a keymap to browse plugin files - { - "nvim-telescope/telescope.nvim", - keys = { - -- add a keymap to browse plugin files - -- stylua: ignore - { - "fp", - function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, - desc = "Find Plugin File", - }, - }, - -- change some options - opts = { - defaults = { - layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, - sorting_strategy = "ascending", - winblend = 0, - }, - }, - }, - - -- add telescope-fzf-native - { - "telescope.nvim", - dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - config = function() - require("telescope").load_extension("fzf") - end, - }, - }, - - -- add pyright to lspconfig - { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- pyright will be automatically installed with mason and loaded with lspconfig - pyright = {}, - }, - }, - }, - - -- add tsserver and setup with typescript.nvim instead of lspconfig - { - "neovim/nvim-lspconfig", - dependencies = { - "jose-elias-alvarez/typescript.nvim", - init = function() - require("lazyvim.util").on_attach(function(_, buffer) - -- stylua: ignore - vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) - vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) - end) - end, - }, - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - -- tsserver will be automatically installed with mason and loaded with lspconfig - tsserver = {}, - }, - -- you can do any additional lsp server setup here - -- return true if you don't want this server to be setup with lspconfig - ---@type table - setup = { - -- example to setup with typescript.nvim - tsserver = function(_, opts) - require("typescript").setup({ server = opts }) - return true - end, - -- Specify * to use this function as a fallback for any server - -- ["*"] = function(server, opts) end, - }, - }, - }, - - -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, - -- treesitter, mason and typescript.nvim. So instead of the above, you can use: - { import = "lazyvim.plugins.extras.lang.typescript" }, - - -- add more treesitter parsers - { - "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "bash", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "tsx", - "typescript", - "vim", - "yaml", - }, - }, - }, - - -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above - -- would overwrite `ensure_installed` with the new value. - -- If you'd rather extend the default config, use the code below instead: - { - "nvim-treesitter/nvim-treesitter", - opts = function(_, opts) - -- add tsx and treesitter - vim.list_extend(opts.ensure_installed, { - "tsx", - "typescript", - }) - end, - }, - - -- the opts function can also be used to change the default opts: - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function(_, opts) - table.insert(opts.sections.lualine_x, "πŸ˜„") - end, - }, - - -- or you can return new options to override all the defaults - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = function() - return { - --[[add your custom lualine config here]] - } - end, - }, - - -- use mini.starter instead of alpha - { import = "lazyvim.plugins.extras.ui.mini-starter" }, - - -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc - { import = "lazyvim.plugins.extras.lang.json" }, - - -- add any tools you want to have installed below - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - "stylua", - "shellcheck", - "shfmt", - "flake8", - }, - }, - }, - - -- Use for completion and snippets (supertab) - -- first: disable default and behavior in LuaSnip - { - "L3MON4D3/LuaSnip", - keys = function() - return {} - end, - }, - -- then: setup supertab in cmp - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-emoji", - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local luasnip = require("luasnip") - local cmp = require("cmp") - - opts.mapping = vim.tbl_extend("force", opts.mapping, { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- this way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }) - end, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/completion.lua b/home/dot_config/nvim/lua/plugins/completion.lua deleted file mode 100644 index 59d81d9..0000000 --- a/home/dot_config/nvim/lua/plugins/completion.lua +++ /dev/null @@ -1,53 +0,0 @@ -return { - -- Use for completion and snippets (supertab) - -- first: disable default and behavior in LuaSnip - { - "L3MON4D3/LuaSnip", - keys = function() - return {} - end, - }, - -- then: setup supertab in cmp - { - "hrsh7th/nvim-cmp", - dependencies = { - "hrsh7th/cmp-emoji", - }, - ---@param opts cmp.ConfigSchema - opts = function(_, opts) - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local luasnip = require("luasnip") - local cmp = require("cmp") - - opts.mapping = vim.tbl_extend("force", opts.mapping, { - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- this way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }) - end, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/edgy.lua b/home/dot_config/nvim/lua/plugins/edgy.lua deleted file mode 100644 index 01f8a5a..0000000 --- a/home/dot_config/nvim/lua/plugins/edgy.lua +++ /dev/null @@ -1,132 +0,0 @@ -return { - { - "folke/edgy.nvim", - event = "VeryLazy", - keys = { - { - "we", - function() - require("edgy").toggle() - end, - desc = "Edgy Toggle", - }, - { - "wE", - function() - require("edgy").select() - end, - desc = "Edgy Select Window", - }, - }, - opts = function() - ---@type Edgy.Config - local opts = { - bottom = { - { - ft = "toggleterm", - size = { height = 0.4 }, - filter = function(buf, win) - return vim.api.nvim_win_get_config(win).relative == "" - end, - }, - { - ft = "noice", - size = { height = 0.4 }, - filter = function(buf, win) - return vim.api.nvim_win_get_config(win).relative == "" - end, - }, - { - ft = "lazyterm", - title = "LazyTerm", - size = { height = 0.4 }, - filter = function(buf) - return not vim.b[buf].lazyterm_cmd - end, - }, - "Trouble", - { - ft = "trouble", - filter = function(buf, win) - return vim.api.nvim_win_get_config(win).relative == "" - end, - }, - { ft = "qf", title = "QuickFix" }, - { - ft = "help", - size = { height = 20 }, - -- don't open help files in edgy that we're editing - filter = function(buf) - return vim.bo[buf].buftype == "help" - end, - }, - { title = "Spectre", ft = "spectre_panel", size = { height = 0.4 } }, - { title = "Neotest Output", ft = "neotest-output-panel", size = { height = 15 } }, - }, - left = { - { - title = "File Tree", - ft = "neo-tree", - filter = function(buf) - return vim.b[buf].neo_tree_source == "filesystem" - end, - pinned = true, - open = function() - vim.api.nvim_input("e") - end, - size = { height = 0.5 }, - }, - { title = "Neotest Summary", ft = "neotest-summary" }, - { - title = "Git", - ft = "neo-tree", - filter = function(buf) - return vim.b[buf].neo_tree_source == "git_status" - end, - pinned = true, - open = "Neotree position=right git_status", - }, - { - title = "Buffers", - ft = "neo-tree", - filter = function(buf) - return vim.b[buf].neo_tree_source == "buffers" - end, - pinned = true, - open = "Neotree position=top buffers", - }, - "neo-tree", - { - title = "Outline", - ft = "Outline", - pinned = true, - open = "SymbolsOutline", - }, - }, - options = { - left = { size = 40 }, - bottom = { size = 20 }, - }, - keys = { - -- increase width - [""] = function(win) - win:resize("width", 2) - end, - -- decrease width - [""] = function(win) - win:resize("width", -2) - end, - -- increase height - [""] = function(win) - win:resize("height", 2) - end, - -- decrease height - [""] = function(win) - win:resize("height", -2) - end, - }, - } - return opts - end, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/languages.lua b/home/dot_config/nvim/lua/plugins/languages.lua deleted file mode 100644 index 22208d0..0000000 --- a/home/dot_config/nvim/lua/plugins/languages.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "lazyvim.plugins.extras.lang.json" }, - { import = "lazyvim.plugins.extras.lang.docker" }, - { import = "lazyvim.plugins.extras.lang.markdown" }, - { import = "lazyvim.plugins.extras.lang.rust" }, -} diff --git a/home/dot_config/nvim/lua/plugins/telescope.lua b/home/dot_config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index 070dae8..0000000 --- a/home/dot_config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - -- change some telescope options and a keymap to browse plugin files - { - "nvim-telescope/telescope.nvim", - keys = { - -- add a keymap to browse plugin files - { - "fl", - function() - require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) - end, - desc = "Find Plugin File", - }, - }, - -- change some options - opts = { - defaults = { - layout_strategy = "horizontal", - layout_config = { prompt_position = "top" }, - sorting_strategy = "ascending", - winblend = 0, - }, - }, - }, - - -- add telescope-fzf-native - { - "telescope.nvim", - dependencies = { - "nvim-telescope/telescope-fzf-native.nvim", - build = "make", - config = function() - require("telescope").load_extension("fzf") - end, - }, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/test.lua b/home/dot_config/nvim/lua/plugins/test.lua deleted file mode 100644 index 0695061..0000000 --- a/home/dot_config/nvim/lua/plugins/test.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - { import = "lazyvim.plugins.extras.test.core" }, -} diff --git a/home/dot_config/nvim/lua/plugins/theme.lua b/home/dot_config/nvim/lua/plugins/theme.lua deleted file mode 100644 index 370ab84..0000000 --- a/home/dot_config/nvim/lua/plugins/theme.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - -- catppuccin color schema - { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, - { - "LazyVim/LazyVim", - opts = { - colorscheme = "catppuccin", - }, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/treesitter.lua b/home/dot_config/nvim/lua/plugins/treesitter.lua deleted file mode 100644 index 780dcd4..0000000 --- a/home/dot_config/nvim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,111 +0,0 @@ -return { - { - -- source: https://www.josean.com/posts/nvim-treesitter-and-textobjects - -- "nvim-treesitter/nvim-treesitter-textobjects", - "nvim-treesitter/nvim-treesitter", - opts = { - incremental_selection = {}, - textobjects = { - select = { - enable = true, - -- jump forward to textobjects - lookahead = true, - - keymaps = { - -- you can use capture groups defined in textobjects.scm - ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, - ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, - ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, - ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, - - ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, - ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, - - ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, - ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, - - ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, - ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, - - ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, - ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, - - ["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" }, - ["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" }, - - ["ac"] = { query = "@class.outer", desc = "Select outer part of a class" }, - ["ic"] = { query = "@class.inner", desc = "Select inner part of a class" }, - }, - }, - swap = { - enable = true, - -- TODO: Add descriptions for whichkey - swap_next = { - ["na"] = "@parameter.inner", - ["nm"] = "@function.outer", - }, - swap_previous = { - ["pa"] = "@parameter.inner", - ["pm"] = "@function.outer", - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]f"] = { query = "@call.outer", desc = "Next function call start" }, - ["]m"] = { query = "@function.outer", desc = "Next method/function def start" }, - ["]c"] = { query = "@class.outer", desc = "Next class start" }, - ["]i"] = { query = "@conditional.outer", desc = "Next conditional start" }, - ["]l"] = { query = "@loop.outer", desc = "Next loop start" }, - - -- You can pass a query group to use query from `queries//.scm file in your runtime path. - -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. - ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, - ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, - }, - goto_next_end = { - ["]F"] = { query = "@call.outer", desc = "Next function call end" }, - ["]M"] = { query = "@function.outer", desc = "Next method/function def end" }, - ["]C"] = { query = "@class.outer", desc = "Next class end" }, - ["]I"] = { query = "@conditional.outer", desc = "Next conditional end" }, - ["]L"] = { query = "@loop.outer", desc = "Next loop end" }, - }, - goto_previous_start = { - ["[f"] = { query = "@call.outer", desc = "Prev function call start" }, - ["[m"] = { query = "@function.outer", desc = "Prev method/function def start" }, - ["[c"] = { query = "@class.outer", desc = "Prev class start" }, - ["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" }, - ["[l"] = { query = "@loop.outer", desc = "Prev loop start" }, - }, - goto_previous_end = { - ["[F"] = { query = "@call.outer", desc = "Prev function call end" }, - ["[M"] = { query = "@function.outer", desc = "Prev method/function def end" }, - ["[C"] = { query = "@class.outer", desc = "Prev class end" }, - ["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" }, - ["[L"] = { query = "@loop.outer", desc = "Prev loop end" }, - }, - }, - }, - }, - keys = function() - local ts_repeat_move = require("nvim-treesitter.textobjects.repeatable_move") - - return { - -- TODO: make these two keys work for ANY move, not just for treesitter textobjects - { ";", mode = { "n", "x", "o" }, ts_repeat_move.repeat_last_move, desc = "Repeat last move" }, - { - ",", - mode = { "n", "x", "o" }, - ts_repeat_move.repeat_last_move_opposite, - desc = "Repeat last move backwards", - }, - -- enable repeats for `f`, `F`, `t`, and `T` - { "f", mode = { "n", "x", "o" }, ts_repeat_move.builtin_f }, - { "F", mode = { "n", "x", "o" }, ts_repeat_move.builtin_F }, - { "t", mode = { "n", "x", "o" }, ts_repeat_move.builtin_t }, - { "T", mode = { "n", "x", "o" }, ts_repeat_move.builtin_T }, - } - end, - }, -} diff --git a/home/dot_config/nvim/lua/plugins/ui.lua b/home/dot_config/nvim/lua/plugins/ui.lua deleted file mode 100644 index 8fe0cbe..0000000 --- a/home/dot_config/nvim/lua/plugins/ui.lua +++ /dev/null @@ -1,132 +0,0 @@ -return { - { import = "lazyvim.plugins.extras.ui.mini-animate" }, - -- window picker plugin - { - "s1n7ax/nvim-window-picker", - name = "window-picker", - event = "VeryLazy", - version = "2.*", - config = function() - require("window-picker").setup() - end, - }, - - -- plugin to move windows around - { - "sindrets/winshift.nvim", - event = "VeryLazy", - config = true, - keys = { - { - "wsh", - "WinShift left", - desc = "Shift window left", - }, - { - "wsj", - "WinShift down", - desc = "Shift window down", - }, - { - "wsk", - "WinShift up", - desc = "Shift window up", - }, - { - "wsl", - "WinShift right", - desc = "Shift window right", - }, - { - "wsH", - "WinShift far_left", - desc = "Shift window far left", - }, - { - "wsJ", - "WinShift far_down", - desc = "Shift window far down", - }, - { - "wsK", - "WinShift far_up", - desc = "Shift window far up", - }, - { - "wsL", - "WinShift far_right", - desc = "Shift window far right", - }, - }, - }, - -- add description for whichkey - { - "folke/which-key.nvim", - optional = true, - opts = { - defaults = { - ["ws"] = { name = "+shift" }, - }, - }, - }, - - -- toggleable terminal widget - { - "akinsho/toggleterm.nvim", - version = "*", - event = "VeryLazy", - config = true, - keys = { - { - "wt", - "ToggleTerm dir=%:p:h", - desc = "Toggle terminal", - }, - }, - }, - - -- add symbols-outline - { - "simrat39/symbols-outline.nvim", - cmd = "SymbolsOutline", - keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, - config = true, - }, - - -- Always show bufferline tabs - { "akinsho/bufferline.nvim", opts = { options = { always_show_bufferline = true } } }, - - { - "telescope.nvim", - dependencies = { - - { - "tiagovla/scope.nvim", - config = function(_, opts) - require("scope").setup(opts) - require("telescope").load_extension("scope") - end, - }, - }, - }, - { - "nvim-lualine/lualine.nvim", - opts = { - options = { - section_separators = { left = "ξ‚Ό", right = "ξ‚Ί" }, - component_separators = { left = "ξ‚»", right = "ξ‚»" }, - }, - }, - }, - - -- integration with tmux - { - "christoomey/vim-tmux-navigator", - keys = { - { "", "TmuxNavigateLeft", desc = "Go to left window" }, - { "", "TmuxNavigateDown", desc = "Go to lower window" }, - { "", "TmuxNavigateUp", desc = "Go to upper window" }, - { "", "TmuxNavigateRight", desc = "Go to right window" }, - }, - }, -} diff --git a/home/dot_config/nvim/stylua.toml b/home/dot_config/nvim/stylua.toml index 5d6c50d..56619e8 100644 --- a/home/dot_config/nvim/stylua.toml +++ b/home/dot_config/nvim/stylua.toml @@ -1,3 +1,6 @@ +column_width = 160 +line_endings = "Unix" indent_type = "Spaces" indent_width = 2 -column_width = 120 \ No newline at end of file +quote_style = "AutoPreferSingle" +call_parentheses = "Always" From b2eb2687bbe082e18d5bbcbf0d2d36725cd1e195 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Mon, 25 Dec 2023 21:11:10 -0500 Subject: [PATCH 02/17] Fix neo-tree glitch with session restore --- .../nvim/lua/config/plugins/persistence.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/home/dot_config/nvim/lua/config/plugins/persistence.lua b/home/dot_config/nvim/lua/config/plugins/persistence.lua index 37e0d4f..63bcf5f 100644 --- a/home/dot_config/nvim/lua/config/plugins/persistence.lua +++ b/home/dot_config/nvim/lua/config/plugins/persistence.lua @@ -3,10 +3,19 @@ return { { 'folke/persistence.nvim', event = 'BufReadPre', - init = function () - vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" } + init = function() + vim.opt.sessionoptions = { 'buffers', 'curdir', 'tabpages', 'winsize', 'help', 'globals', 'skiprtp', 'folds' } end, - opts = { options = vim.opt.sessionoptions:get() }, + ---@type PersistenceOptions + opts = { + options = vim.opt.sessionoptions:get(), + pre_save = function() + -- Close any neo-tree pane since this causes a bug upon session restore for some reason + if package.loaded['neo-tree'] then + require('neo-tree.command').execute({ action = 'close' }) + end + end, + }, keys = { { 'qs', From db5e2ab622dcb66019bf8589d6ec056b8662dfee Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Mon, 25 Dec 2023 21:11:32 -0500 Subject: [PATCH 03/17] Lazy load Telescope on command --- home/dot_config/nvim/lua/config/plugins/telescope.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/home/dot_config/nvim/lua/config/plugins/telescope.lua b/home/dot_config/nvim/lua/config/plugins/telescope.lua index 87ca4b7..08f49eb 100644 --- a/home/dot_config/nvim/lua/config/plugins/telescope.lua +++ b/home/dot_config/nvim/lua/config/plugins/telescope.lua @@ -31,6 +31,7 @@ local function live_grep_git_root() end end +---@type LazySpec return { { 'nvim-telescope/telescope.nvim', @@ -64,6 +65,7 @@ return { winblend = 0, }, }, + cmd = { 'Telescope' }, keys = function() -- See `:help telescope.builtin` local builtin = require('telescope.builtin') From 3cfc84b9ddf5a2b3c54bffc93e0114e28313bbbd Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:31:37 -0500 Subject: [PATCH 04/17] Update GitSigns gutters --- .../nvim/lua/config/plugins/gitsigns.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/home/dot_config/nvim/lua/config/plugins/gitsigns.lua b/home/dot_config/nvim/lua/config/plugins/gitsigns.lua index e3295cf..8c11256 100644 --- a/home/dot_config/nvim/lua/config/plugins/gitsigns.lua +++ b/home/dot_config/nvim/lua/config/plugins/gitsigns.lua @@ -6,11 +6,12 @@ return { opts = { -- See `:help gitsigns.txt` signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = 'β€Ύ' }, - changedelete = { text = '~' }, + add = { text = 'β–Ž' }, + change = { text = 'β–Ž' }, + delete = { text = 'οƒš' }, + topdelete = { text = 'οƒš' }, + changedelete = { text = 'β–Ž' }, + untracked = { text = 'β–Ž' }, }, on_attach = function(bufnr) -- local gs = package.loaded.gitsigns @@ -86,7 +87,7 @@ return { -- register which-key VISUAL mode ['g'] = { name = '[G]it', _ = 'which_key_ignore' }, ['gh'] = { 'Git [H]unk' }, - } - } + }, + }, }, } From a0f6c9b48bef2f8758fa431e07152ab40758af60 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:32:17 -0500 Subject: [PATCH 05/17] Update indent-blankline gutters --- home/dot_config/nvim/lua/config/plugins/indent-blankline.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua b/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua index cb3948a..d6ebd40 100644 --- a/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua +++ b/home/dot_config/nvim/lua/config/plugins/indent-blankline.lua @@ -1,3 +1,4 @@ +---@type LazySpec return { -- indent guides for Neovim { @@ -5,7 +6,7 @@ return { event = 'VeryLazy', opts = { indent = { - char = 'β”‚', + char = '▏', tab_char = 'β”‚', }, scope = { enabled = false }, From d524a41bf9f6134b2cd26d908e989bf86fd0d6e0 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:33:18 -0500 Subject: [PATCH 06/17] Add mini.indentscope plugin --- .../nvim/lua/config/plugins/mini.lua | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/home/dot_config/nvim/lua/config/plugins/mini.lua b/home/dot_config/nvim/lua/config/plugins/mini.lua index 69e8020..8b6658e 100644 --- a/home/dot_config/nvim/lua/config/plugins/mini.lua +++ b/home/dot_config/nvim/lua/config/plugins/mini.lua @@ -1,7 +1,7 @@ ---@type LazySpec return { { - 'echanovski/mini.animate', + 'echasnovski/mini.animate', event = 'VeryLazy', opts = function() -- disable animation when scrolling with the mouse @@ -58,8 +58,45 @@ return { desc = 'Delete buffer', }, { - 'bD', function() require('mini.bufremove').delete(0, true) end, desc = 'Delete Buffer (Forced)', + 'bD', + function() + require('mini.bufremove').delete(0, true) + end, + desc = 'Delete Buffer (Forced)', }, }, }, + -- Active indent guide and indent text objects. When you're browsing + -- code, this highlights the current level of indentation, and animates + -- the highlighting. + { + 'echasnovski/mini.indentscope', + version = false, -- wait till new 0.7.0 release to put it back on semver + event = 'VeryLazy', + opts = { + symbol = "▏", + -- symbol = 'β”‚', + options = { try_as_border = true }, + }, + init = function() + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'help', + 'alpha', + 'dashboard', + 'neo-tree', + 'Trouble', + 'trouble', + 'lazy', + 'mason', + 'notify', + 'toggleterm', + 'lazyterm', + }, + callback = function() + vim.b.miniindentscope_disable = true + end, + }) + end, + }, } From e5f5948727362bdbcdd474d9b5a1025cb7772272 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:34:28 -0500 Subject: [PATCH 07/17] Add noice plugin --- .../nvim/lua/config/plugins/noice.lua | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 home/dot_config/nvim/lua/config/plugins/noice.lua diff --git a/home/dot_config/nvim/lua/config/plugins/noice.lua b/home/dot_config/nvim/lua/config/plugins/noice.lua new file mode 100644 index 0000000..7d82bcd --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/noice.lua @@ -0,0 +1,53 @@ +---@type LazySpec +return { + { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + lsp = { + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, + }, + }, + routes = { + { + filter = { + event = 'msg_show', + any = { + { find = '%d+L, %d+B' }, + { find = '; after #%d+' }, + { find = '; before #%d+' }, + }, + }, + view = 'mini', + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = true, + }, + }, + -- stylua: ignore + keys = { + { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, + { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, + { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = {"i", "n", "s"} }, + { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = {"i", "n", "s"}}, + }, + }, + { + 'folke/which-key.nvim', + opts = { + defaults = { + ['sn'] = { name = '[S]earch [N]oice', _ = 'which_key_ignore' }, + }, + }, + } +} From c3e3647208876994f8500e9f2279ac89f051351c Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:34:44 -0500 Subject: [PATCH 08/17] Add keymaps for tab navigation --- home/dot_config/nvim/lua/config/keymaps.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/home/dot_config/nvim/lua/config/keymaps.lua b/home/dot_config/nvim/lua/config/keymaps.lua index 8006e53..dcf27b0 100644 --- a/home/dot_config/nvim/lua/config/keymaps.lua +++ b/home/dot_config/nvim/lua/config/keymaps.lua @@ -30,6 +30,14 @@ set('n', 'w|', 'v', { desc = 'Split window right', remap = true }) set('n', '-', 's', { desc = 'Split window below', remap = true }) set('n', '|', 'v', { desc = 'Split window right', remap = true }) +-- Tab Management +set("n", "l", "tablast", { desc = "Last Tab" }) +set("n", "f", "tabfirst", { desc = "First Tab" }) +set("n", "", "tabnew", { desc = "New Tab" }) +set("n", "]", "tabnext", { desc = "Next Tab" }) +set("n", "d", "tabclose", { desc = "Close Tab" }) +set("n", "[", "tabprevious", { desc = "Previous Tab" }) + -- Diagnostic keymaps set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) From 6e649d4737abc3ca5ef077adcae49fc5884784ba Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:35:51 -0500 Subject: [PATCH 09/17] Refactor LSP out of lazy.lua --- home/dot_config/nvim/init.lua | 101 -------------- home/dot_config/nvim/lua/config/lazy.lua | 64 +-------- .../nvim/lua/config/plugins/lsp/init.lua | 123 ++++++++++++++++++ 3 files changed, 124 insertions(+), 164 deletions(-) create mode 100644 home/dot_config/nvim/lua/config/plugins/lsp/init.lua diff --git a/home/dot_config/nvim/init.lua b/home/dot_config/nvim/init.lua index cf6445e..50b3fe8 100644 --- a/home/dot_config/nvim/init.lua +++ b/home/dot_config/nvim/init.lua @@ -2,107 +2,6 @@ require('config') --- [[ Configure LSP ]] --- This function gets run when an LSP connects to a particular buffer. -local on_attach = function(_, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end - - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - - -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) -end - - --- mason-lspconfig requires that these setup functions are called in this order --- before setting up the servers. -require('mason').setup() -require('mason-lspconfig').setup() - --- Enable the following language servers --- Feel free to add/remove any LSPs that you want here. They will automatically be installed. --- --- Add any additional override configuration in the following tables. They will be passed to --- the `settings` field of the server config. You must look up that documentation yourself. --- --- If you want to override the default filetypes that your language server will attach to you can --- define the property 'filetypes' to the map in question. -local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- tsserver = {}, - -- html = { filetypes = { 'html', 'twig', 'hbs'} }, - - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, -} - --- Setup neovim lua configuration -require('neodev').setup() - --- nvim-cmp supports additional completion capabilities, so broadcast that to servers -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - --- Ensure the servers above are installed -local mason_lspconfig = require('mason-lspconfig') - -mason_lspconfig.setup({ - ensure_installed = vim.tbl_keys(servers), -}) - -mason_lspconfig.setup_handlers({ - function(server_name) - require('lspconfig')[server_name].setup({ - capabilities = capabilities, - on_attach = on_attach, - settings = servers[server_name], - filetypes = (servers[server_name] or {}).filetypes, - }) - end, -}) -- [[ Configure nvim-cmp ]] -- See `:help cmp` diff --git a/home/dot_config/nvim/lua/config/lazy.lua b/home/dot_config/nvim/lua/config/lazy.lua index 26b66f1..9ac748c 100644 --- a/home/dot_config/nvim/lua/config/lazy.lua +++ b/home/dot_config/nvim/lua/config/lazy.lua @@ -22,6 +22,7 @@ vim.opt.rtp:prepend(lazypath) -- as they will be available in your neovim runtime. require('lazy').setup({ { import = 'config.plugins' }, + { import = 'config.plugins.lsp' }, -- configs that are in progress and need to be cleaned up { import = 'config.plugins.torefactor' }, -- NOTE: First, some plugins that don't require any configuration @@ -33,26 +34,6 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', - - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - { - -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs to stdpath for neovim - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - - -- Useful status updates for LSP - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', - }, - }, - { -- Autocompletion 'hrsh7th/nvim-cmp', @@ -71,50 +52,7 @@ require('lazy').setup({ }, - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - -- Enable `lukas-reineke/indent-blankline.nvim` - -- See `:help ibl` - main = 'ibl', - opts = {}, - }, - -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, - -- Fuzzy Finder (files, lsp, etc) - { - 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable('make') == 1 - end, - }, - }, - }, - - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', - - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- { import = 'custom.plugins' }, }, {}) diff --git a/home/dot_config/nvim/lua/config/plugins/lsp/init.lua b/home/dot_config/nvim/lua/config/plugins/lsp/init.lua new file mode 100644 index 0000000..b165d7d --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/lsp/init.lua @@ -0,0 +1,123 @@ +-- [[ Configure LSP ]] +-- This function gets run when an LSP connects to a particular buffer. +local on_attach = function(_, bufnr) + -- NOTE: Remember that lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself + -- many times. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) + end + + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + nmap('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- See `:help K` for why this keymap + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + + -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- Create a command `:Format` local to the LSP buffer + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, { desc = 'Format current buffer with LSP' }) +end + +---@type LazySpec +return { + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { + -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs to stdpath for neovim + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + 'folke/neodev.nvim', + }, + config = function() + -- mason-lspconfig requires that these setup functions are called in this order + -- before setting up the servers. + require('mason').setup() + require('mason-lspconfig').setup() + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. They will be passed to + -- the `settings` field of the server config. You must look up that documentation yourself. + -- + -- If you want to override the default filetypes that your language server will attach to you can + -- define the property 'filetypes' to the map in question. + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + rust_analyzer = {}, + -- tsserver = {}, + -- html = { filetypes = { 'html', 'twig', 'hbs'} }, + + lua_ls = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + -- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + } + + -- Setup neovim lua configuration + require('neodev').setup() + + -- nvim-cmp supports additional completion capabilities, so broadcast that to servers + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + + -- Ensure the servers above are installed + local mason_lspconfig = require('mason-lspconfig') + + mason_lspconfig.setup({ + ensure_installed = vim.tbl_keys(servers), + }) + + mason_lspconfig.setup_handlers({ + function(server_name) + require('lspconfig')[server_name].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = servers[server_name], + filetypes = (servers[server_name] or {}).filetypes, + }) + end, + }) + end, + }, +} From 55ef75f7426f4a568f3ede4182e7f5598bb76b92 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:37:00 -0500 Subject: [PATCH 10/17] Update lazy plugins --- home/dot_config/nvim/lazy-lock.json | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/home/dot_config/nvim/lazy-lock.json b/home/dot_config/nvim/lazy-lock.json index c75f634..c09d86b 100644 --- a/home/dot_config/nvim/lazy-lock.json +++ b/home/dot_config/nvim/lazy-lock.json @@ -6,37 +6,38 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "8b407bb6175846cdc4c499e2a8d28109615a2089" }, + "conform.nvim": { "branch": "master", "commit": "7396fc0208539e2bd70e3e446f27529e28dba12b" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, - "fidget.nvim": { "branch": "main", "commit": "1ba4ed7e4ee114df803ccda7ffedaf7ad2c26239" }, + "fidget.nvim": { "branch": "main", "commit": "c08abd008619376e7d0ba6db9fb36871bea7787c" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, - "image.nvim": { "branch": "master", "commit": "41f0f2643a09631bc0d8e2837b514667d423e440" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3084950d1b66426d207064a509477cbfa96362c6" }, + "image.nvim": { "branch": "master", "commit": "9b6248bd8b58b505559e31eb581b7c4638369ec3" }, + "indent-blankline.nvim": { "branch": "master", "commit": "0dca9284bce128e60da18693d92999968d6cb523" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, - "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "lualine.nvim": { "branch": "master", "commit": "f76d9b6454978e72e902910392d7e83292963688" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "mini.animate": { "branch": "main", "commit": "6cec625114007527ff8a82316dba858046f9746f" }, "mini.bufremove": { "branch": "main", "commit": "020243bfed8c8b941f2c20626faf3ea39c0c0e1b" }, - "mini.nvim": { "branch": "main", "commit": "ea1af8c7d5e72148cae8a04e9887322a53fe66cf" }, - "neo-tree.nvim": { "branch": "main", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" }, - "neodev.nvim": { "branch": "main", "commit": "0afdcb703f265c3079a47857bda01e3ccf884558" }, + "mini.indentscope": { "branch": "main", "commit": "5a8369475cd7cd6f207a4d288406d03b0fc48bdb" }, + "neo-tree.nvim": { "branch": "main", "commit": "134c46625abdb18b1b3bb844b3cbb946d95c5557" }, + "neodev.nvim": { "branch": "main", "commit": "269051a7093fa481128904a33a6c4e1ca8de4340" }, "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, "nvim-notify": { "branch": "master", "commit": "27a6649ba6b22828ccc67c913f95a5407a2d8bec" }, - "nvim-treesitter": { "branch": "master", "commit": "454c3a9ba86f841dc3b5bb17d150a873a16b77b4" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" }, - "nvim-web-devicons": { "branch": "master", "commit": "aff5f50b34754335a312c9b3dc5b245f605ce437" }, + "nvim-treesitter": { "branch": "master", "commit": "27f68c0b6a87cbad900b3d016425450af8268026" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "0e2d5bd4cbe75849a013901555d436a48c6680cb" }, + "nvim-web-devicons": { "branch": "master", "commit": "43aa2ddf476012a2155f5f969ee55ab17174da7a" }, + "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" }, "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "f336f8cfab38a82f9f00df380d28f0c2a572f862" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, "vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" }, "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" }, + "vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "winshift.nvim": { "branch": "main", "commit": "37468ed6f385dfb50402368669766504c0e15583" } } \ No newline at end of file From b3b253e6a520d548386abcb217331ecce3f06ade Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:57:51 -0500 Subject: [PATCH 11/17] Add terminfo for wezterm/tmux combo --- home/dot_config/tmux/tmux.conf | 9 +- home/dot_config/wezterm/.chezmoiignore | 1 + .../wezterm/run_once_wezterm_terminfo.sh | 6 ++ home/dot_config/wezterm/wezterm.lua | 2 + home/dot_config/wezterm/wezterm.terminfo | 89 +++++++++++++++++++ 5 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 home/dot_config/wezterm/.chezmoiignore create mode 100644 home/dot_config/wezterm/run_once_wezterm_terminfo.sh create mode 100644 home/dot_config/wezterm/wezterm.terminfo diff --git a/home/dot_config/tmux/tmux.conf b/home/dot_config/tmux/tmux.conf index a017710..5c2f933 100644 --- a/home/dot_config/tmux/tmux.conf +++ b/home/dot_config/tmux/tmux.conf @@ -1,5 +1,10 @@ -# Enable high-color mode -set-option -sa terminal-overrides ",xterm*:Tc" +# enable extended terminal features +set -g default-terminal "wezterm" +set-option -gas terminal-overrides ",xterm*:Tc" # full color support +set-option -gas terminal-overrides "*:Tc" # true color support +set-option -gas terminal-overrides "*:RGB" # true color support +set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support +set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0 set -g mouse on diff --git a/home/dot_config/wezterm/.chezmoiignore b/home/dot_config/wezterm/.chezmoiignore new file mode 100644 index 0000000..d97ddef --- /dev/null +++ b/home/dot_config/wezterm/.chezmoiignore @@ -0,0 +1 @@ +wezterm.terminfo diff --git a/home/dot_config/wezterm/run_once_wezterm_terminfo.sh b/home/dot_config/wezterm/run_once_wezterm_terminfo.sh new file mode 100644 index 0000000..2f99c55 --- /dev/null +++ b/home/dot_config/wezterm/run_once_wezterm_terminfo.sh @@ -0,0 +1,6 @@ +#!/bin/sh +echo "Installing wezterm terminfo definition" +tempfile=$(mktemp) \ + && curl -o $tempfile https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo \ + && tic -x -o ~/.terminfo $tempfile \ + && rm $tempfile diff --git a/home/dot_config/wezterm/wezterm.lua b/home/dot_config/wezterm/wezterm.lua index 889d200..a1ef7f9 100644 --- a/home/dot_config/wezterm/wezterm.lua +++ b/home/dot_config/wezterm/wezterm.lua @@ -12,6 +12,8 @@ config.font_size = 14.0 -- disable ligatures -> config.harfbuzz_features = { "calt=0", "clig=0", "liga=0" } +config.term = "wezterm" + -- set theme config.color_scheme = "Catppuccin Mocha" diff --git a/home/dot_config/wezterm/wezterm.terminfo b/home/dot_config/wezterm/wezterm.terminfo new file mode 100644 index 0000000..369763f --- /dev/null +++ b/home/dot_config/wezterm/wezterm.terminfo @@ -0,0 +1,89 @@ +# This is Wez's term definition for wezterm. +# It was reconstructed via infocmp from file: /lib/terminfo/x/xterm-256color +# and then has some additions in the top few lines (until the line starting +# with am). +# Tc: true color boolean for tmux +# sitm/ritm: italics +# Ms modifies the selection/clipboard. Its parameters are +# p1 = the storage unit (clipboard, selection or cut buffer) +# p2 = the base64-encoded clipboard content. +# +# Ss is used to set the cursor style as described by the DECSCUSR +# function to a block or underline. +# Se resets the cursor style to the terminal power-on default. +# Smulx defines kitty style underline escape sequence support +# +# hs, dsl, fsl, tsl are used by nvim to amend the "status line". +# These are not normally present for xterm and have assumed values +# when TERM==xterm. When using this terminfo file that assumption is not +# true and that functionality is broken. +# We follow the foot's terminfo settings for these, based on +# https://codeberg.org/dnkl/foot/pulls/243/files +# although we use OSC 0 for the title rather than OSC 2. +# https://github.com/neovim/neovim/issues/20706 +# https://github.com/wez/wezterm/issues/2635 +wezterm|Wez's terminal emulator, + Tc, + hs, + sitm=\E[3m, ritm=\E[23m, + Cr=\E]112\007, Cs=\E]12;%p1%s\007, Ms=\E]52;%p1%s;%p2%s\007, Se=\E[2\sq, + Ss=\E[%p1%d\sq, + Smulx=\E[4:%p1%dm, + Sync=\E[?2026%?%p1%{1}%-%tl%eh%;, + Setulc=\E[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m, + Smol=\E[53m, + am, bce, ccc, km, mc5i, mir, msgr, npc, xenl, + colors#0x100, cols#80, it#8, lines#24, pairs#0x7fff, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=\r, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E]2;\E\\, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, fsl=\E\\, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\n, indn=\E[%p1%dS, + initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, + invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, + kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, + kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^?, + kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q, + kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, + kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, + kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, + kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, + kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, + kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, + kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, + kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, + kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, + kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, + kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, + kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, + kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, + kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, + kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~, + kind=\E[1;2B, knp=\E[6~, kpp=\E[5~, + kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, + memu=\Em, oc=\E]104\007, op=\E[39;49m, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E(B, rmam=\E[?7l, + rmcup=\E[?1049l\E[23;0;0t, rmir=\E[4l, rmkx=\E[?1l\E>, + rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rmxx=\E[29m, + rs1=\Ec\E]104\007, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h, + smcup=\E[?1049h\E[22;0;0t, smir=\E[4h, smkx=\E[?1h\E=, + smm=\E[?1034h, smso=\E[7m, smul=\E[4m, smxx=\E[9m, + tbc=\E[3g, tsl=\E]0;, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, + u9=\E[c, vpa=\E[%i%p1%dd, XM=\E[?1003;1006%?%p1%{1}%=%th%el%;, + kmous=\E[<, XM=\E[?1006;1000%?%p1%{1}%=%th%el%;, + xm=\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;, From 34438fe511271e43833aab4ace77daf3308ab830 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 22:58:22 -0500 Subject: [PATCH 12/17] Add option to quit without saving session --- home/dot_config/nvim/lua/config/plugins/persistence.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/dot_config/nvim/lua/config/plugins/persistence.lua b/home/dot_config/nvim/lua/config/plugins/persistence.lua index 63bcf5f..bc93d95 100644 --- a/home/dot_config/nvim/lua/config/plugins/persistence.lua +++ b/home/dot_config/nvim/lua/config/plugins/persistence.lua @@ -35,8 +35,9 @@ return { 'qd', function() require('persistence').stop() + vim.cmd.qa() end, - desc = "Don't Save Current Session", + desc = 'Quit All Without Saving Session', }, }, }, From 99a005a27bff8159bb727c0be96c593ec6f9e84e Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 23:00:05 -0500 Subject: [PATCH 13/17] Fix catppuccin integration with terminal features --- .../nvim/lua/config/plugins/catppuccin.lua | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/home/dot_config/nvim/lua/config/plugins/catppuccin.lua b/home/dot_config/nvim/lua/config/plugins/catppuccin.lua index 90a4ded..39372cb 100644 --- a/home/dot_config/nvim/lua/config/plugins/catppuccin.lua +++ b/home/dot_config/nvim/lua/config/plugins/catppuccin.lua @@ -5,8 +5,48 @@ return { 'catppuccin/nvim', name = 'catppuccin', priority = 1000, - config = function() + ---@type CatppuccinOptions + opts = { + dim_inactive = { enabled = true, shade = 'dark', percentage = 0.15 }, + integrations = { + aerial = true, + alpha = true, + cmp = true, + dashboard = true, + flash = true, + gitsigns = true, + headlines = true, + illuminate = true, + indent_blankline = { enabled = true }, + leap = true, + lsp_trouble = true, + mason = true, + markdown = true, + mini = true, + native_lsp = { + enabled = true, + underlines = { + errors = { 'undercurl' }, + hints = { 'undercurl' }, + warnings = { 'undercurl' }, + information = { 'undercurl' }, + }, + }, + navic = { enabled = true, custom_bg = 'lualine' }, + neotest = true, + neotree = true, + noice = true, + notify = true, + semantic_tokens = true, + telescope = true, + treesitter = true, + treesitter_context = true, + which_key = true, + }, + }, + config = function(_, opts) + require('catppuccin').setup(opts) vim.cmd.colorscheme('catppuccin') end, - } + }, } From 669aaf3b06153ea4943e43ba91f05401183ca513 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Tue, 26 Dec 2023 23:00:50 -0500 Subject: [PATCH 14/17] Change nvim bufferline tab to be sloped --- home/dot_config/nvim/lua/config/plugins/bufferline.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home/dot_config/nvim/lua/config/plugins/bufferline.lua b/home/dot_config/nvim/lua/config/plugins/bufferline.lua index 9eb53fa..c2e1730 100644 --- a/home/dot_config/nvim/lua/config/plugins/bufferline.lua +++ b/home/dot_config/nvim/lua/config/plugins/bufferline.lua @@ -20,6 +20,7 @@ return { close_command = function(n) require('mini.bufremove').delete(n, false) end, + right_mouse_command = false, offsets = { { filetype = 'neo-tree', @@ -28,6 +29,8 @@ return { text_align = 'left', }, }, + separator_style = 'slope', + diagnostics = 'nvim_lsp', }, }, config = function(_, opts) @@ -42,7 +45,7 @@ return { }) end, dependencies = { - 'echasnovski/mini.nvim', + 'echasnovski/mini.bufremove', 'nvim-tree/nvim-web-devicons', }, }, From 462c3ad840f9916ba5cac6e33eb6728f28e65eaf Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Wed, 27 Dec 2023 01:10:23 -0500 Subject: [PATCH 15/17] Remove unneeded items from dashboard --- .../nvim/lua/config/plugins/torefactor/dashboard.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua b/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua index 50cb2f0..b289ffa 100644 --- a/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua +++ b/home/dot_config/nvim/lua/config/plugins/torefactor/dashboard.lua @@ -36,10 +36,8 @@ return { { action = 'ene | startinsert', desc = ' New file', icon = 'ο…› ', key = 'n' }, { action = 'Telescope oldfiles', desc = ' Recent files', icon = 'οƒ… ', key = 'r' }, { action = 'Telescope live_grep', desc = ' Find text', icon = 'ο€’ ', key = 'g' }, - { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = ' Config', icon = ' ', key = 'c' }, + { action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = ' Config (Broken)', icon = ' ', key = 'c' }, { action = 'lua require("persistence").load()', desc = ' Restore Session', icon = ' ', key = 's' }, - { action = 'LazyExtras', desc = ' Lazy Extras', icon = 'ξͺŒ ', key = 'x' }, - { action = 'Lazy', desc = ' Lazy', icon = 'σ°’² ', key = 'l' }, { action = 'qa', desc = ' Quit', icon = ' ', key = 'q' }, }, footer = function() From a2e6db372d439b04fa422b30b3092d40d2485bdc Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Wed, 27 Dec 2023 01:11:39 -0500 Subject: [PATCH 16/17] Refactor cmp plugin --- home/dot_config/nvim/init.lua | 57 -------------- home/dot_config/nvim/lua/config/lazy.lua | 16 ---- .../nvim/lua/config/plugins/cmp.lua | 78 +++++++++++++++++++ 3 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 home/dot_config/nvim/lua/config/plugins/cmp.lua diff --git a/home/dot_config/nvim/init.lua b/home/dot_config/nvim/init.lua index 50b3fe8..6933571 100644 --- a/home/dot_config/nvim/init.lua +++ b/home/dot_config/nvim/init.lua @@ -1,59 +1,2 @@ - - require('config') - --- [[ Configure nvim-cmp ]] --- See `:help cmp` -local cmp = require('cmp') -local luasnip = require('luasnip') -require('luasnip.loaders.from_vscode').lazy_load() -luasnip.config.setup({}) - -cmp.setup({ - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - completion = { - completeopt = 'menu,menuone,noinsert', - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete({}), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }), - sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { name = 'path' }, - }, -}) - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et diff --git a/home/dot_config/nvim/lua/config/lazy.lua b/home/dot_config/nvim/lua/config/lazy.lua index 9ac748c..de1132a 100644 --- a/home/dot_config/nvim/lua/config/lazy.lua +++ b/home/dot_config/nvim/lua/config/lazy.lua @@ -34,22 +34,6 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, -- "gc" to comment visual regions/lines diff --git a/home/dot_config/nvim/lua/config/plugins/cmp.lua b/home/dot_config/nvim/lua/config/plugins/cmp.lua new file mode 100644 index 0000000..1c389e2 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/cmp.lua @@ -0,0 +1,78 @@ +---@type LazySpec +return { + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + opts = function () + local cmp = require('cmp') + local luasnip = require('luasnip') + + return { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { + completeopt = 'menu,menuone,noinsert', + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete({}), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, + config = function(_, opts) + -- [[ Configure nvim-cmp ]] + -- See `:help cmp` + local cmp = require('cmp') + local luasnip = require('luasnip') + require('luasnip.loaders.from_vscode').lazy_load() + luasnip.config.setup({}) + + cmp.setup(opts) + end, + }, +} From 9ea2cca6352985548ebe3a96dba34a77f966ca00 Mon Sep 17 00:00:00 2001 From: nvonbulow Date: Wed, 27 Dec 2023 01:22:07 -0500 Subject: [PATCH 17/17] Misc changes --- home/dot_config/nvim/.neoconf.json | 15 +++++++++++++++ home/dot_config/nvim/lazy-lock.json | 2 ++ .../nvim/lua/config/plugins/firenvim.lua | 13 +++++++++++++ .../nvim/lua/config/plugins/neo-tree.lua | 8 +++++--- home/dot_config/zsh/exact_rc.d/02-dirs.zsh | 6 +++++- 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 home/dot_config/nvim/.neoconf.json create mode 100644 home/dot_config/nvim/lua/config/plugins/firenvim.lua diff --git a/home/dot_config/nvim/.neoconf.json b/home/dot_config/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/home/dot_config/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/home/dot_config/nvim/lazy-lock.json b/home/dot_config/nvim/lazy-lock.json index c09d86b..0b20c39 100644 --- a/home/dot_config/nvim/lazy-lock.json +++ b/home/dot_config/nvim/lazy-lock.json @@ -9,6 +9,7 @@ "conform.nvim": { "branch": "master", "commit": "7396fc0208539e2bd70e3e446f27529e28dba12b" }, "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "fidget.nvim": { "branch": "main", "commit": "c08abd008619376e7d0ba6db9fb36871bea7787c" }, + "firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" }, @@ -23,6 +24,7 @@ "mini.indentscope": { "branch": "main", "commit": "5a8369475cd7cd6f207a4d288406d03b0fc48bdb" }, "neo-tree.nvim": { "branch": "main", "commit": "134c46625abdb18b1b3bb844b3cbb946d95c5557" }, "neodev.nvim": { "branch": "main", "commit": "269051a7093fa481128904a33a6c4e1ca8de4340" }, + "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, "nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-lspconfig": { "branch": "master", "commit": "9099871a7c7e1c16122e00d70208a2cd02078d80" }, diff --git a/home/dot_config/nvim/lua/config/plugins/firenvim.lua b/home/dot_config/nvim/lua/config/plugins/firenvim.lua new file mode 100644 index 0000000..71bd1e9 --- /dev/null +++ b/home/dot_config/nvim/lua/config/plugins/firenvim.lua @@ -0,0 +1,13 @@ +---@type LazySpec +return { + { + 'glacambre/firenvim', + + -- Lazy load firenvim + -- Explanation: https://github.com/folke/lazy.nvim/discussions/463#discussioncomment-4819297 + lazy = not vim.g.started_by_firenvim, + build = function() + vim.fn['firenvim#install'](0) + end, + }, +} diff --git a/home/dot_config/nvim/lua/config/plugins/neo-tree.lua b/home/dot_config/nvim/lua/config/plugins/neo-tree.lua index e289d88..15860f2 100644 --- a/home/dot_config/nvim/lua/config/plugins/neo-tree.lua +++ b/home/dot_config/nvim/lua/config/plugins/neo-tree.lua @@ -9,12 +9,12 @@ return { '3rd/image.nvim', }, keys = { - { 'e', 'Neotree toggle', desc = 'Toggle Neotree' }, + { 'e', function() require('neo-tree.command').execute({ toggle = true }) end, desc = 'Toggle Neotree', remap = true }, }, init = function() -- Disable builtin netrw plugin in favor of Neotree - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 + -- vim.g.loaded_netrw = 1 + -- vim.g.loaded_netrwPlugin = 1 if vim.fn.argc(-1) == 1 then local stat = vim.loop.fs_stat(vim.fn.argv(0)) @@ -67,6 +67,8 @@ return { config = function (self, opts) require('neo-tree').setup(opts) + -- TODO: trigger LSP action on rename + vim.api.nvim_create_autocmd('VimLeavePre', { callback = function () self:deactivate() diff --git a/home/dot_config/zsh/exact_rc.d/02-dirs.zsh b/home/dot_config/zsh/exact_rc.d/02-dirs.zsh index 04c7fd7..c9b3fd3 100644 --- a/home/dot_config/zsh/exact_rc.d/02-dirs.zsh +++ b/home/dot_config/zsh/exact_rc.d/02-dirs.zsh @@ -3,8 +3,12 @@ ## # Set up named directories # +hash -d config=~/.config +hash -d c=~config hash -d zsh=$ZDOTDIR -hash -d nvim=~/.config/nvim +hash -d nvim=~c/nvim +hash -d wezterm=~c/wezterm +hash -d tmux=~c/tmux hash -d repos=~/Documents/repos hash -d projects=~/Documents/projects # `hash -d =` makes ~ a shortcut for .