From c3f3c33668831a7485996a028da82dd04b3d43c4 Mon Sep 17 00:00:00 2001 From: blahai Date: Thu, 19 Dec 2024 23:53:34 +0200 Subject: [PATCH] ... --- .stylua.toml | 6 ++++ LICENSE | 24 ++++++++++++++++ README.md | 9 ++++++ init.lua | 37 +++++++++++++++++++++++++ lazy-lock.json | 29 +++++++++++++++++++ lua/chadrc.lua | 23 ++++++++++++++++ lua/configs/conform.lua | 15 ++++++++++ lua/configs/lazy.lua | 47 +++++++++++++++++++++++++++++++ lua/configs/lspconfig.lua | 24 ++++++++++++++++ lua/lua/chadrc.lua | 23 ++++++++++++++++ lua/lua/configs/conform.lua | 18 ++++++++++++ lua/lua/configs/lazy.lua | 47 +++++++++++++++++++++++++++++++ lua/lua/configs/lspconfig.lua | 30 ++++++++++++++++++++ lua/lua/mappings.lua | 10 +++++++ lua/lua/options.lua | 6 ++++ lua/lua/plugins/init.lua | 52 +++++++++++++++++++++++++++++++++++ lua/mappings.lua | 10 +++++++ lua/options.lua | 6 ++++ lua/plugins/init.lua | 25 +++++++++++++++++ 19 files changed, 441 insertions(+) create mode 100644 .stylua.toml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/chadrc.lua create mode 100644 lua/configs/conform.lua create mode 100644 lua/configs/lazy.lua create mode 100644 lua/configs/lspconfig.lua create mode 100644 lua/lua/chadrc.lua create mode 100644 lua/lua/configs/conform.lua create mode 100644 lua/lua/configs/lazy.lua create mode 100644 lua/lua/configs/lspconfig.lua create mode 100644 lua/lua/mappings.lua create mode 100644 lua/lua/options.lua create mode 100644 lua/lua/plugins/init.lua create mode 100644 lua/mappings.lua create mode 100644 lua/options.lua create mode 100644 lua/plugins/init.lua diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..ecb6dca --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to 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 new file mode 100644 index 0000000..0fda20c --- /dev/null +++ b/init.lua @@ -0,0 +1,37 @@ +vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" +vim.g.mapleader = " " + +-- bootstrap lazy and all plugins +local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" + +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 + +vim.opt.rtp:prepend(lazypath) + +local lazy_config = require "configs.lazy" + +-- load plugins +require("lazy").setup({ + { + "NvChad/NvChad", + lazy = false, + branch = "v2.5", + import = "nvchad.plugins", + }, + + { import = "plugins" }, +}, lazy_config) + +-- load theme +dofile(vim.g.base46_cache .. "defaults") +dofile(vim.g.base46_cache .. "statusline") + +require "options" +require "nvchad.autocmds" + +vim.schedule(function() + require "mappings" +end) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..e538782 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,29 @@ +{ + "LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" }, + "NvChad": { "branch": "v2.5", "commit": "bbc3d43db088c141b142a40cd5f717635833a54e" }, + "base46": { "branch": "v2.5", "commit": "40943fc668bf8f1caa4cc45f71c784cf0d3cc34f" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "f4e8837878fc5712d053ba3091a73d27d96a09e2" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, + "indent-blankline.nvim": { "branch": "master", "commit": "259357fa4097e232730341fa60988087d189193a" }, + "lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "menu": { "branch": "main", "commit": "657bfc91382c0928453d9a4d0a10ec92db5de2bb" }, + "minty": { "branch": "main", "commit": "6dce9f097667862537823d515a0250ce58faab05" }, + "nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" }, + "nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" }, + "nvim-lspconfig": { "branch": "master", "commit": "ae8a01bb40848490548e5d07b97ed972ed43c2f9" }, + "nvim-tree.lua": { "branch": "master", "commit": "f7b76cd1a75615c8d6254fc58bedd2a7304eb7d8" }, + "nvim-treesitter": { "branch": "master", "commit": "5cf3434c694a94fccfca79588654e57053a68572" }, + "nvim-web-devicons": { "branch": "master", "commit": "1736cb81bdc42e1ee206081a161bdb2af68fb7a1" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, + "ui": { "branch": "v3.0", "commit": "ed09fb24023a34bcf01c021737f8475905f6cf96" }, + "volt": { "branch": "main", "commit": "0cdfa1dfbbfc8fda340054915991fda188db8d8e" }, + "which-key.nvim": { "branch": "main", "commit": "8ab96b38a2530eacba5be717f52e04601eb59326" } +} diff --git a/lua/chadrc.lua b/lua/chadrc.lua new file mode 100644 index 0000000..ed25b65 --- /dev/null +++ b/lua/chadrc.lua @@ -0,0 +1,23 @@ +-- 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.base46 = { + theme = "catppuccin", + transparency = true, +} + +M.nvdash = { + load_on_startup = true, + buttons = { + { txt = " Find File", keys = "Spc f f", cmd = "Telescope find_files" }, + { txt = " Recent Files", keys = "Spc f o", cmd = "Telescope oldfiles" }, + { txt = "󰈭 Find Word", keys = "Spc f w", cmd = "Telescope live_grep" }, + { txt = "󱥚 Themes", keys = "Spc t h", cmd = ":lua require('nvchad.themes').open()" }, + { txt = " Mappings", keys = "Spc c h", cmd = "NvCheatsheet" }, + }, +} +return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua new file mode 100644 index 0000000..35ba6cf --- /dev/null +++ b/lua/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, + -- }, +} + +return options diff --git a/lua/configs/lazy.lua b/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua/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/configs/lspconfig.lua b/lua/configs/lspconfig.lua new file mode 100644 index 0000000..478df01 --- /dev/null +++ b/lua/configs/lspconfig.lua @@ -0,0 +1,24 @@ +-- load defaults i.e lua_lsp +require("nvchad.configs.lspconfig").defaults() + +local lspconfig = require "lspconfig" + +-- 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 = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + } +end + +-- 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/lua/chadrc.lua b/lua/lua/chadrc.lua new file mode 100644 index 0000000..b1ef424 --- /dev/null +++ b/lua/lua/chadrc.lua @@ -0,0 +1,23 @@ +-- 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.base46 = { + theme = "rosepine", + transparency = true, +} + +M.nvdash = { + load_on_startup = true, + buttons = { + { txt = " Find File", keys = "Spc f f", cmd = "Telescope find_files" }, + { txt = " Recent Files", keys = "Spc f o", cmd = "Telescope oldfiles" }, + { txt = "󰈭 Find Word", keys = "Spc f w", cmd = "Telescope live_grep" }, + { txt = "󱥚 Themes", keys = "Spc t h", cmd = ":lua require('nvchad.themes').open()" }, + { txt = " Mappings", keys = "Spc c h", cmd = "NvCheatsheet" }, + }, +} +return M diff --git a/lua/lua/configs/conform.lua b/lua/lua/configs/conform.lua new file mode 100644 index 0000000..3e58ce3 --- /dev/null +++ b/lua/lua/configs/conform.lua @@ -0,0 +1,18 @@ +local options = { + formatters_by_ft = { + lua = { "stylua" }, + css = { "prettier" }, + html = { "prettier" }, + c = { "clangd" }, + cpp = { "clangd" }, + + }, + + -- format_on_save = { + -- These options will be passed to conform.format() + -- timeout_ms = 500, + -- lsp_fallback = true, + -- }, +} + +return options diff --git a/lua/lua/configs/lazy.lua b/lua/lua/configs/lazy.lua new file mode 100644 index 0000000..cd170bd --- /dev/null +++ b/lua/lua/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/lua/configs/lspconfig.lua b/lua/lua/configs/lspconfig.lua new file mode 100644 index 0000000..bc3f55d --- /dev/null +++ b/lua/lua/configs/lspconfig.lua @@ -0,0 +1,30 @@ +-- load defaults i.e lua_lsp +require("nvchad.configs.lspconfig").defaults() + +local lspconfig = require "lspconfig" + +-- EXAMPLE +local servers = { + "html", + "cssls", + "clangd", + "zls", + "nixd", +} +local nvlsp = require "nvchad.configs.lspconfig" + +-- lsps with default config +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = nvlsp.on_attach, + on_init = nvlsp.on_init, + capabilities = nvlsp.capabilities, + } +end + +-- 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/lua/mappings.lua b/lua/lua/mappings.lua new file mode 100644 index 0000000..783b78f --- /dev/null +++ b/lua/lua/mappings.lua @@ -0,0 +1,10 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/lua/lua/options.lua b/lua/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/lua/lua/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/lua/plugins/init.lua b/lua/lua/plugins/init.lua new file mode 100644 index 0000000..24d16cf --- /dev/null +++ b/lua/lua/plugins/init.lua @@ -0,0 +1,52 @@ +return { + { + "stevearc/conform.nvim", + -- 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 "configs.lspconfig" + end, + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + "bash", + "c", + "cpp", + "rust", + "zig", + "javascript", + "typescript", + }, + }, + }, + + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "lua-language-server", + "stylua", + "clangd", + "clang-format", + "zls", + "prettier", + "deno", + "shfmt", + "rust-analyzer", + }, + }, + }, +} diff --git a/lua/mappings.lua b/lua/mappings.lua new file mode 100644 index 0000000..783b78f --- /dev/null +++ b/lua/mappings.lua @@ -0,0 +1,10 @@ +require "nvchad.mappings" + +-- add yours here + +local map = vim.keymap.set + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") + +-- map({ "n", "i", "v" }, "", " w ") diff --git a/lua/options.lua b/lua/options.lua new file mode 100644 index 0000000..738f20b --- /dev/null +++ b/lua/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/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..6474776 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,25 @@ +return { + { + "stevearc/conform.nvim", + -- 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 "configs.lspconfig" + end, + }, + + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = { + -- ensure_installed = { + -- "vim", "lua", "vimdoc", + -- "html", "css" + -- }, + -- }, + -- }, +}