From 60a9df620d5d354a14c1cfa59a638f57d65ec632 Mon Sep 17 00:00:00 2001 From: James Chung Date: Sat, 18 May 2024 18:43:31 -0500 Subject: [PATCH] inital commit --- .gitignore | 8 ++ .neoconf.json | 15 +++ LICENSE | 201 +++++++++++++++++++++++++++++++++++++ README.md | 15 +++ init.lua | 2 + lazy-lock.json | 53 ++++++++++ lazyvim.json | 9 ++ lua/config/autocmds.lua | 63 ++++++++++++ lua/config/keymaps.lua | 28 ++++++ lua/config/lazy.lua | 48 +++++++++ lua/config/options.lua | 23 +++++ lua/plugins/colortheme.lua | 18 ++++ lua/plugins/git.lua | 4 + lua/plugins/lspconfig.lua | 159 +++++++++++++++++++++++++++++ lua/plugins/mason.lua | 43 ++++++++ lua/plugins/neodev.lua | 3 + lua/plugins/neotree.lua | 64 ++++++++++++ lua/plugins/noice.lua | 15 +++ lua/plugins/toggleterm.lua | 10 ++ lua/plugins/treesitter.lua | 43 ++++++++ stylua.toml | 3 + 21 files changed, 827 insertions(+) create mode 100644 .gitignore create mode 100644 .neoconf.json create mode 100644 LICENSE create mode 100644 README.md create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lazyvim.json create mode 100644 lua/config/autocmds.lua create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/options.lua create mode 100644 lua/plugins/colortheme.lua create mode 100644 lua/plugins/git.lua create mode 100644 lua/plugins/lspconfig.lua create mode 100644 lua/plugins/mason.lua create mode 100644 lua/plugins/neodev.lua create mode 100644 lua/plugins/neotree.lua create mode 100644 lua/plugins/noice.lua create mode 100644 lua/plugins/toggleterm.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 stylua.toml 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..575a99b --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# nvim-config + +## Installation + +> SSH Installation + +``` +git clone git@github.com:JamesChung/nvim-config.git ~/.config/nvim +``` + +> HTTPS Installation + +``` +git clone https://github.com/JamesChung/nvim-config.git ~/.config/nvim +``` diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..bb2bc5e --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,53 @@ +{ + "LazyVim": { "branch": "main", "commit": "b0128b60bffd0d6a97ddd99af6179ebcd8a5096f" }, + "LuaSnip": { "branch": "master", "commit": "de1a287c9cb525ae52bc846e8f6207e5ef1da5ac" }, + "bufferline.nvim": { "branch": "main", "commit": "73540cb95f8d95aa1af3ed57713c6720c78af915" }, + "catppuccin": { "branch": "main", "commit": "d97387aea8264f484bb5d5e74f2182a06c83e0d8" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "conform.nvim": { "branch": "master", "commit": "00f9d91391b04b1935e2f15948bd96cc111e7d3a" }, + "dashboard-nvim": { "branch": "master", "commit": "5182c09ac8085dc73b78ad0ea9f5479c9a866fc4" }, + "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, + "flash.nvim": { "branch": "main", "commit": "11a2e667d19d8f48c93c6ed2e2e525ac6b1b79be" }, + "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, + "git-blame.nvim": { "branch": "master", "commit": "fb84fad97cd4b51caee3c865e8a33a0d413b77a8" }, + "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, + "image.nvim": { "branch": "master", "commit": "da64ce69598875c9af028afe129f916b02ccc42e" }, + "indent-blankline.nvim": { "branch": "master", "commit": "ece00d5fb44d196680a81fd2761062d2fa44663b" }, + "lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "f12d50716e8e59ea9f5cf484eac6968c33a95917" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, + "mason.nvim": { "branch": "main", "commit": "49ff59aded1047a773670651cfa40e76e63c6377" }, + "mini.ai": { "branch": "main", "commit": "a0262e61f79dfc7bb940d1719c00b0ede042ddd7" }, + "mini.pairs": { "branch": "main", "commit": "5c975d8f68dc1e11bf4b20ced71e7987ed782513" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "7aad1bf3f6b849cbf108e02c55ad4d701cb4d33a" }, + "neoconf.nvim": { "branch": "main", "commit": "0065de89c834e1090a847a9aa126af5dce1db4dc" }, + "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "noice.nvim": { "branch": "main", "commit": "9f6f6ba74f8bfbf7e43d6302cf86b070362f6203" }, + "nui.nvim": { "branch": "main", "commit": "b1b3dcd6ed8f355c78bad3d395ff645be5f8b6ae" }, + "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, + "nvim-lint": { "branch": "master", "commit": "1f98d6c863f91706369d74aeb2eb3f02b2e96861" }, + "nvim-lspconfig": { "branch": "master", "commit": "6d2ae9fdc3111a6e8fd5db2467aca11737195a30" }, + "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, + "nvim-snippets": { "branch": "main", "commit": "f394d17b9a83820714957a06c6ed8e12223f3034" }, + "nvim-spectre": { "branch": "master", "commit": "50e96602153f14c913e1969aaf9720e080394eb3" }, + "nvim-treesitter": { "branch": "master", "commit": "1eabe69bfa8f78e14fcf5d42a2b3881babaca30a" }, + "nvim-treesitter-context": { "branch": "master", "commit": "55e29081e73d2e4b2d62fb4dc3eebe21bf66a1e2" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "5f9bf4b1ead7707e4e74e5319ee56bdc81fb73db" }, + "nvim-ts-autotag": { "branch": "main", "commit": "aeb7090098722ffce16597bd0331105495640153" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bdccb9c67a42a5e2d99384dc9bfa29b1451528f" }, + "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, + "persistence.nvim": { "branch": "main", "commit": "5fe077056c821aab41f87650bd6e1c48cd7dd047" }, + "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, + "rose-pine": { "branch": "main", "commit": "b6fe88c3282cf9f117a3e836d761c2d78d02f417" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, + "telescope.nvim": { "branch": "master", "commit": "0c12735d5aff6a48ffd8111bf144dc2ff44e5975" }, + "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, + "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, + "tokyonight.nvim": { "branch": "main", "commit": "634015fff1457ed66cf5364213a2bbbc51a82d6c" }, + "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, + "vim-fugitive": { "branch": "master", "commit": "5a9bd42dd8dd127779f3cd8982a0419b7ca9c7f5" }, + "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } +} \ No newline at end of file diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 0000000..e92adda --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "4944" + }, + "version": 4 +} \ No newline at end of file diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua new file mode 100644 index 0000000..d6cfd3b --- /dev/null +++ b/lua/config/autocmds.lua @@ -0,0 +1,63 @@ +-- 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 + +-- Use LspAttach autocommand to only map the following keys +-- after the language server attaches to the current buffer +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf } + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) + vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + vim.keymap.set("n", "", vim.lsp.buf.signature_help, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set("n", "f", function() + vim.lsp.buf.format({ async = true }) + end, opts) + end, +}) + +-- Allow LSP context highlighting on cursor +vim.api.nvim_create_augroup("CursorHighlightGroup", {}) +vim.api.nvim_create_autocmd("CursorHold", { + group = "CursorHighlightGroup", + command = "silent! lua vim.lsp.buf.document_highlight()", + desc = "Highlight symbol under cursor on CursorHold", +}) +vim.api.nvim_create_autocmd("CursorHoldI", { + group = "CursorHighlightGroup", + command = "silent! lua vim.lsp.buf.document_highlight()", + desc = "Highlight symbol under cursor on CursorHoldI", +}) +vim.api.nvim_create_autocmd("CursorMoved", { + group = "CursorHighlightGroup", + command = "silent! lua vim.lsp.buf.clear_references()", + desc = "Clear highlight references on CursorMoved", +}) +vim.api.nvim_create_autocmd("CursorMovedI", { + group = "CursorHighlightGroup", + command = "silent! lua vim.lsp.buf.clear_references()", + desc = "Clear highlight references on CursorMovedI", +}) + +-- Disable NetRW +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +-- Use NetRW command for Neotree +vim.api.nvim_create_user_command("E", "Neotree", {}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..5f75fa2 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,28 @@ +-- 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 + +-- Move lines up/down +vim.api.nvim_set_keymap("n", "", ":m .+1==", { noremap = true }) +vim.api.nvim_set_keymap("n", "", ":m .-2==", { noremap = true }) +vim.api.nvim_set_keymap("i", "", ":m .+1==gi", { noremap = true }) +vim.api.nvim_set_keymap("i", "", ":m .-2==gi", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":m '>+1gv=gv", { noremap = true }) +vim.api.nvim_set_keymap("v", "", ":m '<-2gv=gv", { noremap = true }) + +-- Move lines up/down for Mac +vim.api.nvim_set_keymap("n", "∆", ":m .+1==", { noremap = true }) +vim.api.nvim_set_keymap("n", "˚", ":m .-2==", { noremap = true }) +vim.api.nvim_set_keymap("i", "∆", ":m .+1==gi", { noremap = true }) +vim.api.nvim_set_keymap("i", "˚", ":m .-2==gi", { noremap = true }) +vim.api.nvim_set_keymap("v", "∆", ":m '>+1gv=gv", { noremap = true }) +vim.api.nvim_set_keymap("v", "˚", ":m '<-2gv=gv", { noremap = true }) + +-- Remap space to be leader rather than the default backslash key +vim.api.nvim_set_keymap("n", "", "", { noremap = true }) + +-- Set folke/trouble.nvim toggle keybinding +vim.api.nvim_set_keymap("n", "tt", "TroubleToggle", { noremap = true, silent = true }) + +-- Set williamboman/mason.nvim open/close toggle +vim.api.nvim_set_keymap("n", "ma", "Mason", { noremap = true, silent = true }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..e919af4 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,48 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not (vim.uv or vim.loop).fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", + lazypath }) +end +vim.opt.rtp:prepend(vim.env.LAZY or lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import any extras modules here + -- { import = "lazyvim.plugins.extras.lang.typescript" }, + -- { import = "lazyvim.plugins.extras.lang.json" }, + -- { import = "lazyvim.plugins.extras.ui.mini-animate" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..4b91f32 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,23 @@ +-- 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 + +-- Options +vim.opt.number = true -- Show line numbers +vim.opt.relativenumber = true -- Relative line numbers +vim.opt.expandtab = true -- Use spaces instead of tabs +vim.opt.tabstop = 4 -- Set tab width to 4 spaces +vim.opt.softtabstop = 4 -- Set soft tabstop to 4 spaces +vim.opt.shiftwidth = 4 -- Set indentation width to 4 spaces +vim.opt.incsearch = true +vim.opt.wildmode = { "longest", "list" } +vim.opt.scrolloff = 10 + +-- Colors +vim.opt.termguicolors = true + +-- List Chars +vim.opt.list = true +vim.opt.listchars:append("trail:⋅") +vim.opt.listchars:append("nbsp:⎵") +vim.opt.listchars:append("tab:› ") diff --git a/lua/plugins/colortheme.lua b/lua/plugins/colortheme.lua new file mode 100644 index 0000000..01f93b1 --- /dev/null +++ b/lua/plugins/colortheme.lua @@ -0,0 +1,18 @@ +return { + { + "rose-pine/neovim", + name = "rose-pine", + opts = { + variant = "moon", + highlight_groups = { + FloatBorder = { bg = "iris", blend = 10 }, + }, + }, + }, + { + "LazyVim/LazyVim", + opts = { + colorscheme = "rose-pine", + }, + }, +} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..8a798af --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,4 @@ +return { + { "f-person/git-blame.nvim" }, + { "tpope/vim-fugitive" }, +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..7565a7b --- /dev/null +++ b/lua/plugins/lspconfig.lua @@ -0,0 +1,159 @@ +return { + { + "neovim/nvim-lspconfig", + dependencies = { + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "VonHeikemen/lsp-zero.nvim", + "L3MON4D3/LuaSnip", + }, + config = function() + local lsp_zero = require("lsp-zero").preset({ + float_border = "rounded", + }) + + -- For mason-lspconfig + lsp_zero.extend_lspconfig() + + lsp_zero.on_attach(function(client, bufnr) + lsp_zero.buffer_autoformat() + end) + + lsp_zero.set_sign_icons({ + -- icons / text used for a diagnostic + error = "✘", + warn = "▲", + hint = "⚑", + info = "»", + }) + + local lspconfig = require("lspconfig") + local lsputil = require("lspconfig/util") + local capabilities = require("cmp_nvim_lsp").default_capabilities() + + lspconfig.astro.setup({ + capabilities = capabilities, + }) + lspconfig.bashls.setup({ + capabilities = capabilities, + }) + lspconfig.biome.setup({ + capabilities = capabilities, + }) + lspconfig.bufls.setup({ + capabilities = capabilities, + }) + lspconfig.clangd.setup({ + capabilities = capabilities, + filetypes = { "c", "cpp", "objc", "objcpp", "cuda" }, + }) + lspconfig.docker_compose_language_service.setup({ + capabilities = capabilities, + }) + lspconfig.dockerls.setup({ + capabilities = capabilities, + }) + lspconfig.dotls.setup({ + capabilities = capabilities, + }) + lspconfig.gopls.setup({ + capabilities = capabilities, + cmd = { "gopls", "serve" }, + filetypes = { "go", "gomod", "gowork", "gotmpl" }, + root_dir = lsputil.root_pattern("go.work", "go.mod", ".git"), + settings = { + gopls = { + analyses = { + unusedparams = true, + }, + staticcheck = true, + }, + }, + on_attach = function(client, bufnr) + vim.o.expandtab = false + -- Organize imports on save using logic of goimports + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + vim.lsp.buf.code_action({ + context = { + only = { "source.organizeImports" }, + }, + apply = true, + }) + end, + }) + end, + }) + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + }) + lspconfig.pyright.setup({ + capabilities = capabilities, + }) + lspconfig.rust_analyzer.setup({ + capabilities = capabilities, + }) + lspconfig.terraformls.setup({ + capabilities = capabilities, + }) + lspconfig.tsserver.setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + client.server_capabilities.documentFormattingProvider = false + end, + }) + lspconfig.vimls.setup({ + capabilities = capabilities, + }) + lspconfig.yamlls.setup({ + capabilities = capabilities, + }) + lspconfig.zls.setup({ + capabilities = capabilities, + }) + + local cmp = require("cmp") + -- local cmp_action = lsp.cmp_action() + + cmp.setup({ + completion = { + autocomplete = false, + }, + mapping = { + -- `Tab` key to confirm completion + [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp_action.tab_complete(), + -- [""] = cmp_action.select_prev_or_fallback(), + + -- Ctrl+Space to trigger completion menu + [""] = cmp.mapping.complete(), + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + }) + end, + }, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..bbca75d --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,43 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + end, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { + "VonHeikemen/lsp-zero.nvim", + }, + config = function() + local lsp_zero = require("lsp-zero") + require("mason-lspconfig").setup({ + ensure_installed = { + "bashls", + "clangd", + "docker_compose_language_service", + "dockerls", + "dotls", + "html", + "lua_ls", + "pyright", + "tsserver", + "vimls", + "yamlls", + }, + handlers = { + lsp_zero.default_setup, + }, + }) + end, + }, +} diff --git a/lua/plugins/neodev.lua b/lua/plugins/neodev.lua new file mode 100644 index 0000000..728d5d3 --- /dev/null +++ b/lua/plugins/neodev.lua @@ -0,0 +1,3 @@ +return { + { "folke/neodev.nvim", opts = {} }, +} diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua new file mode 100644 index 0000000..afd12e2 --- /dev/null +++ b/lua/plugins/neotree.lua @@ -0,0 +1,64 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + "3rd/image.nvim", -- image support in preview window: See `# Preview Mode` for more information + }, + config = function() + require("neo-tree").setup({ + enable_git_status = true, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "✚", -- this is redundant info if you use git_status_colors on the name + modified = "", -- this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + }, + }, + filesystem = { + filtered_items = { + visible = true, + }, + }, + window = { + mappings = { + ["%"] = "add", + ["D"] = "delete", + ["R"] = "rename", + ["a"] = false, + ["d"] = "add_directory", + ["r"] = "refresh", + }, + }, + }) + end, + }, +} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..72bdc37 --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,15 @@ +return { + { + "folke/noice.nvim", + config = { + lsp = { + hover = { + enabled = false, + }, + signature = { + enabled = false, + }, + }, + }, + }, +} diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..01bd30f --- /dev/null +++ b/lua/plugins/toggleterm.lua @@ -0,0 +1,10 @@ +return { + { + "akinsho/toggleterm.nvim", + version = "*", + opts = { + open_mapping = { [[]], [[]] }, + direction = "float", + }, + }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..ce796e1 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,43 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = { + highlight = { enable = true }, + indent = { enable = true }, + ensure_installed = { + "bash", + "c", + "cpp", + "diff", + "go", + "hcl", + "html", + "java", + "javascript", + "jsdoc", + "json", + "jsonc", + "lua", + "luadoc", + "luap", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "rust", + "sql", + "terraform", + "toml", + "tsx", + "typescript", + "vim", + "vimdoc", + "xml", + "yaml", + "zig", + }, + }, + }, + { "nvim-treesitter/nvim-treesitter-context" }, +} 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