commit 15e643aa8ea449918e9a73246c6c243118e7c7ed Author: Blake Ridgway Date: Tue Dec 24 23:01:45 2024 -0600 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/.neoconf.json b/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua new file mode 100644 index 0000000..2707160 --- /dev/null +++ b/ftplugin/markdown.lua @@ -0,0 +1,12 @@ +-- Markdown specific settings +vim.opt.wrap = true -- Wrap text +vim.opt.breakindent = true -- Match indent on line break +vim.opt.linebreak = true -- Line break on whole words + +-- Allow j/k when navigating wrapped lines +vim.keymap.set("n", "j", "gj") +vim.keymap.set("n", "k", "gk") + +-- Spell check +vim.opt.spelllang = 'en_us' +vim.opt.spell = true diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a0004bd --- /dev/null +++ b/init.lua @@ -0,0 +1,28 @@ +-- Bootstrap lazy +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + 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(lazypath) + +-- This has to be set before initializing lazy +vim.g.mapleader = " " + +-- Initialize lazy with dynamic loading of anything in the plugins directory +require("lazy").setup("plugins", { + change_detection = { + enabled = true, -- automatically check for config file changes and reload the ui + notify = false, -- turn off notifications whenever plugin changes are made + }, +}) + +-- These modules are not loaded by lazy +require("core.options") +require("core.keymaps") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..4005351 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,49 @@ +{ + "LuaSnip": { "branch": "master", "commit": "1f4ad8bb72bdeb60975e98652636b991a9b7475d" }, + "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, + "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, + "black": { "branch": "main", "commit": "b7c3a9fedd4cfcc6a6a88aacc7b0f599b63d4716" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "fidget.nvim": { "branch": "main", "commit": "b7027a059710fe1ae5726ef7725c2a6020a3d968" }, + "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, + "git-blame.nvim": { "branch": "master", "commit": "f07e913b7143f19edd6787229f2d51759b478600" }, + "harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "29be0919b91fb59eca9e90690d76014233392bef" }, + "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "lsp-progress.nvim": { "branch": "main", "commit": "670cd71586f3464f2e341627ea434498fa0de7d2" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "8b70e7f1e0a4119c1234c3bde4a01c241cabcc74" }, + "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, + "neodev.nvim": { "branch": "main", "commit": "b2881eeb395d2b268de5fe9b5e201a8f1816beb8" }, + "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, + "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, + "nvim-dap": { "branch": "master", "commit": "e154fdb6d70b3765d71f296e718b29d8b7026a63" }, + "nvim-dap-python": { "branch": "master", "commit": "091e4ae00a12085f9ed4200a3cd04af7179b8a23" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" }, + "nvim-lint": { "branch": "master", "commit": "8df53b5dde8ea80f0a039775777eae6648a10229" }, + "nvim-lspconfig": { "branch": "master", "commit": "48347089666d5b77d054088aa72e4e0b58026e6e" }, + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-surround": { "branch": "main", "commit": "703ec63aa798e5e07d309b35e42def34bebe0174" }, + "nvim-tree.lua": { "branch": "master", "commit": "80cfeadf179d5cba76f0f502c71dbcff1b515cd8" }, + "nvim-treesitter": { "branch": "master", "commit": "8f16c39f5b439bd9540336c4d5da705d180e34b9" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, + "nvim-web-devicons": { "branch": "master", "commit": "3523d6e6d40ab11fd66c1b2732b3d6b60affa951" }, + "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "quickfixdd": { "branch": "master", "commit": "cc1adb7e7e9f4827cd655f6b1c05fadedaa87f45" }, + "telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, + "telescope.nvim": { "branch": "master", "commit": "0c12735d5aff6a48ffd8111bf144dc2ff44e5975" }, + "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, + "vim-isort": { "branch": "master", "commit": "757c2c830ba0365167460c26f304f3472dfa2ce2" }, + "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, + "vim-rest-console": { "branch": "master", "commit": "7b407f47185468d1b57a8bd71cdd66c9a99359b2" }, + "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" } +} diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 0000000..82e173e --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "10960" + }, + "version": 7 +} \ No newline at end of file diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..4221e75 --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,8 @@ +-- 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 +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..d73bfa1 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,53 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,3 @@ +-- 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 diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua new file mode 100644 index 0000000..e0163bc --- /dev/null +++ b/lua/core/keymaps.lua @@ -0,0 +1,142 @@ +-- Set leader key to space +vim.g.mapleader = " " + +local keymap = vim.keymap + +-- General keymaps +keymap.set("n", "wq", ":wq") -- save and quit +keymap.set("n", "qq", ":q!") -- quit without saving +keymap.set("n", "ww", ":w") -- save +keymap.set("n", "gx", ":!open ") -- open URL under cursor + +-- Split window management +keymap.set("n", "sv", "v") -- split window vertically +keymap.set("n", "sh", "s") -- split window horizontally +keymap.set("n", "se", "=") -- make split windows equal width +keymap.set("n", "sx", ":close") -- close split window +keymap.set("n", "sj", "-") -- make split window height shorter +keymap.set("n", "sk", "+") -- make split windows height taller +keymap.set("n", "sl", ">5") -- make split windows width bigger +keymap.set("n", "sh", "<5") -- make split windows width smaller + +-- Tab management +keymap.set("n", "to", ":tabnew") -- open a new tab +keymap.set("n", "tx", ":tabclose") -- close a tab +keymap.set("n", "tn", ":tabn") -- next tab +keymap.set("n", "tp", ":tabp") -- previous tab + +-- Diff keymaps +keymap.set("n", "cc", ":diffput") -- put diff from current to other during diff +keymap.set("n", "cj", ":diffget 1") -- get diff from left (local) during merge +keymap.set("n", "ck", ":diffget 3") -- get diff from right (remote) during merge +keymap.set("n", "cn", "]c") -- next diff hunk +keymap.set("n", "cp", "[c") -- previous diff hunk + +-- Quickfix keymaps +keymap.set("n", "qo", ":copen") -- open quickfix list +keymap.set("n", "qf", ":cfirst") -- jump to first quickfix list item +keymap.set("n", "qn", ":cnext") -- jump to next quickfix list item +keymap.set("n", "qp", ":cprev") -- jump to prev quickfix list item +keymap.set("n", "ql", ":clast") -- jump to last quickfix list item +keymap.set("n", "qc", ":cclose") -- close quickfix list + +-- Vim-maximizer +keymap.set("n", "sm", ":MaximizerToggle") -- toggle maximize tab + +-- Nvim-tree +keymap.set("n", "ee", ":NvimTreeToggle") -- toggle file explorer +keymap.set("n", "er", ":NvimTreeFocus") -- toggle focus to file explorer +keymap.set("n", "ef", ":NvimTreeFindFile") -- find file in file explorer + +-- Telescope +keymap.set('n', 'ff', require('telescope.builtin').find_files, {}) -- fuzzy find files in project +keymap.set('n', 'fg', require('telescope.builtin').live_grep, {}) -- grep file contents in project +keymap.set('n', 'fb', require('telescope.builtin').buffers, {}) -- fuzzy find open buffers +keymap.set('n', 'fh', require('telescope.builtin').help_tags, {}) -- fuzzy find help tags +keymap.set('n', 'fs', require('telescope.builtin').current_buffer_fuzzy_find, {}) -- fuzzy find in current file buffer +keymap.set('n', 'fo', require('telescope.builtin').lsp_document_symbols, {}) -- fuzzy find LSP/class symbols +keymap.set('n', 'fi', require('telescope.builtin').lsp_incoming_calls, {}) -- fuzzy find LSP/incoming calls +-- keymap.set('n', 'fm', function() require('telescope.builtin').treesitter({default_text=":method:"}) end) -- fuzzy find methods in current class +keymap.set('n', 'fm', function() require('telescope.builtin').treesitter({symbols={'function', 'method'}}) end) -- fuzzy find methods in current class +keymap.set('n', 'ft', function() -- grep file contents in current nvim-tree node + local success, node = pcall(function() return require('nvim-tree.lib').get_node_at_cursor() end) + if not success or not node then return end; + require('telescope.builtin').live_grep({search_dirs = {node.absolute_path}}) +end) + +-- Git-blame +keymap.set("n", "gb", ":GitBlameToggle") -- toggle git blame + +-- Harpoon +keymap.set("n", "ha", require("harpoon.mark").add_file) +keymap.set("n", "hh", require("harpoon.ui").toggle_quick_menu) +keymap.set("n", "h1", function() require("harpoon.ui").nav_file(1) end) +keymap.set("n", "h2", function() require("harpoon.ui").nav_file(2) end) +keymap.set("n", "h3", function() require("harpoon.ui").nav_file(3) end) +keymap.set("n", "h4", function() require("harpoon.ui").nav_file(4) end) +keymap.set("n", "h5", function() require("harpoon.ui").nav_file(5) end) +keymap.set("n", "h6", function() require("harpoon.ui").nav_file(6) end) +keymap.set("n", "h7", function() require("harpoon.ui").nav_file(7) end) +keymap.set("n", "h8", function() require("harpoon.ui").nav_file(8) end) +keymap.set("n", "h9", function() require("harpoon.ui").nav_file(9) end) + +-- Vim REST Console +keymap.set("n", "xr", ":call VrcQuery()") -- Run REST query + +-- LSP +keymap.set('n', 'gg', 'lua vim.lsp.buf.hover()') +keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()') +keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()') +keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()') +keymap.set('n', 'gt', 'lua vim.lsp.buf.type_definition()') +keymap.set('n', 'gr', 'lua vim.lsp.buf.references()') +keymap.set('n', 'gs', 'lua vim.lsp.buf.signature_help()') +keymap.set('n', 'rr', 'lua vim.lsp.buf.rename()') +keymap.set('n', 'gf', 'lua vim.lsp.buf.format({async = true})') +keymap.set('v', 'gf', 'lua vim.lsp.buf.format({async = true})') +keymap.set('n', 'ga', 'lua vim.lsp.buf.code_action()') +keymap.set('n', 'gl', 'lua vim.diagnostic.open_float()') +keymap.set('n', 'gp', 'lua vim.diagnostic.goto_prev()') +keymap.set('n', 'gn', 'lua vim.diagnostic.goto_next()') +keymap.set('n', 'tr', 'lua vim.lsp.buf.document_symbol()') +keymap.set('i', '', 'lua vim.lsp.buf.completion()') + +-- Filetype-specific keymaps (these can be done in the ftplugin directory instead if you prefer) +keymap.set("n", 'go', function() + if vim.bo.filetype == 'python' then + vim.api.nvim_command('PyrightOrganizeImports') + end +end) + +keymap.set("n", 'tc', function() + if vim.bo.filetype == 'python' then + require('dap-python').test_class(); + end +end) + +keymap.set("n", 'tm', function() + if vim.bo.filetype == 'python' then + require('dap-python').test_method(); + end +end) + +-- Debugging +keymap.set("n", "bb", "lua require'dap'.toggle_breakpoint()") +keymap.set("n", "bc", "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))") +keymap.set("n", "bl", "lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))") +keymap.set("n", 'br', "lua require'dap'.clear_breakpoints()") +keymap.set("n", 'ba', 'Telescope dap list_breakpoints') +keymap.set("n", "dc", "lua require'dap'.continue()") +keymap.set("n", "dj", "lua require'dap'.step_over()") +keymap.set("n", "dk", "lua require'dap'.step_into()") +keymap.set("n", "do", "lua require'dap'.step_out()") +keymap.set("n", 'dd', function() require('dap').disconnect(); require('dapui').close(); end) +keymap.set("n", 'dt', function() require('dap').terminate(); require('dapui').close(); end) +keymap.set("n", "dr", "lua require'dap'.repl.toggle()") +keymap.set("n", "dl", "lua require'dap'.run_last()") +keymap.set("n", 'di', function() require "dap.ui.widgets".hover() end) +keymap.set("n", 'd?', function() local widgets = require "dap.ui.widgets"; widgets.centered_float(widgets.scopes) end) +keymap.set("n", 'df', 'Telescope dap frames') +keymap.set("n", 'dh', 'Telescope dap commands') +keymap.set("n", 'de', function() require('telescope.builtin').diagnostics({default_text=":E:"}) end) + diff --git a/lua/core/options.lua b/lua/core/options.lua new file mode 100644 index 0000000..9057a80 --- /dev/null +++ b/lua/core/options.lua @@ -0,0 +1,56 @@ +local opt = vim.opt + +-- Session Management +opt.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" + +-- Line Numbers +opt.relativenumber = true +opt.number = true + +-- Tabs & Indentation +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.expandtab = true +opt.autoindent = true +vim.bo.softtabstop = 2 + +-- Line Wrapping +opt.wrap = false + +-- Search Settings +opt.ignorecase = true +opt.smartcase = true + +-- Cursor Line +opt.cursorline = true + +-- Appearance +opt.termguicolors = true +opt.background = "dark" +opt.signcolumn = "yes" +opt.showmode = false +vim.diagnostic.config { + float = { border = "rounded" }, -- add border to diagnostic popups +} + +-- Backspace +opt.backspace = "indent,eol,start" + +-- Clipboard +opt.clipboard:append("unnamedplus") + +-- Split Windows +opt.splitright = true +opt.splitbelow = true + +-- Consider - as part of keyword +opt.iskeyword:append("-") + +-- Disable the mouse while in nvim +opt.mouse = "" + +-- Folding +opt.foldlevel = 20 +opt.foldmethod = "expr" +opt.foldexpr = "nvim_treesitter#foldexpr()" -- Utilize Treesitter folds + diff --git a/lua/plugins/barbecue-nvim.lua b/lua/plugins/barbecue-nvim.lua new file mode 100644 index 0000000..97aeee3 --- /dev/null +++ b/lua/plugins/barbecue-nvim.lua @@ -0,0 +1,16 @@ +-- Display LSP-based breadcrumbs +return { + -- https://github.com/utilyre/barbecue.nvim + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + dependencies = { + -- https://github.com/SmiteshP/nvim-navic + "SmiteshP/nvim-navic", + -- https://github.com/nvim-tree/nvim-web-devicons + "nvim-tree/nvim-web-devicons", -- optional dependency + }, + opts = { + -- configurations go here + }, +} diff --git a/lua/plugins/bigfile-nvim.lua b/lua/plugins/bigfile-nvim.lua new file mode 100644 index 0000000..61ca545 --- /dev/null +++ b/lua/plugins/bigfile-nvim.lua @@ -0,0 +1,12 @@ +-- Improve performance of editing big files +return { + -- https://github.com/LunarVim/bigfile.nvim + 'LunarVim/bigfile.nvim', + event = 'BufReadPre', + opts = { + filesize = 2, -- size of the file in MiB, the plugin round file sizes to the closest MiB + }, + config = function (_, opts) + require('bigfile').setup(opts) + end +} diff --git a/lua/plugins/black.lua b/lua/plugins/black.lua new file mode 100644 index 0000000..795c726 --- /dev/null +++ b/lua/plugins/black.lua @@ -0,0 +1,15 @@ +-- Python formatter +return { + -- https://github.com/psf/black + 'psf/black', + ft = 'python', + config =function () + -- Automatically format file buffer when saving + vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = "*.py", + callback = function() + vim.cmd("Black") + end, + }) + end +} diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..2d3b3f3 --- /dev/null +++ b/lua/plugins/colorscheme.lua @@ -0,0 +1,168 @@ +-- Theme/Colorscheme (uncomment section for whichever theme you prefer or use your own) +-- Kanagawa Theme (Custom Palette) +return { + -- https://github.com/rebelot/kanagawa.nvim + 'rebelot/kanagawa.nvim', -- You can replace this with your favorite colorscheme + lazy = false, -- We want the colorscheme to load immediately when starting Neovim + priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins + opts = { + -- Replace this with your scheme-specific settings or remove to use the defaults + -- transparent = true, + background = { + -- light = "lotus", + dark = "wave", -- "wave, dragon" + }, + colors = { + palette = { + -- Background colors + sumiInk0 = "#161616", -- modified + sumiInk1 = "#181818", -- modified + sumiInk2 = "#1a1a1a", -- modified + sumiInk3 = "#1F1F1F", -- modified + sumiInk4 = "#2A2A2A", -- modified + sumiInk5 = "#363636", -- modified + sumiInk6 = "#545454", -- modified + + -- Popup and Floats + waveBlue1 = "#322C47", -- modified + waveBlue2 = "#4c4464", -- modified + + -- Diff and Git + winterGreen = "#2B3328", + winterYellow = "#49443C", + winterRed = "#43242B", + winterBlue = "#252535", + autumnGreen = "#76A56A", -- modified + autumnRed = "#C34043", + autumnYellow = "#DCA561", + + -- Diag + samuraiRed = "#E82424", + roninYellow = "#FF9E3B", + waveAqua1 = "#7E9CD8", -- modified + dragonBlue = "#7FB4CA", -- modified + + -- Foreground and Comments + oldWhite = "#C8C093", + fujiWhite = "#F9E7C0", -- modified + fujiGray = "#727169", + oniViolet = "#BFA3E6", -- modified + oniViolet2 = "#BCACDB", -- modified + crystalBlue = "#8CABFF", -- modified + springViolet1 = "#938AA9", + springViolet2 = "#9CABCA", + springBlue = "#7FC4EF", -- modified + waveAqua2 = "#77BBDD", -- modified + + springGreen = "#98BB6C", + boatYellow1 = "#938056", + boatYellow2 = "#C0A36E", + carpYellow = "#FFEE99", -- modified + + sakuraPink = "#D27E99", + waveRed = "#E46876", + peachRed = "#FF5D62", + surimiOrange = "#FFAA44", -- modified + katanaGray = "#717C7C", + }, + }, + }, + config = function(_, opts) + require('kanagawa').setup(opts) -- Replace this with your favorite colorscheme + vim.cmd("colorscheme kanagawa") -- Replace this with your favorite colorscheme + + -- Custom diff colors + vim.cmd([[ + autocmd VimEnter * hi DiffAdd guifg=#00FF00 guibg=#005500 + autocmd VimEnter * hi DiffDelete guifg=#FF0000 guibg=#550000 + autocmd VimEnter * hi DiffChange guifg=#CCCCCC guibg=#555555 + autocmd VimEnter * hi DiffText guifg=#00FF00 guibg=#005500 + ]]) + + -- Custom border colors + vim.cmd([[ + autocmd ColorScheme * hi NormalFloat guifg=#F9E7C0 guibg=#1F1F1F + autocmd ColorScheme * hi FloatBorder guifg=#F9E7C0 guibg=#1F1F1F + ]]) + end +} + +-- Kanagawa Theme (Original) +-- return { +-- -- https://github.com/rebelot/kanagawa.nvim +-- 'rebelot/kanagawa.nvim', -- You can replace this with your favorite colorscheme +-- lazy = false, -- We want the colorscheme to load immediately when starting Neovim +-- priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins +-- opts = { +-- -- Replace this with your scheme-specific settings or remove to use the defaults +-- -- transparent = true, +-- background = { +-- -- light = "lotus", +-- dark = "wave", -- "wave, dragon" +-- }, +-- }, +-- config = function(_, opts) +-- require('kanagawa').setup(opts) -- Replace this with your favorite colorscheme +-- vim.cmd("colorscheme kanagawa") -- Replace this with your favorite colorscheme +-- end +-- } + +-- Tokyo Night Theme +-- return { +-- -- https://github.com/folke/tokyonight.nvim +-- 'folke/tokyonight.nvim', -- You can replace this with your favorite colorscheme +-- lazy = false, -- We want the colorscheme to load immediately when starting Neovim +-- priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins +-- opts = { +-- -- Replace this with your scheme-specific settings or remove to use the defaults +-- -- transparent = true, +-- style = "night", -- other variations "storm, night, moon, day" +-- }, +-- config = function(_, opts) +-- require('tokyonight').setup(opts) -- Replace this with your favorite colorscheme +-- vim.cmd("colorscheme tokyonight") -- Replace this with your favorite colorscheme +-- end +-- } + +-- Catppuccin Theme +-- return { +-- -- https://github.com/catppuccin/nvim +-- 'catppuccin/nvim', +-- name = "catppuccin", -- name is needed otherwise plugin shows up as "nvim" due to github URI +-- lazy = false, -- We want the colorscheme to load immediately when starting Neovim +-- priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins +-- opts = { +-- -- -- Replace this with your scheme-specific settings or remove to use the defaults +-- -- transparent = true, +-- flavour = "mocha", -- "latte, frappe, macchiato, mocha" +-- }, +-- config = function(_, opts) +-- require('catppuccin').setup(opts) -- Replace this with your favorite colorscheme +-- vim.cmd("colorscheme catppuccin") -- Replace this with your favorite colorscheme +-- end +-- } + +-- Sonokai Theme +-- return { +-- -- https://github.com/sainnhe/sonokai +-- 'sainnhe/sonokai', +-- lazy = false, -- We want the colorscheme to load immediately when starting Neovim +-- priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins +-- config = function(_, opts) +-- vim.g.sonokai_style = "default" -- "default, atlantis, andromeda, shusia, maia, espresso" +-- vim.cmd("colorscheme sonokai") -- Replace this with your favorite colorscheme +-- end +-- } + +-- One Nord Theme +-- return { +-- -- https://github.com/rmehri01/onenord.nvim +-- 'rmehri01/onenord.nvim', +-- lazy = false, -- We want the colorscheme to load immediately when starting Neovim +-- priority = 1000, -- Load the colorscheme before other non-lazy-loaded plugins +-- config = function(_, opts) +-- vim.cmd("colorscheme onenord") -- Replace this with your favorite colorscheme +-- end +-- } + + diff --git a/lua/plugins/example.lua b/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- 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 }, + + -- 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 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").lsp.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, { + function() + return "😄" + end, + }) + 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", + }, + }, + }, +} diff --git a/lua/plugins/git-blame-nvim.lua b/lua/plugins/git-blame-nvim.lua new file mode 100644 index 0000000..0467a3f --- /dev/null +++ b/lua/plugins/git-blame-nvim.lua @@ -0,0 +1,11 @@ +-- Git Blame +return { + -- https://github.com/f-person/git-blame.nvim + 'f-person/git-blame.nvim', + event = 'VeryLazy', + opts = { + enabled = false, -- disable by default, enabled only on keymap + date_format = '%m/%d/%y %H:%M:%S', -- more concise date format + } +} + diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 0000000..16bb7f9 --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,17 @@ +-- List of favorite files/marks per project +return { + -- https://github.com/ThePrimeagen/harpoon + 'ThePrimeagen/harpoon', + branch = 'master', + event = 'VeryLazy', + dependencies = { + -- https://github.com/nvim-lua/plenary.nvim + 'nvim-lua/plenary.nvim', + }, + opts = { + menu = { + width = 120 + } + }, +} + diff --git a/lua/plugins/indent-blankline-nvim.lua b/lua/plugins/indent-blankline-nvim.lua new file mode 100644 index 0000000..978a287 --- /dev/null +++ b/lua/plugins/indent-blankline-nvim.lua @@ -0,0 +1,13 @@ +-- Indentation guides +return { + -- https://github.com/lukas-reineke/indent-blankline.nvim + "lukas-reineke/indent-blankline.nvim", + event = 'VeryLazy', + main = "ibl", + opts = { + enabled = true, + indent = { + char = '|', + }, + }, +} diff --git a/lua/plugins/lualine-nvim.lua b/lua/plugins/lualine-nvim.lua new file mode 100644 index 0000000..bfe81e7 --- /dev/null +++ b/lua/plugins/lualine-nvim.lua @@ -0,0 +1,36 @@ +-- Status line +return { + -- https://github.com/nvim-lualine/lualine.nvim + 'nvim-lualine/lualine.nvim', + dependencies = { + -- https://github.com/nvim-tree/nvim-web-devicons + 'nvim-tree/nvim-web-devicons', -- fancy icons + -- https://github.com/linrongbin16/lsp-progress.nvim + 'linrongbin16/lsp-progress.nvim', -- LSP loading progress + }, + opts = { + options = { + -- For more themes, see https://github.com/nvim-lualine/lualine.nvim/blob/master/THEMES.md + theme = "codedark", -- "auto, tokyonight, catppuccin, codedark, nord" + }, + sections = { + lualine_c = { + { + -- Customize the filename part of lualine to be parent/filename + 'filename', + file_status = true, -- Displays file status (readonly status, modified status) + newfile_status = false, -- Display new file status (new file means no write after created) + path = 4, -- 0: Just the filename + -- 1: Relative path + -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory + -- 4: Filename and parent dir, with tilde as the home directory + symbols = { + modified = '[+]', -- Text to show when the file is modified. + readonly = '[-]', -- Text to show when the file is non-modifiable or readonly. + } + } + } + } + } +} diff --git a/lua/plugins/nvim-autopairs.lua b/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..9feca9b --- /dev/null +++ b/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,13 @@ +-- Auto-completion of bracket/paren/quote pairs +return { + -- https://github.com/windwp/nvim-autopairs + 'windwp/nvim-autopairs', + event = "InsertEnter", + opts = { + check_ts = true, -- enable treesitter + ts_config = { + lua = { "string" }, -- don't add pairs in lua string treesitter nodes + javascript = { "template_string" }, -- don't add pairs in javascript template_string + } + } +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..12fdfa8 --- /dev/null +++ b/lua/plugins/nvim-cmp.lua @@ -0,0 +1,87 @@ +-- Auto-completion / Snippets +return { + -- https://github.com/hrsh7th/nvim-cmp + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + -- Snippet engine & associated nvim-cmp source + -- https://github.com/L3MON4D3/LuaSnip + 'L3MON4D3/LuaSnip', + -- https://github.com/saadparwaiz1/cmp_luasnip + 'saadparwaiz1/cmp_luasnip', + + -- LSP completion capabilities + -- https://github.com/hrsh7th/cmp-nvim-lsp + 'hrsh7th/cmp-nvim-lsp', + + -- Additional user-friendly snippets + -- https://github.com/rafamadriz/friendly-snippets + 'rafamadriz/friendly-snippets', + -- https://github.com/hrsh7th/cmp-buffer + 'hrsh7th/cmp-buffer', + -- https://github.com/hrsh7th/cmp-path + 'hrsh7th/cmp-path', + -- https://github.com/hrsh7th/cmp-cmdline + 'hrsh7th/cmp-cmdline', + }, + config = function() + 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(), -- next suggestion + [''] = cmp.mapping.select_prev_item(), -- previous suggestion + [''] = cmp.mapping.scroll_docs(-4), -- scroll backward + [''] = cmp.mapping.scroll_docs(4), -- scroll forward + [''] = cmp.mapping.complete {}, -- show completion suggestions + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + -- Tab through suggestions or when a snippet is active, tab to the next argument + [''] = 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' }), + -- Tab backwards through suggestions or when a snippet is active, tab to the next argument + [''] = 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 = cmp.config.sources({ + { name = "nvim_lsp" }, -- lsp + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), + window = { + -- Add borders to completions popups + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + }) + end, + } + diff --git a/lua/plugins/nvim-dap-python.lua b/lua/plugins/nvim-dap-python.lua new file mode 100644 index 0000000..ba010dc --- /dev/null +++ b/lua/plugins/nvim-dap-python.lua @@ -0,0 +1,13 @@ +return { + -- https://github.com/mfussenegger/nvim-dap-python + 'mfussenegger/nvim-dap-python', + ft = 'python', + dependencies = { + -- https://github.com/mfussenegger/nvim-dap + 'mfussenegger/nvim-dap', + }, + config = function () + -- Update the path passed to setup to point to your system or virtual env python binary + require('dap-python').setup('/usr/bin/python3') + end +} diff --git a/lua/plugins/nvim-dap-ui.lua b/lua/plugins/nvim-dap-ui.lua new file mode 100644 index 0000000..6332b4b --- /dev/null +++ b/lua/plugins/nvim-dap-ui.lua @@ -0,0 +1,126 @@ +-- Debugging Support +return { + -- https://github.com/rcarriga/nvim-dap-ui + 'rcarriga/nvim-dap-ui', + event = 'VeryLazy', + dependencies = { + -- https://github.com/mfussenegger/nvim-dap + 'mfussenegger/nvim-dap', + -- https://github.com/nvim-neotest/nvim-nio + 'nvim-neotest/nvim-nio', + -- https://github.com/theHamsta/nvim-dap-virtual-text + 'theHamsta/nvim-dap-virtual-text', -- inline variable text while debugging + -- https://github.com/nvim-telescope/telescope-dap.nvim + 'nvim-telescope/telescope-dap.nvim', -- telescope integration with dap + }, + opts = { + controls = { + element = "repl", + enabled = false, + icons = { + disconnect = "", + pause = "", + play = "", + run_last = "", + step_back = "", + step_into = "", + step_out = "", + step_over = "", + terminate = "" + } + }, + element_mappings = {}, + expand_lines = true, + floating = { + border = "single", + mappings = { + close = { "q", "" } + } + }, + force_buffers = true, + icons = { + collapsed = "", + current_frame = "", + expanded = "" + }, + layouts = { + { + elements = { + { + id = "scopes", + size = 0.50 + }, + { + id = "stacks", + size = 0.30 + }, + { + id = "watches", + size = 0.10 + }, + { + id = "breakpoints", + size = 0.10 + } + }, + size = 40, + position = "left", -- Can be "left" or "right" + }, + { + elements = { + "repl", + "console", + }, + size = 10, + position = "bottom", -- Can be "bottom" or "top" + } + }, + mappings = { + edit = "e", + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + repl = "r", + toggle = "t" + }, + render = { + indent = 1, + max_value_lines = 100 + } + }, + config = function (_, opts) + local dap = require('dap') + require('dapui').setup(opts) + + -- Customize breakpoint signs + vim.api.nvim_set_hl(0, "DapStoppedHl", { fg = "#98BB6C", bg = "#2A2A2A", bold = true }) + vim.api.nvim_set_hl(0, "DapStoppedLineHl", { bg = "#204028", bold = true }) + vim.fn.sign_define('DapStopped', { text='', texthl='DapStoppedHl', linehl='DapStoppedLineHl', numhl= '' }) + vim.fn.sign_define('DapBreakpoint', { text='', texthl='DiagnosticSignError', linehl='', numhl='' }) + vim.fn.sign_define('DapBreakpointCondition', { text='', texthl='DiagnosticSignWarn', linehl='', numhl='' }) + vim.fn.sign_define('DapBreakpointRejected', { text='', texthl='DiagnosticSignError', linehl='', numhl= '' }) + vim.fn.sign_define('DapLogPoint', { text='', texthl='DiagnosticSignInfo', linehl='', numhl= '' }) + + dap.listeners.after.event_initialized["dapui_config"] = function() + require('dapui').open() + end + + dap.listeners.before.event_terminated["dapui_config"] = function() + -- Commented to prevent DAP UI from closing when unit tests finish + -- require('dapui').close() + end + + dap.listeners.before.event_exited["dapui_config"] = function() + -- Commented to prevent DAP UI from closing when unit tests finish + -- require('dapui').close() + end + + -- Add dap configurations based on your language/adapter settings + -- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation + -- dap.configurations.xxxxxxxxxx = { + -- { + -- }, + -- } + end +} + diff --git a/lua/plugins/nvim-dap-virtual-text.lua b/lua/plugins/nvim-dap-virtual-text.lua new file mode 100644 index 0000000..047b87a --- /dev/null +++ b/lua/plugins/nvim-dap-virtual-text.lua @@ -0,0 +1,19 @@ +-- Inline Debug Text +return { + -- https://github.com/theHamsta/nvim-dap-virtual-text + 'theHamsta/nvim-dap-virtual-text', + lazy = true, + opts = { + -- Display debug text as a comment + commented = true, + -- Customize virtual text + display_callback = function(variable, buf, stackframe, node, options) + if options.virt_text_pos == 'inline' then + return ' = ' .. variable.value + else + return variable.name .. ' = ' .. variable.value + end + end, + } +} + diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..2287ea9 --- /dev/null +++ b/lua/plugins/nvim-lint.lua @@ -0,0 +1,27 @@ +-- General purpose linters +return { + -- https://github.com/mfussenegger/nvim-lint + 'mfussenegger/nvim-lint', + event = 'BufWritePost', + config = function () + -- Define a table of linters for each filetype (not extension). + -- Additional linters can be found here: https://github.com/mfussenegger/nvim-lint#available-linters + require('lint').linters_by_ft = { + python = { + -- Uncomment whichever linters you prefer + -- 'flake8', + -- 'mypy', + -- 'pylint', + } + } + + -- Automatically run linters after saving. Use "InsertLeave" for more aggressive linting. + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + -- Only run linter for the following extensions. Remove this to always run. + pattern = { "*.py", }, + callback = function() + require("lint").try_lint() + end, + }) + end +} diff --git a/lua/plugins/nvim-lspconfig.lua b/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..38189a3 --- /dev/null +++ b/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,98 @@ +-- LSP Support +return { + -- LSP Configuration + -- https://github.com/neovim/nvim-lspconfig + 'neovim/nvim-lspconfig', + event = 'VeryLazy', + dependencies = { + -- LSP Management + -- https://github.com/williamboman/mason.nvim + { 'williamboman/mason.nvim' }, + -- https://github.com/williamboman/mason-lspconfig.nvim + { 'williamboman/mason-lspconfig.nvim' }, + + -- Auto-Install LSPs, linters, formatters, debuggers + -- https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim + { 'WhoIsSethDaniel/mason-tool-installer.nvim' }, + + -- Useful status updates for LSP + -- https://github.com/j-hui/fidget.nvim + { 'j-hui/fidget.nvim', opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + -- https://github.com/folke/neodev.nvim + { 'folke/neodev.nvim', opts = {} }, + }, + config = function () + require('mason').setup() + require('mason-lspconfig').setup({ + -- Install these LSPs automatically + ensure_installed = { + 'bashls', + 'cssls', + 'html', + 'lua_ls', + 'jsonls', + 'lemminx', + 'marksman', + 'quick_lint_js', + 'yamlls', + 'pyright', + } + }) + + require('mason-tool-installer').setup({ + -- Install these linters, formatters, debuggers automatically + ensure_installed = { + 'black', + 'debugpy', + 'flake8', + 'isort', + 'mypy', + 'pylint', + }, + }) + + -- There is an issue with mason-tools-installer running with VeryLazy, since it triggers on VimEnter which has already occurred prior to this plugin loading so we need to call install explicitly + -- https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim/issues/39 + vim.api.nvim_command('MasonToolsInstall') + + local lspconfig = require('lspconfig') + local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities() + local lsp_attach = function(client, bufnr) + -- Create your keybindings here... + end + + -- Call setup on each LSP server + require('mason-lspconfig').setup_handlers({ + function(server_name) + lspconfig[server_name].setup({ + on_attach = lsp_attach, + capabilities = lsp_capabilities, + }) + end + }) + + -- Lua LSP settings + lspconfig.lua_ls.setup { + settings = { + Lua = { + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'}, + }, + }, + }, + } + + -- Globally configure all LSP floating preview popups (like hover, signature help, etc) + local open_floating_preview = vim.lsp.util.open_floating_preview + function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = opts.border or "rounded" -- Set border to rounded + return open_floating_preview(contents, syntax, opts, ...) + end + + end +} + diff --git a/lua/plugins/nvim-surround.lua b/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..7662684 --- /dev/null +++ b/lua/plugins/nvim-surround.lua @@ -0,0 +1,9 @@ +-- Add, Change, Delete Surrounding Chars (["''"]) +return { + -- https://github.com/kylechui/nvim-surround + 'kylechui/nvim-surround', + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + opts = {} +} + diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..49f497d --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,25 @@ +-- File Explorer / Tree +return { + -- https://github.com/nvim-tree/nvim-tree.lua + 'nvim-tree/nvim-tree.lua', + dependencies = { + -- https://github.com/nvim-tree/nvim-web-devicons + 'nvim-tree/nvim-web-devicons', -- Fancy icon support + }, + opts = { + actions = { + open_file = { + window_picker = { + enable = false + }, + } + }, + }, + config = function (_, opts) + -- Recommended settings to disable default netrw file explorer + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + require("nvim-tree").setup(opts) + end +} + diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..a1ab832 --- /dev/null +++ b/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,26 @@ +-- Code Tree Support / Syntax Highlighting +return { + -- https://github.com/nvim-treesitter/nvim-treesitter + 'nvim-treesitter/nvim-treesitter', + event = 'VeryLazy', + dependencies = { + -- https://github.com/nvim-treesitter/nvim-treesitter-textobjects + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ':TSUpdate', + opts = { + highlight = { + enable = true, + }, + indent = { enable = true }, + auto_install = true, -- automatically install syntax support when entering new file type buffer + ensure_installed = { + 'lua', + }, + }, + config = function (_, opts) + local configs = require("nvim-treesitter.configs") + configs.setup(opts) + end +} + diff --git a/lua/plugins/quickfixdd.lua b/lua/plugins/quickfixdd.lua new file mode 100644 index 0000000..35cc229 --- /dev/null +++ b/lua/plugins/quickfixdd.lua @@ -0,0 +1,6 @@ +-- Adds delete functionality to quickfix list (keymap dd) +return { + -- https://github.com/TamaMcGlinn/quickfixdd + 'TamaMcGlinn/quickfixdd', + event = 'VeryLazy' +} diff --git a/lua/plugins/telescope-nvim.lua b/lua/plugins/telescope-nvim.lua new file mode 100644 index 0000000..6156f62 --- /dev/null +++ b/lua/plugins/telescope-nvim.lua @@ -0,0 +1,32 @@ +-- Fuzzy finder +return { + -- https://github.com/nvim-telescope/telescope.nvim + 'nvim-telescope/telescope.nvim', + lazy = true, + dependencies = { + -- https://github.com/nvim-lua/plenary.nvim + { 'nvim-lua/plenary.nvim' }, + { + -- https://github.com/nvim-telescope/telescope-fzf-native.nvim + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, + opts = { + defaults = { + layout_config = { + vertical = { + width = 0.75 + } + }, + path_display = { + filename_first = { + reverse_directories = true + } + }, + } + } +} diff --git a/lua/plugins/vim-commentary.lua b/lua/plugins/vim-commentary.lua new file mode 100644 index 0000000..0d16b00 --- /dev/null +++ b/lua/plugins/vim-commentary.lua @@ -0,0 +1,8 @@ +-- Comment/Uncomment Lines of Code +return { + -- https://github.com/tpope/vim-commentary + 'tpope/vim-commentary', + event = 'VeryLazy', +} + + diff --git a/lua/plugins/vim-isort.lua b/lua/plugins/vim-isort.lua new file mode 100644 index 0000000..abee3d0 --- /dev/null +++ b/lua/plugins/vim-isort.lua @@ -0,0 +1,17 @@ +return { + -- https://github.com/fisadev/vim-isort + 'fisadev/vim-isort', + ft = 'python', + config = function() + -- Disable default key binding + vim.g.vim_isort_map = '' + + -- Automatically format file buffer when saving + vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = "*.py", + callback = function() + vim.cmd("Isort") + end, + }) + end +} diff --git a/lua/plugins/vim-maximizer.lua b/lua/plugins/vim-maximizer.lua new file mode 100644 index 0000000..cc24e6c --- /dev/null +++ b/lua/plugins/vim-maximizer.lua @@ -0,0 +1,7 @@ +-- Maximize and Restore Current Window +return { + -- https://github.com/szw/vim-maximizer + 'szw/vim-maximizer', + event = 'VeryLazy', +} + diff --git a/lua/plugins/vim-rest-console.lua b/lua/plugins/vim-rest-console.lua new file mode 100644 index 0000000..685ebbc --- /dev/null +++ b/lua/plugins/vim-rest-console.lua @@ -0,0 +1,19 @@ +-- REST Client +return { + -- https://github.com/diepm/vim-rest-console + 'diepm/vim-rest-console', + event = 'VeryLazy', + config = function () + -- Turn off the default key binding + vim.g.vrc_set_default_mapping = 0 + -- Set the default response content type to JSON + vim.g.vrc_response_default_content_type = 'application/json' + -- Set the output buffer name (.json extension to utilize syntax hilighting) + vim.g.vrc_output_buffer_name = '_OUTPUT.json' + -- Run a format command on the response buffer + vim.g.vrc_auto_format_response_patterns = { + json = 'jq', + } + end +} + diff --git a/lua/plugins/vim-tmux-navigator.lua b/lua/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..beabb97 --- /dev/null +++ b/lua/plugins/vim-tmux-navigator.lua @@ -0,0 +1,12 @@ +-- Navigate nvim and tmux windows/panels with vim bindings +return { + -- https://github.com/christoomey/vim-tmux-navigator + 'christoomey/vim-tmux-navigator', + -- Only load this plugin if tmux is being used + event = function() + if vim.fn.exists("$TMUX") == 1 then + return "VeryLazy" + end + end, +} + diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file