diff --git a/.nvchad-custom/README.md b/.nvchad-custom/README.md new file mode 100644 index 0000000..a6ef0d1 --- /dev/null +++ b/.nvchad-custom/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/.nvchad-custom/chadrc.lua b/.nvchad-custom/chadrc.lua new file mode 100644 index 0000000..fcaee86 --- /dev/null +++ b/.nvchad-custom/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 = "tokyodark", + theme_toggle = { "tokyodark", "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/.nvchad-custom/configs/lspconfig.lua b/.nvchad-custom/configs/lspconfig.lua new file mode 100644 index 0000000..bd956f4 --- /dev/null +++ b/.nvchad-custom/configs/lspconfig.lua @@ -0,0 +1,18 @@ +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", "docker_compose_language_service", "dockerls", "rust_analyzer", "pyright" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end + +-- +-- lspconfig.pyright.setup { blabla} diff --git a/.nvchad-custom/configs/null-ls.lua b/.nvchad-custom/configs/null-ls.lua new file mode 100644 index 0000000..a3881e1 --- /dev/null +++ b/.nvchad-custom/configs/null-ls.lua @@ -0,0 +1,35 @@ +local present, null_ls = pcall(require, "null-ls") + +if not present then + return +end + +local b = null_ls.builtins + +local sources = { + + -- webdev stuff + b.formatting.deno_fmt, -- choosed deno for ts/js files cuz its very fast! + b.formatting.prettier.with { filetypes = { "html", "markdown", "css" } }, -- so prettier works only on these filetypes + + -- Lua + b.formatting.stylua, + + -- cpp + b.formatting.clang_format, + + b.formatting.black.with({ + extra_args = {"--line-length=82"} + }) + + -- b.diagnostics.pylint.with({ + -- diagnostic_config = { underline = false, virtual_text = false, signs = false }, + -- method = null_ls.methods.DIAGNOSTICS_ON_SAVE, + -- }), +} + + +null_ls.setup { + debug = true, + sources = sources, +} diff --git a/.nvchad-custom/configs/overrides.lua b/.nvchad-custom/configs/overrides.lua new file mode 100644 index 0000000..c22198d --- /dev/null +++ b/.nvchad-custom/configs/overrides.lua @@ -0,0 +1,65 @@ +local M = {} + +M.treesitter = { + ensure_installed = { + "vim", + "lua", + "html", + "css", + "javascript", + "typescript", + "python", + "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", + + "jedi_language_server", + + "docker_compose_language_service", + "dockerls", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/.nvchad-custom/highlights.lua b/.nvchad-custom/highlights.lua new file mode 100644 index 0000000..ebf2dfb --- /dev/null +++ b/.nvchad-custom/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/.nvchad-custom/init.lua b/.nvchad-custom/init.lua new file mode 100644 index 0000000..3f75fe1 --- /dev/null +++ b/.nvchad-custom/init.lua @@ -0,0 +1,31 @@ +-- local autocmd = vim.api.nvim_create_autocmd + +-- Auto resize panes when resizing nvim window +-- autocmd("VimResized", { +-- pattern = "*", +-- command = "tabdo wincmd =", +-- }) + +vim.wo.relativenumber = true + +vim.opt.expandtab = true +vim.opt.number = true +vim.opt.linebreak = true +vim.opt.showbreak = "+++" +vim.opt.textwidth = 100 +vim.opt.showmatch = true +vim.opt.visualbell = true +vim.opt.hlsearch = true +vim.opt.smartcase = true +vim.opt.ignorecase = true +vim.opt.incsearch = true +vim.opt.autoindent = true +vim.opt.shiftwidth = 2 +vim.opt.smartindent = true +vim.opt.ruler = true +vim.opt.softtabstop = 2 +vim.opt.tabstop = 2 +vim.opt.undolevels = 1000 +vim.opt.backspace = "indent,eol,start" +vim.opt.colorcolumn = "80" + diff --git a/.nvchad-custom/mappings.lua b/.nvchad-custom/mappings.lua new file mode 100644 index 0000000..df5f6db --- /dev/null +++ b/.nvchad-custom/mappings.lua @@ -0,0 +1,28 @@ +---@type MappingsTable +local M = {} + +M.general = { + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, + + -- harpoon + ["H"] = {function() require("harpoon.ui").toggle_quick_menu() end, "Open Harpoon" }, + ["a"] = {function() require("harpoon.mark").add_file() end, "Add file to Harpoon"}, + ["s"] = {function() require("harpoon.ui").nav_file(1) end, "Switch to file 1"}, + ["d"] = {function() require("harpoon.ui").nav_file(2) end, "Switch to file 2"}, + ["f"] = {function() require("harpoon.ui").nav_file(3) end, "Switch to file 3"}, + ["g"] = {function() require("harpoon.ui").nav_file(4) end, "Switch to file 4"}, + + -- navigation + [""] = {"zz", "1/2 page down"}, + [""] = {"zz", "1/2 page up" }, + ["n"] = {"nzz", "find next"}, + ["N"] = {"Nzz", "find prev"}, + + + }, +} + +-- more keybinds! + +return M diff --git a/.nvchad-custom/plugins.lua b/.nvchad-custom/plugins.lua new file mode 100644 index 0000000..fb9cf8c --- /dev/null +++ b/.nvchad-custom/plugins.lua @@ -0,0 +1,84 @@ +local overrides = require "custom.configs.overrides" + +---@type NvPluginSpec[] +local plugins = { + + -- Override plugin definition options + + { + "neovim/nvim-lspconfig", + dependencies = { + -- format & linting + { + "jose-elias-alvarez/null-ls.nvim", + 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, + }, + + { + "williamboman/mason-lspconfig.nvim", + setup = { + ensure_installed = { "jedi" }, + }, + }, + + { + "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, + }, + + { + "theprimeagen/harpoon", + }, + + { + "tpope/vim-sleuth", + lazy = false, + }, + + + { "NvChad/nvterm", enabled = false }, + + -- 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