diff --git a/config/.config/nvim/lua/custom/chadrc.lua b/config/.config/nvim/lua/custom/chadrc.lua new file mode 100644 index 0000000..deb2784 --- /dev/null +++ b/config/.config/nvim/lua/custom/chadrc.lua @@ -0,0 +1,21 @@ +---@type ChadrcConfig +local M = {} + +-- Path to overriding theme and highlights files +local highlights = require "custom.highlights" + +M.ui = { + theme_toggle = { "onedark", "one_light" }, + theme = "onedark", + hl_override = highlights.override, + hl_add = highlights.add, + + transparency = false, +} + +M.plugins = require "custom.plugins" + +-- check core.mappings for table structure +M.mappings = require "custom.mappings" + +return M diff --git a/config/.config/nvim/lua/custom/highlights.lua b/config/.config/nvim/lua/custom/highlights.lua new file mode 100644 index 0000000..0b0f1e8 --- /dev/null +++ b/config/.config/nvim/lua/custom/highlights.lua @@ -0,0 +1,22 @@ +-- 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 HLTable +M.override = { + CursorLine = { + bg = "black2", + }, + Comment = { + italic = true, + }, +} + +---@type HLTable +M.add = { + NvimTreeOpenedFolderName = { fg = "green", bold = true }, +} + +return M diff --git a/config/.config/nvim/lua/custom/init.lua b/config/.config/nvim/lua/custom/init.lua new file mode 100644 index 0000000..288db8a --- /dev/null +++ b/config/.config/nvim/lua/custom/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/config/.config/nvim/lua/custom/mappings.lua b/config/.config/nvim/lua/custom/mappings.lua new file mode 100644 index 0000000..f5e2bc5 --- /dev/null +++ b/config/.config/nvim/lua/custom/mappings.lua @@ -0,0 +1,12 @@ +---@type MappingsConfig +local M = {} + +M.general = { + n = { + [";"] = { ":", "enter command mode", opts = { nowait = true } }, + }, +} + +-- more keybinds! + +return M diff --git a/config/.config/nvim/lua/custom/plugins/init.lua b/config/.config/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..5f78b1c --- /dev/null +++ b/config/.config/nvim/lua/custom/plugins/init.lua @@ -0,0 +1,49 @@ +local overrides = require "custom.plugins.overrides" + +---@type {[PluginName]: NvPluginConfig|false} +local plugins = { + + -- ["goolord/alpha-nvim"] = { disable = false } -- enables dashboard + + -- Override plugin definition options + ["neovim/nvim-lspconfig"] = { + config = function() + require "plugins.configs.lspconfig" + require "custom.plugins.lspconfig" + end, + }, + + -- overrde plugin configs + ["nvim-treesitter/nvim-treesitter"] = { + override_options = overrides.treesitter, + }, + + ["williamboman/mason.nvim"] = { + override_options = overrides.mason, + }, + + ["nvim-tree/nvim-tree.lua"] = { + override_options = overrides.nvimtree, + }, + + -- Install a plugin + ["max397574/better-escape.nvim"] = { + event = "InsertEnter", + config = function() + require("better_escape").setup() + end, + }, + + -- code formatting, linting etc + ["jose-elias-alvarez/null-ls.nvim"] = { + after = "nvim-lspconfig", + config = function() + require "custom.plugins.null-ls" + end, + }, + + -- remove plugin + -- ["hrsh7th/cmp-path"] = false, +} + +return plugins diff --git a/config/.config/nvim/lua/custom/plugins/lspconfig.lua b/config/.config/nvim/lua/custom/plugins/lspconfig.lua new file mode 100644 index 0000000..d4d3c2f --- /dev/null +++ b/config/.config/nvim/lua/custom/plugins/lspconfig.lua @@ -0,0 +1,13 @@ +local on_attach = require("plugins.configs.lspconfig").on_attach +local capabilities = require("plugins.configs.lspconfig").capabilities + +local lspconfig = require "lspconfig" + +local servers = { "html", "cssls", "tsserver", "clangd" } + +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = on_attach, + capabilities = capabilities, + } +end diff --git a/config/.config/nvim/lua/custom/plugins/null-ls.lua b/config/.config/nvim/lua/custom/plugins/null-ls.lua new file mode 100644 index 0000000..cfdb3e0 --- /dev/null +++ b/config/.config/nvim/lua/custom/plugins/null-ls.lua @@ -0,0 +1,25 @@ +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, +} + +null_ls.setup { + debug = true, + sources = sources, +} diff --git a/config/.config/nvim/lua/custom/plugins/overrides.lua b/config/.config/nvim/lua/custom/plugins/overrides.lua new file mode 100644 index 0000000..e4225cb --- /dev/null +++ b/config/.config/nvim/lua/custom/plugins/overrides.lua @@ -0,0 +1,44 @@ +local M = {} + +M.treesitter = { + ensure_installed = { + "vim", + "lua", + "html", + "css", + "javascript", + "c", + }, +} + +M.mason = { + ensure_installed = { + -- lua stuff + "lua-language-server", + "stylua", + + -- web dev stuff + "css-lsp", + "html-lsp", + "typescript-language-server", + "deno", + }, +} + +-- git support in nvimtree +M.nvimtree = { + git = { + enable = true, + }, + + renderer = { + highlight_git = true, + icons = { + show = { + git = true, + }, + }, + }, +} + +return M diff --git a/init.sh b/init.sh index 5201066..3f65f6e 100755 --- a/init.sh +++ b/init.sh @@ -76,6 +76,8 @@ spacevim () { [ -d $HOME/.vim ] && mv "$HOME/.vim" "$HOME/vim_bk" [ -f $HOME/.vimrc ] && mv "$HOME/.vimrc" "$HOME/vimrc_bk" curl -sLf https://spacevim.org/install.sh | bash + echo "Install nvchad" + git clone https://github.com/NvChad/NvChad ~/.config/nvim } #install fonts for terminal fonts () {