diff --git a/README.md b/README.md new file mode 100644 index 0000000..dc0deaa --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +**This repo is supposed to used as config by NvChad users!** + +- The main nvchad repo (NvChad/NvChad) is used as a plugin by this repo. +- So you just import its modules , like `require "nvchad.options" , require "nvchad.mappings"` +- So you can delete the .git from this repo ( when you clone it locally ) or fork it :) + +# Credits + +1) Lazyvim starter https://github.com/LazyVim/starter as nvchad's starter was inspired by Lazyvim's . It made a lot of things easier! diff --git a/init.lua b/init.lua index 1152335..9400ef8 100644 --- a/init.lua +++ b/init.lua @@ -4,7 +4,7 @@ vim.g.mapleader = " " -- bootstrap lazy and all plugins local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then +if not vim.uv.fs_stat(lazypath) then local repo = "https://github.com/folke/lazy.nvim.git" vim.fn.system { "git", "clone", "--filter=blob:none", repo, "--branch=stable", lazypath } end @@ -20,9 +20,6 @@ require("lazy").setup({ lazy = false, branch = "v2.5", import = "nvchad.plugins", - config = function() - require "options" - end, }, { import = "plugins" }, @@ -32,6 +29,7 @@ require("lazy").setup({ dofile(vim.g.base46_cache .. "defaults") dofile(vim.g.base46_cache .. "statusline") +require "options" require "nvchad.autocmds" vim.schedule(function() diff --git a/lazy-lock.json b/lazy-lock.json index 6154a9c..956d6fd 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,39 +1,37 @@ { - "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, - "NvChad": { "branch": "v2.5", "commit": "fea5d02d2d07b148243c058d1b8b775f9cccac5e" }, - "base46": { "branch": "v2.5", "commit": "4f4a9d205ccef5785ca1d0ad875752478b8ef2a4" }, - "better-escape.nvim": { "branch": "master", "commit": "d337e02b140d909345441392de47a42d283747c1" }, + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "NvChad": { "branch": "v2.5", "commit": "b83a949d9e883b6ab98070f224535f1018174a5d" }, + "base46": { "branch": "v2.5", "commit": "d5a768e9a8849a36c6cfc0c7134b05cb7584c7af" }, + "better-escape.nvim": { "branch": "master", "commit": "bb197e51a91a635deb88630813c3bfc284413697" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "conform.nvim": { "branch": "master", "commit": "4e97712607bfdcadc097823339599e5bf05f97f9" }, - "crates.nvim": { "branch": "main", "commit": "d65ad2e7450a71e600216ad736a4732f38ac14e5" }, - "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" }, + "conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" }, + "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, + "friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, "html5.vim": { "branch": "master", "commit": "485f2cd62162c81e56d8604b4c630f0b5ef69d1f" }, - "indent-blankline.nvim": { "branch": "master", "commit": "dddb5d21811c319eb6e51a993d8fb44b193aae3f" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" }, + "indent-blankline.nvim": { "branch": "master", "commit": "2e57e1bbda970317dce4b7878ccf9a831dc7067d" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "nvim-autopairs": { "branch": "master", "commit": "48ca9aaee733911424646cb1605f27bc01dedbe3" }, + "menu": { "branch": "main", "commit": "205b3de60bbd1dfa73fd12b04530743cd0e70b22" }, + "minty": { "branch": "main", "commit": "8809b2c7c2edbeb3fa9c3b05bd2e89934d54f526" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "194ec600488f7c7229668d0e80bd197f3a2b84ff" }, - "nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" }, - "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, - "nvim-lspconfig": { "branch": "master", "commit": "a89de2e049b5f89a0ee55029d5a31213bd4de6f8" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" }, - "nvim-treesitter": { "branch": "master", "commit": "59cc5f35656f97bc964229e3ec5066a7b5a8ee5b" }, - "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, - "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "nvim-lspconfig": { "branch": "master", "commit": "3f9fe72100b5f8ca8da00e54ab70707647c822b3" }, + "nvim-tree.lua": { "branch": "master", "commit": "c9104a5d079db5a158c9562c54689df27d52dccc" }, + "nvim-treesitter": { "branch": "master", "commit": "45386764cc9535200d2288cab929c5093d33660e" }, + "nvim-web-devicons": { "branch": "master", "commit": "6b53401918a9033a41159d012160c5fb5eb249ae" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, - "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, - "ui": { "branch": "v2.5", "commit": "6783a3ab3d9bf22859234dd2196888da1d0f0426" }, + "telescope.nvim": { "branch": "master", "commit": "eae0d8fbde590b0eaa2f9481948cd6fd7dd21656" }, + "ui": { "branch": "v3.0", "commit": "25868b16b64cb842a28dd9ae002fa6858284bef8" }, "vim-javascript": { "branch": "master", "commit": "c470ce1399a544fe587eab950f571c83cccfbbdc" }, "vim-svelte": { "branch": "main", "commit": "0e93ec53c3667753237282926fec626785622c1c" }, - "vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" }, - "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }, + "vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" }, + "volt": { "branch": "main", "commit": "ce1e55d52d86e33f340a20b45701b434cc684c15" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }, "zoxide.vim": { "branch": "master", "commit": "b1e70b6fc1682a83929aee63680d2b43456fe9a5" } } diff --git a/lua-old/chadrc.lua b/lua-old/chadrc.lua new file mode 100644 index 0000000..ab0a7ae --- /dev/null +++ b/lua-old/chadrc.lua @@ -0,0 +1,36 @@ +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua + +---@type ChadrcConfig +local M = {} + +M.ui = { + theme = "gruvbox", + theme_toggle = { "gruvbox", "everforest_light" }, + + nvdash = { + load_on_startup = true, + } + + -- hl_override = { + -- Comment = { italic = true }, + -- ["@comment"] = { italic = true }, + -- }, +} + +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/lua-old/configs/conform.lua b/lua-old/configs/conform.lua new file mode 100644 index 0000000..a000447 --- /dev/null +++ b/lua-old/configs/conform.lua @@ -0,0 +1,15 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + -- css = { "prettier" }, + -- html = { "prettier" }, + }, + + -- format_on_save = { + -- -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +require("conform").setup(options) diff --git a/lua-old/configs/lazy.lua b/lua-old/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua-old/configs/lazy.lua @@ -0,0 +1,47 @@ +return { + defaults = { lazy = true }, + install = { colorscheme = { "nvchad" } }, + + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +} diff --git a/lua-old/configs/lspconfig.lua b/lua-old/configs/lspconfig.lua new file mode 100644 index 0000000..32797b1 --- /dev/null +++ b/lua-old/configs/lspconfig.lua @@ -0,0 +1,47 @@ +-- EXAMPLE +local on_attach = require("nvchad.configs.lspconfig").on_attach +local on_init = require("nvchad.configs.lspconfig").on_init +local capabilities = require("nvchad.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" +local servers = { "html", "cssls", "tsserver", "clangd" } + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, + } +end + +lspconfig.svelte.setup {} + +lspconfig.clangd.setup { + on_attach = function (client, bufnr) + client.server_capabilities.signatureHelpProvider = false + on_attach(client, bufnr) + end, + capabilities = capabilities, +} + +lspconfig.rust_analyzer.setup({ + on_attach = on_attach, + capabilities = capabilities, + filetypes = {"rust"}, + -- root_dir = util.root_pattern("Cargo.toml"), + settings = { + ['rust_analyzer'] = { + cargo = { + allFeatures = true, + }, + }, + }, +}) + +-- typescript +lspconfig.tsserver.setup { + on_attach = on_attach, + on_init = on_init, + capabilities = capabilities, +} diff --git a/lua/configs/null-ls.lua b/lua-old/configs/null-ls.lua similarity index 100% rename from lua/configs/null-ls.lua rename to lua-old/configs/null-ls.lua diff --git a/lua-old/mappings.lua b/lua-old/mappings.lua new file mode 100644 index 0000000..8fe9dcc --- /dev/null +++ b/lua-old/mappings.lua @@ -0,0 +1,15 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +map("n", "", "TmuxNavigateLeft", { desc = "window left" }) +map("n", "", "TmuxNavigateRight", { desc = "window up" }) +map("n", "", "TmuxNavigateDown", { desc = "window up" }) +map("n", "", "TmuxNavigateUp", { desc = "window up" }) + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/lua-old/options.lua b/lua-old/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/lua-old/options.lua @@ -0,0 +1,6 @@ +require "nvchad.options" + +-- add yours here! + +-- local o = vim.o +-- o.cursorlineopt ='both' -- to enable cursorline! diff --git a/lua-old/plugins/init.lua b/lua-old/plugins/init.lua new file mode 100644 index 0000000..be99615 --- /dev/null +++ b/lua-old/plugins/init.lua @@ -0,0 +1,164 @@ +return { + { + "christoomey/vim-tmux-navigator", + lazy = false, + }, + + { + "stevearc/conform.nvim", + -- event = 'BufWritePre', -- uncomment for format on save + config = function() + require "configs.conform" + end, + }, + + { + "neovim/nvim-lspconfig", + config = function() + require("nvchad.configs.lspconfig").defaults() + require "configs.lspconfig" + end, + }, + + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + -- lua + "lua-language-server", + "stylua", + + -- web dev + "html-lsp", + "css-lsp", + "prettier", + "typescript-language-server", + "deno", + + -- rusty rust + "rust-analyzer", + + -- c/c++ + "clangd", + "clang-format", + "codelldb", + }, + }, + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + "javascript", + "typescript", + "tsx", + "c", + "markdown", + "markdown_inline", + }, + indent = { + enable = true, + }, + }, + }, + + { "nvim-neotest/nvim-nio" }, + + { + "rcarriga/nvim-dap-ui", + event = "VeryLazy", + dependencies = "mfussenegger/nvim-dap", + config = function() + local dap = require("dap") + local dapui = require("dapui") + dapui.setup() + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.after.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.after.event_exited["dapui_config"] = function() + dapui.close() + end + end + }, + + { + "jay-babu/mason-nvim-dap.nvim", + event = "VeryLazy", + dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", + }, + opts = { + handlers = {} + }, + }, + + { + "mfussenegger/nvim-dap", + config = function(_, _) + -- require("core.utils").load_mappings("dap") + end + }, + + { + "rust-lang/rust.vim", + ft = "rust", + init = function () + vim.g.rustfmt_autosave = 1 + end + }, + + { + "saecki/crates.nvim", + ft = {"rust", "toml"}, + config = function(_, opts) + local crates = require('crates') + crates.setup(opts) + crates.show() + end, + }, + + -- { + -- "hrsh7th/nvim-cmp", + -- opts = function() + -- local M = require "plugins.configs.cmp" + -- table.insert(M.sources, {name = "crates"}) + -- return M + -- end, + -- }, + + { + "nanotee/zoxide.vim", + lazy = false, + }, + + { + "othree/html5.vim", + }, + + { + "pangloss/vim-javascript", + }, + + { + "evanleck/vim-svelte", + }, + + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup() + end, + }, + +} diff --git a/lua/chadrc.lua b/lua/chadrc.lua index ab0a7ae..123baad 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -1,16 +1,12 @@ --- This file needs to have same structure as nvconfig.lua --- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvconfig.lua +-- This file needs to have same structure as nvconfig.lua +-- https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua +-- Please read that file to know all available options :( ---@type ChadrcConfig local M = {} -M.ui = { +M.base46 = { theme = "gruvbox", - theme_toggle = { "gruvbox", "everforest_light" }, - - nvdash = { - load_on_startup = true, - } -- hl_override = { -- Comment = { italic = true }, @@ -18,19 +14,4 @@ M.ui = { -- }, } -M.nvimtree = { - git = { - enable = true, - }, - - renderer = { - highlight_git = true, - icons = { - show = { - git = true, - }, - }, - }, -} - return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index a000447..35ba6cf 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -12,4 +12,4 @@ local options = { -- }, } -require("conform").setup(options) +return options diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 32797b1..c1cf46f 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -1,17 +1,18 @@ --- EXAMPLE -local on_attach = require("nvchad.configs.lspconfig").on_attach -local on_init = require("nvchad.configs.lspconfig").on_init -local capabilities = require("nvchad.configs.lspconfig").capabilities +-- load defaults i.e lua_lsp +require("nvchad.configs.lspconfig").defaults() local lspconfig = require "lspconfig" -local servers = { "html", "cssls", "tsserver", "clangd" } + +-- EXAMPLE +local servers = { "html", "cssls" } +local nvlsp = require "nvchad.configs.lspconfig" -- lsps with default config for _, lsp in ipairs(servers) do lspconfig[lsp].setup { - on_attach = on_attach, - on_init = on_init, - capabilities = capabilities, + on_attach = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, } end @@ -39,9 +40,9 @@ lspconfig.rust_analyzer.setup({ }, }) --- typescript -lspconfig.tsserver.setup { - on_attach = on_attach, - on_init = on_init, - capabilities = capabilities, -} +-- configuring single server, example: typescript + lspconfig.ts_ls.setup { + on_attach = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + } diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index be99615..063d579 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -6,110 +6,36 @@ return { { "stevearc/conform.nvim", - -- event = 'BufWritePre', -- uncomment for format on save - config = function() - require "configs.conform" - end, + event = 'BufWritePre', -- uncomment for format on save + opts = require "configs.conform", }, + -- These are some examples, uncomment them if you want to see them work! { "neovim/nvim-lspconfig", config = function() - require("nvchad.configs.lspconfig").defaults() require "configs.lspconfig" end, }, - { - "williamboman/mason.nvim", - opts = { - ensure_installed = { - -- lua - "lua-language-server", - "stylua", - - -- web dev - "html-lsp", - "css-lsp", - "prettier", - "typescript-language-server", - "deno", - - -- rusty rust - "rust-analyzer", - - -- c/c++ - "clangd", - "clang-format", - "codelldb", - }, - }, - }, - { "nvim-treesitter/nvim-treesitter", - opts = { - ensure_installed = { - "vim", - "lua", - "vimdoc", - "html", - "css", - "javascript", - "typescript", - "tsx", - "c", - "markdown", - "markdown_inline", - }, - indent = { - enable = true, - }, - }, - }, - - { "nvim-neotest/nvim-nio" }, - - { - "rcarriga/nvim-dap-ui", - event = "VeryLazy", - dependencies = "mfussenegger/nvim-dap", - config = function() - local dap = require("dap") - local dapui = require("dapui") - dapui.setup() - dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() - end - dap.listeners.after.event_terminated["dapui_config"] = function() - dapui.close() - end - dap.listeners.after.event_exited["dapui_config"] = function() - dapui.close() - end - end - }, - - { - "jay-babu/mason-nvim-dap.nvim", - event = "VeryLazy", - dependencies = { - "williamboman/mason.nvim", - "mfussenegger/nvim-dap", + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + "javascript", + "typescript", + "c", + "markdown", + }, + }, }, - opts = { - handlers = {} - }, - }, - { - "mfussenegger/nvim-dap", - config = function(_, _) - -- require("core.utils").load_mappings("dap") - end - }, - - { + { "rust-lang/rust.vim", ft = "rust", init = function () @@ -127,16 +53,7 @@ return { end, }, - -- { - -- "hrsh7th/nvim-cmp", - -- opts = function() - -- local M = require "plugins.configs.cmp" - -- table.insert(M.sources, {name = "crates"}) - -- return M - -- end, - -- }, - - { + { "nanotee/zoxide.vim", lazy = false, }, @@ -160,5 +77,4 @@ return { require("better_escape").setup() end, }, - }