diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6ef0d1 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Example_config + +This can be used as an example custom config for NvChad, this branch is a minimal one. Do check the feature_full branch if you need all the ease in your config. diff --git a/chadrc.lua b/chadrc.lua new file mode 100644 index 0000000..154c455 --- /dev/null +++ b/chadrc.lua @@ -0,0 +1,20 @@ +---@type ChadrcConfig +local M = {} + +-- Path to overriding theme and highlights files +local highlights = require "custom.highlights" + +M.ui = { + theme = "onedark", + theme_toggle = { "onedark", "one_light" }, + + hl_override = highlights.override, + hl_add = highlights.add, +} + +M.plugins = "custom.plugins" + +-- check core.mappings for table structure +M.mappings = require "custom.mappings" + +return M diff --git a/configs/lspconfig.lua b/configs/lspconfig.lua new file mode 100644 index 0000000..7f3c645 --- /dev/null +++ b/configs/lspconfig.lua @@ -0,0 +1,17 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" + +-- if you just want default config for the servers then put them in a table +local servers = { "html", "cssls", "tsserver", "clangd", "yamlls", "ansiblels", "bashls", "rls" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +-- +-- lspconfig.pyright.setup { blabla} diff --git a/configs/null-ls.lua b/configs/null-ls.lua new file mode 100644 index 0000000..118a055 --- /dev/null +++ b/configs/null-ls.lua @@ -0,0 +1,23 @@ +local present, null_ls = pcall(require, "null-ls") + +if not present then + return +end + +local formatting = null_ls.builtins.formatting +local lint = null_ls.builtins.diagnostics + +local sources = { + formatting.prettier, + formatting.stylua, + lint.ansiblelint.with({ + filetypes = { "yaml" }, + }), + lint.shellcheck, + lint.yamllint, +} + +null_ls.setup { + debug = true, + sources = sources, +} diff --git a/configs/nvim-lint.lua b/configs/nvim-lint.lua new file mode 100644 index 0000000..e69de29 diff --git a/configs/overrides.lua b/configs/overrides.lua new file mode 100644 index 0000000..7fc8fc3 --- /dev/null +++ b/configs/overrides.lua @@ -0,0 +1,70 @@ +local M = {} + +M.treesitter = { + ensure_installed = { + "vim", + "lua", + "html", + "css", + "javascript", + "typescript", + "tsx", + "c", + "markdown", + "markdown_inline", + }, + indent = { + enable = true, + -- disable = { + -- "python" + -- }, + }, +} + +M.mason = { + ensure_installed = { + -- lua stuff + "lua-language-server", + "stylua", + + -- web dev stuff + "css-lsp", + "html-lsp", + "typescript-language-server", + "deno", + "prettier", + + -- c/cpp stuff + "clangd", + "clang-format", + + -- shell + "bash-language-server", + "shfmt", + "shellcheck", + + -- ansible + "ansible-language-server", + + -- docker + "dockerfile-language-server", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/highlights.lua b/highlights.lua new file mode 100644 index 0000000..ebf2dfb --- /dev/null +++ b/highlights.lua @@ -0,0 +1,19 @@ +-- To find any highlight groups: " Telescope highlights" +-- Each highlight group can take a table with variables fg, bg, bold, italic, etc +-- base30 variable names can also be used as colors + +local M = {} + +---@type Base46HLGroupsList +M.override = { + Comment = { + italic = true, + }, +} + +---@type HLTable +M.add = { + NvimTreeOpenedFolderName = { fg = "green", bold = true }, +} + +return M diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..608a8d9 --- /dev/null +++ b/init.lua @@ -0,0 +1,7 @@ +-- local autocmd = vim.api.nvim_create_autocmd + +-- Auto resize panes when resizing nvim window +-- autocmd("VimResized", { +-- pattern = "*", +-- command = "tabdo wincmd =", +-- }) diff --git a/mappings.lua b/mappings.lua new file mode 100644 index 0000000..28ca434 --- /dev/null +++ b/mappings.lua @@ -0,0 +1,15 @@ +---@type MappingsTable +local M = {} + +M.general = { + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, + ["gr"] = { " Gitsigns reset_hunk ", "Reset hunk" }, + ["gp"] = { " Gitsigns preview_hunk ", "See preview hunk" }, + ["gd"] = { " Gitsigns diffthis ", "See diff" }, + }, +} + +-- more keybinds! + +return M diff --git a/plugins.lua b/plugins.lua new file mode 100644 index 0000000..153b5c9 --- /dev/null +++ b/plugins.lua @@ -0,0 +1,79 @@ +local overrides = require("custom.configs.overrides") + +---@type NvPluginSpec[] +local plugins = { + + -- Override plugin definition options + { + "NvChad/nvterm", + enabled = false, + }, + { + "vinnymeller/swagger-preview.nvim", + lazy = false, + config = function() + require("swagger-preview").setup({ + port = 8080, + host = "localhost", + }) + end + }, + { + "neovim/nvim-lspconfig", + dependencies = { + -- format & linting + { + "jose-elias-alvarez/null-ls.nvim", + lazy = false, + config = function() + require "custom.configs.null-ls" + end, + }, + }, + config = function() + require "plugins.configs.lspconfig" + require "custom.configs.lspconfig" + end, -- Override to setup mason-lspconfig + }, + + -- override plugin configs + { + "williamboman/mason.nvim", + opts = overrides.mason + }, + + { + "nvim-treesitter/nvim-treesitter", + opts = overrides.treesitter, + }, + + { + "nvim-tree/nvim-tree.lua", + opts = overrides.nvimtree, + }, + + -- Install a plugin + { + "max397574/better-escape.nvim", + event = "InsertEnter", + config = function() + require("better_escape").setup() + end, + }, + + -- To make a plugin not be loaded + -- { + -- "NvChad/nvim-colorizer.lua", + -- enabled = false + -- }, + + -- All NvChad plugins are lazy-loaded by default + -- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false` + -- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example + -- { + -- "mg979/vim-visual-multi", + -- lazy = false, + -- } +} + +return plugins