summaryrefslogtreecommitdiffstatshomepage
path: root/NvChad/lua
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-03-04 18:18:22 -0600
committerToby Vincent <tobyv13@gmail.com>2022-03-04 18:18:22 -0600
commit0d3b11c231b5d8536fdc8fbddf167956ec999cc6 (patch)
tree62ddbcfe49228773a5b7425db81a12947dc09450 /NvChad/lua
parent6a36592700b75e3658584db672f09ee33b2ba840 (diff)
feat: more tmux/neovim/alacritty
Diffstat (limited to 'NvChad/lua')
-rw-r--r--NvChad/lua/colors/highlights.lua173
-rw-r--r--NvChad/lua/colors/init.lua34
-rw-r--r--NvChad/lua/core/autocmds.lua20
-rw-r--r--NvChad/lua/core/default_config.lua227
-rw-r--r--NvChad/lua/core/mappings.lua183
-rw-r--r--NvChad/lua/core/options.lua81
-rw-r--r--NvChad/lua/core/utils.lua317
-rw-r--r--NvChad/lua/custom/chadrc.lua30
-rw-r--r--NvChad/lua/custom/init.lua1
-rw-r--r--NvChad/lua/custom/mappings.lua6
-rw-r--r--NvChad/lua/custom/plugins/configs.lua26
-rw-r--r--NvChad/lua/custom/plugins/init.lua91
-rw-r--r--NvChad/lua/custom/plugins/lspconfig.lua29
-rw-r--r--NvChad/lua/custom/plugins/null-ls.lua29
-rw-r--r--NvChad/lua/plugins/configs/alpha.lua86
-rw-r--r--NvChad/lua/plugins/configs/bufferline.lua148
-rw-r--r--NvChad/lua/plugins/configs/cmp.lua76
-rw-r--r--NvChad/lua/plugins/configs/icons.lua158
-rw-r--r--NvChad/lua/plugins/configs/lspconfig.lua36
-rw-r--r--NvChad/lua/plugins/configs/lspkind_icons.lua29
-rw-r--r--NvChad/lua/plugins/configs/nvimtree.lua80
-rw-r--r--NvChad/lua/plugins/configs/others.lua196
-rw-r--r--NvChad/lua/plugins/configs/statusline.lua438
-rw-r--r--NvChad/lua/plugins/configs/telescope.lua72
-rw-r--r--NvChad/lua/plugins/configs/treesitter.lua26
-rw-r--r--NvChad/lua/plugins/init.lua237
-rw-r--r--NvChad/lua/plugins/packerInit.lua44
27 files changed, 2873 insertions, 0 deletions
diff --git a/NvChad/lua/colors/highlights.lua b/NvChad/lua/colors/highlights.lua
new file mode 100644
index 0000000..1c3dae8
--- /dev/null
+++ b/NvChad/lua/colors/highlights.lua
@@ -0,0 +1,173 @@
+local cmd = vim.cmd
+
+local override = require("core.utils").load_config().ui.hl_override
+local colors = require("colors").get()
+local ui = require("core.utils").load_config().ui
+
+local black = colors.black
+local black2 = colors.black2
+local blue = colors.blue
+local darker_black = colors.darker_black
+local folder_bg = colors.folder_bg
+local green = colors.green
+local grey = colors.grey
+local grey_fg = colors.grey_fg
+local light_grey = colors.light_grey
+local line = colors.line
+local nord_blue = colors.nord_blue
+local one_bg = colors.one_bg
+local one_bg2 = colors.one_bg2
+local pmenu_bg = colors.pmenu_bg
+local purple = colors.purple
+local red = colors.red
+local white = colors.white
+local yellow = colors.yellow
+local orange = colors.orange
+local one_bg3 = colors.one_bg3
+
+-- functions for setting highlights
+local fg = require("core.utils").fg
+local fg_bg = require("core.utils").fg_bg
+local bg = require("core.utils").bg
+
+-- Comments
+if ui.italic_comments then
+ fg("Comment", grey_fg .. " gui=italic")
+else
+ fg("Comment", grey_fg)
+end
+
+-- Disable cursor line
+cmd "hi clear CursorLine"
+-- Line number
+fg("cursorlinenr", white)
+
+-- same it bg, so it doesn't appear
+fg("EndOfBuffer", black)
+
+-- For floating windows
+fg("FloatBorder", blue)
+bg("NormalFloat", darker_black)
+
+-- Pmenu
+bg("Pmenu", one_bg)
+bg("PmenuSbar", one_bg2)
+bg("PmenuSel", pmenu_bg)
+bg("PmenuThumb", nord_blue)
+fg("CmpItemAbbr", white)
+fg("CmpItemAbbrMatch", white)
+fg("CmpItemKind", white)
+fg("CmpItemMenu", white)
+
+-- misc
+
+-- inactive statuslines as thin lines
+fg("StatusLineNC", one_bg3 .. " gui=underline")
+
+fg("LineNr", grey)
+fg("NvimInternalError", red)
+fg("VertSplit", one_bg2)
+
+if ui.transparency then
+ bg("Normal", "NONE")
+ bg("Folded", "NONE")
+ fg("Folded", "NONE")
+ fg("Comment", grey)
+end
+
+-- [[ Plugin Highlights
+
+-- Dashboard
+fg("AlphaHeader", grey_fg)
+fg("AlphaButtons", light_grey)
+
+-- Git signs
+fg_bg("DiffAdd", blue, "NONE")
+fg_bg("DiffChange", grey_fg, "NONE")
+fg_bg("DiffChangeDelete", red, "NONE")
+fg_bg("DiffModified", red, "NONE")
+fg_bg("DiffDelete", red, "NONE")
+
+-- Indent blankline plugin
+fg("IndentBlanklineChar", line)
+fg("IndentBlanklineSpaceChar", line)
+
+-- Lsp diagnostics
+
+fg("DiagnosticHint", purple)
+fg("DiagnosticError", red)
+fg("DiagnosticWarn", yellow)
+fg("DiagnosticInformation", green)
+
+-- NvimTree
+fg("NvimTreeEmptyFolderName", folder_bg)
+fg("NvimTreeEndOfBuffer", darker_black)
+fg("NvimTreeFolderIcon", folder_bg)
+fg("NvimTreeFolderName", folder_bg)
+fg("NvimTreeGitDirty", red)
+fg("NvimTreeIndentMarker", one_bg2)
+bg("NvimTreeNormal", darker_black)
+bg("NvimTreeNormalNC", darker_black)
+fg("NvimTreeOpenedFolderName", folder_bg)
+fg("NvimTreeRootFolder", red .. " gui=underline") -- enable underline for root folder in nvim tree
+fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
+fg_bg("NvimTreeVertSplit", darker_black, darker_black)
+fg_bg("NvimTreeWindowPicker", red, black2)
+
+-- Telescope
+fg_bg("TelescopeBorder", darker_black, darker_black)
+fg_bg("TelescopePromptBorder", black2, black2)
+
+fg_bg("TelescopePromptNormal", white, black2)
+fg_bg("TelescopePromptPrefix", red, black2)
+
+bg("TelescopeNormal", darker_black)
+
+fg_bg("TelescopePreviewTitle", black, green)
+fg_bg("TelescopePromptTitle", black, red)
+fg_bg("TelescopeResultsTitle", darker_black, darker_black)
+
+bg("TelescopeSelection", black2)
+
+-- keybinds cheatsheet
+
+fg_bg("CheatsheetBorder", black, black)
+bg("CheatsheetSectionContent", black)
+fg("CheatsheetHeading", white)
+
+local section_title_colors = {
+ white,
+ blue,
+ red,
+ green,
+ yellow,
+ purple,
+ orange,
+}
+for i, color in ipairs(section_title_colors) do
+ vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black)
+end
+
+-- Disable some highlight in nvim tree if transparency enabled
+if ui.transparency then
+ bg("NormalFloat", "NONE")
+ bg("NvimTreeNormal", "NONE")
+ bg("NvimTreeNormalNC", "NONE")
+ bg("NvimTreeStatusLineNC", "NONE")
+ fg_bg("NvimTreeVertSplit", grey, "NONE")
+
+ -- telescope
+ bg("TelescopeBorder", "NONE")
+ bg("TelescopePrompt", "NONE")
+ bg("TelescopeResults", "NONE")
+ bg("TelescopePromptBorder", "NONE")
+ bg("TelescopePromptNormal", "NONE")
+ bg("TelescopeNormal", "NONE")
+ bg("TelescopePromptPrefix", "NONE")
+ fg("TelescopeBorder", one_bg)
+ fg_bg("TelescopeResultsTitle", black, blue)
+end
+
+if #override ~= 0 then
+ require(override)
+end
diff --git a/NvChad/lua/colors/init.lua b/NvChad/lua/colors/init.lua
new file mode 100644
index 0000000..8927251
--- /dev/null
+++ b/NvChad/lua/colors/init.lua
@@ -0,0 +1,34 @@
+local M = {}
+
+-- if theme given, load given theme if given, otherwise nvchad_theme
+M.init = function(theme)
+ if not theme then
+ theme = require("core.utils").load_config().ui.theme
+ end
+
+ -- set the global theme, used at various places like theme switcher, highlights
+ vim.g.nvchad_theme = theme
+
+ local present, base16 = pcall(require, "base16")
+
+ if present then
+ -- first load the base16 theme
+ base16(base16.themes(theme), true)
+
+ -- unload to force reload
+ package.loaded["colors.highlights" or false] = nil
+ -- then load the highlights
+ require "colors.highlights"
+ end
+end
+
+-- returns a table of colors for given or current theme
+M.get = function(theme)
+ if not theme then
+ theme = vim.g.nvchad_theme
+ end
+
+ return require("hl_themes." .. theme)
+end
+
+return M
diff --git a/NvChad/lua/core/autocmds.lua b/NvChad/lua/core/autocmds.lua
new file mode 100644
index 0000000..362f0d3
--- /dev/null
+++ b/NvChad/lua/core/autocmds.lua
@@ -0,0 +1,20 @@
+local settings=require("core.utils").load_config().options.nvChad
+-- uncomment this if you want to open nvim with a dir
+-- vim.cmd [[ autocmd BufEnter * if &buftype != "terminal" | lcd %:p:h | endif ]]
+
+-- Use relative & absolute line numbers in 'n' & 'i' modes respectively
+-- vim.cmd[[ au InsertEnter * set norelativenumber ]]
+-- vim.cmd[[ au InsertLeave * set relativenumber ]]
+
+-- Don't show any numbers inside terminals
+if not settings.terminal_numbers then
+ vim.cmd [[ au TermOpen term://* setlocal nonumber norelativenumber | setfiletype terminal ]]
+end
+
+-- Don't show status line on certain windows
+vim.cmd [[ autocmd BufEnter,BufRead,BufWinEnter,FileType,WinEnter * lua require("core.utils").hide_statusline() ]]
+
+-- Open a file from its last left off position
+-- vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
+-- File extension specific tabbing
+-- vim.cmd [[ autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 ]]
diff --git a/NvChad/lua/core/default_config.lua b/NvChad/lua/core/default_config.lua
new file mode 100644
index 0000000..eb17228
--- /dev/null
+++ b/NvChad/lua/core/default_config.lua
@@ -0,0 +1,227 @@
+-- IMPORTANT NOTE : This is default config, so dont change anything here.
+-- use custom/chadrc.lua instead
+
+local M = {}
+
+M.options = {
+ -- custom = {}
+ -- general nvim/vim options , check :h optionname to know more about an option
+
+ clipboard = "unnamedplus",
+ cmdheight = 1,
+ ruler = false,
+ hidden = true,
+ ignorecase = true,
+ smartcase = true,
+ mapleader = " ",
+ mouse = "a",
+ number = true,
+ numberwidth = 2,
+ relativenumber = false,
+ expandtab = true,
+ shiftwidth = 2,
+ smartindent = true,
+ tabstop = 8,
+ timeoutlen = 400,
+ updatetime = 250,
+ undofile = true,
+ fillchars = { eob = " " },
+ shadafile = vim.opt.shadafile,
+
+ -- NvChad options
+ nvChad = {
+ copy_cut = true, -- copy cut text ( x key ), visual and normal mode
+ copy_del = true, -- copy deleted text ( dd key ), visual and normal mode
+ insert_nav = true, -- navigation in insertmode
+ window_nav = true,
+ terminal_numbers = false,
+
+ -- updater
+ update_url = "https://github.com/NvChad/NvChad",
+ update_branch = "main",
+ },
+}
+
+---- UI -----
+
+M.ui = {
+ hl_override = "", -- path of your file that contains highlights
+ italic_comments = false,
+ theme = "onedark", -- default theme
+
+ -- Change terminal bg to nvim theme's bg color so it'll match well
+ -- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
+ transparency = false,
+}
+
+---- PLUGIN OPTIONS ----
+
+M.plugins = {
+ -- enable/disable plugins (false for disable)
+ status = {
+ blankline = true, -- indentline stuff
+ bufferline = true, -- manage and preview opened buffers
+ colorizer = false, -- color RGB, HEX, CSS, NAME color codes
+ comment = true, -- easily (un)comment code, language aware
+ alpha = false, -- dashboard
+ better_escape = true, -- map to <ESC> with no lag
+ feline = true, -- statusline
+ gitsigns = true,
+ lspsignature = true, -- lsp enhancements
+ vim_matchup = true, -- improved matchit
+ cmp = true,
+ nvimtree = true,
+ autopairs = true,
+ },
+ options = {
+ packer = {
+ init_file = "plugins.packerInit",
+ },
+ autopairs = { loadAfter = "nvim-cmp" },
+ cmp = {
+ lazy_load = true,
+ },
+ lspconfig = {
+ setup_lspconf = "", -- path of file containing setups of different lsps
+ },
+ nvimtree = {
+ -- packerCompile required after changing lazy_load
+ lazy_load = true,
+ },
+ luasnip = {
+ snippet_path = {},
+ },
+ statusline = {
+ -- hide, show on specific filetypes
+ hidden = {
+ "help",
+ "NvimTree",
+ "terminal",
+ "alpha",
+ },
+ shown = {},
+
+ -- truncate statusline on small screens
+ shortline = true,
+ style = "default", -- default, round , slant , block , arrow
+ },
+ esc_insertmode_timeout = 300,
+ },
+ default_plugin_config_replace = {},
+ default_plugin_remove = {},
+ install = nil,
+}
+
+-- Don't use a single keymap twice
+
+--- MAPPINGS ----
+
+-- non plugin
+M.mappings = {
+ -- custom = {}, -- custom user mappings
+
+ misc = {
+ cheatsheet = "<leader>ch",
+ close_buffer = "<leader>x",
+ cp_whole_file = "<C-a>", -- copy all contents of current buffer
+ lineNR_toggle = "<leader>n", -- toggle line number
+ lineNR_rel_toggle = "<leader>rn",
+ update_nvchad = "<leader>uu",
+ new_buffer = "<S-t>",
+ new_tab = "<C-t>b",
+ save_file = "<C-s>", -- save file using :w
+ },
+
+ -- navigation in insert mode, only if enabled in options
+
+ insert_nav = {
+ backward = "<C-h>",
+ end_of_line = "<C-e>",
+ forward = "<C-l>",
+ next_line = "<C-k>",
+ prev_line = "<C-j>",
+ beginning_of_line = "<C-a>",
+ },
+
+ -- better window movement
+ window_nav = {
+ moveLeft = "<C-h>",
+ moveRight = "<C-l>",
+ moveUp = "<C-k>",
+ moveDown = "<C-j>",
+ },
+
+ -- terminal related mappings
+ terminal = {
+ -- multiple mappings can be given for esc_termmode, esc_hide_termmode
+
+ -- get out of terminal mode
+ esc_termmode = { "jk" },
+
+ -- get out of terminal mode and hide it
+ esc_hide_termmode = { "JK" },
+ -- show & recover hidden terminal buffers in a telescope picker
+ pick_term = "<leader>W",
+
+ -- spawn terminals
+ new_horizontal = "<leader>h",
+ new_vertical = "<leader>v",
+ new_window = "<leader>w",
+ },
+}
+
+-- plugins related mappings
+-- To disable a mapping, equate the variable to "" or false or nil in chadrc
+M.mappings.plugins = {
+ bufferline = {
+ next_buffer = "<TAB>",
+ prev_buffer = "<S-Tab>",
+ },
+ comment = {
+ toggle = "<leader>/",
+ },
+
+ -- map to <ESC> with no lag
+ better_escape = { -- <ESC> will still work
+ esc_insertmode = { "jk" }, -- multiple mappings allowed
+ },
+
+ lspconfig = {
+ declaration = "gD",
+ definition = "gd",
+ hover = "K",
+ implementation = "gi",
+ signature_help = "gk",
+ add_workspace_folder = "<leader>wa",
+ remove_workspace_folder = "<leader>wr",
+ list_workspace_folders = "<leader>wl",
+ type_definition = "<leader>D",
+ rename = "<leader>ra",
+ code_action = "<leader>ca",
+ references = "gr",
+ float_diagnostics = "ge",
+ goto_prev = "[d",
+ goto_next = "]d",
+ set_loclist = "<leader>q",
+ formatting = "<leader>fm",
+ },
+
+ nvimtree = {
+ toggle = "<C-n>",
+ focus = "<leader>e",
+ },
+
+ telescope = {
+ buffers = "<leader>fb",
+ find_files = "<leader>ff",
+ find_hiddenfiles = "<leader>fa",
+ git_commits = "<leader>cm",
+ git_status = "<leader>gt",
+ help_tags = "<leader>fh",
+ live_grep = "<leader>fw",
+ oldfiles = "<leader>fo",
+ themes = "<leader>th", -- NvChad theme picker
+ },
+}
+
+return M
diff --git a/NvChad/lua/core/mappings.lua b/NvChad/lua/core/mappings.lua
new file mode 100644
index 0000000..8cce437
--- /dev/null
+++ b/NvChad/lua/core/mappings.lua
@@ -0,0 +1,183 @@
+local utils = require "core.utils"
+
+local config = utils.load_config()
+local map_wrapper = utils.map
+
+local maps = config.mappings
+local plugin_maps = maps.plugins
+local nvChad_options = config.options.nvChad
+
+local cmd = vim.cmd
+
+-- This is a wrapper function made to disable a plugin mapping from chadrc
+-- If keys are nil, false or empty string, then the mapping will be not applied
+-- Useful when one wants to use that keymap for any other purpose
+local map = function(...)
+ local keys = select(2, ...)
+ if not keys or keys == "" then
+ return
+ end
+ map_wrapper(...)
+end
+
+local M = {}
+
+-- these mappings will only be called during initialization
+M.misc = function()
+ local function non_config_mappings()
+ -- Don't copy the replaced text after pasting in visual mode
+ map_wrapper("v", "p", "p:let @+=@0<CR>")
+
+ -- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
+ -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
+ -- empty mode is same as using :map
+ -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
+ map_wrapper("", "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
+ map_wrapper("", "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
+ map_wrapper("", "<Down>", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', { expr = true })
+ map_wrapper("", "<Up>", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', { expr = true })
+
+ -- use ESC to turn off search highlighting
+ map_wrapper("n", "<Esc>", ":noh <CR>")
+
+ -- center cursor when moving (goto_definition)
+
+ -- yank from current cursor to end of line
+ map_wrapper("n", "Y", "yg$")
+ end
+
+ local function optional_mappings()
+ -- don't yank text on cut ( x )
+ if not nvChad_options.copy_cut then
+ map_wrapper({ "n", "v" }, "x", '"_x')
+ end
+
+ -- don't yank text on delete ( dd )
+ if not nvChad_options.copy_del then
+ map_wrapper({ "n", "v" }, "d", '"_d')
+ end
+
+ -- navigation within insert mode
+ if nvChad_options.insert_nav then
+ local inav = maps.insert_nav
+
+ map("i", inav.backward, "<Left>")
+ map("i", inav.end_of_line, "<End>")
+ map("i", inav.forward, "<Right>")
+ map("i", inav.next_line, "<Up>")
+ map("i", inav.prev_line, "<Down>")
+ map("i", inav.beginning_of_line, "<ESC>^i")
+ end
+
+ -- easier navigation between windows
+ if nvChad_options.window_nav then
+ local wnav = maps.window_nav
+
+ map("n", wnav.moveLeft, "<C-w>h")
+ map("n", wnav.moveRight, "<C-w>l")
+ map("n", wnav.moveUp, "<C-w>k")
+ map("n", wnav.moveDown, "<C-w>j")
+ end
+ end
+
+ local function required_mappings()
+ map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() <CR>") -- show keybinds
+ map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
+ map("n", maps.misc.cp_whole_file, ":%y+ <CR>") -- copy whole file content
+ map("n", maps.misc.new_buffer, ":enew <CR>") -- new buffer
+ map("n", maps.misc.new_tab, ":tabnew <CR>") -- new tabs
+ map("n", maps.misc.lineNR_toggle, ":set nu! <CR>")
+ map("n", maps.misc.lineNR_rel_toggle, ":set rnu! <CR>") -- relative line numbers
+ map("n", maps.misc.save_file, ":w <CR>") -- ctrl + s to save file
+
+ -- terminal mappings --
+ local term_maps = maps.terminal
+ -- get out of terminal mode
+ map("t", term_maps.esc_termmode, "<C-\\><C-n>")
+ -- hide a term from within terminal mode
+ map("t", term_maps.esc_hide_termmode, "<C-\\><C-n> :lua require('core.utils').close_buffer() <CR>")
+ -- pick a hidden term
+ map("n", term_maps.pick_term, ":Telescope terms <CR>")
+ -- Open terminals
+ -- TODO this opens on top of an existing vert/hori term, fixme
+ map("n", term_maps.new_horizontal, ":execute 15 .. 'new +terminal' | let b:term_type = 'hori' | startinsert <CR>")
+ map("n", term_maps.new_vertical, ":execute 'vnew +terminal' | let b:term_type = 'vert' | startinsert <CR>")
+ map("n", term_maps.new_window, ":execute 'terminal' | let b:term_type = 'wind' | startinsert <CR>")
+ -- terminal mappings end --
+
+ -- Add Packer commands because we are not loading it at startup
+ cmd "silent! command PackerClean lua require 'plugins' require('packer').clean()"
+ cmd "silent! command PackerCompile lua require 'plugins' require('packer').compile()"
+ cmd "silent! command PackerInstall lua require 'plugins' require('packer').install()"
+ cmd "silent! command PackerStatus lua require 'plugins' require('packer').status()"
+ cmd "silent! command PackerSync lua require 'plugins' require('packer').sync()"
+ cmd "silent! command PackerUpdate lua require 'plugins' require('packer').update()"
+
+ -- add NvChadUpdate command and mapping
+ cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
+ map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
+ end
+
+ non_config_mappings()
+ optional_mappings()
+ required_mappings()
+end
+
+-- below are all plugin related mappings
+
+M.bufferline = function()
+ local m = plugin_maps.bufferline
+
+ map("n", m.next_buffer, ":BufferLineCycleNext <CR>")
+ map("n", m.prev_buffer, ":BufferLineCyclePrev <CR>")
+end
+
+M.comment = function()
+ local m = plugin_maps.comment.toggle
+ map("n", m, ":lua require('Comment.api').toggle_current_linewise()<CR>")
+ map("v", m, ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>")
+end
+
+M.lspconfig = function()
+ local m = plugin_maps.lspconfig
+
+ -- See `:help vim.lsp.*` for documentation on any of the below functions
+ map("n", m.declaration, "<cmd>lua vim.lsp.buf.declaration()<CR>")
+ map("n", m.definition, "<cmd>lua vim.lsp.buf.definition()<CR>")
+ map("n", m.hover, "<cmd>lua vim.lsp.buf.hover()<CR>")
+ map("n", m.implementation, "<cmd>lua vim.lsp.buf.implementation()<CR>")
+ map("n", m.signature_help, "<cmd>lua vim.lsp.buf.signature_help()<CR>")
+ map("n", m.add_workspace_folder, "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
+ map("n", m.remove_workspace_folder, "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
+ map("n", m.list_workspace_folders, "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
+ map("n", m.type_definition, "<cmd>lua vim.lsp.buf.type_definition()<CR>")
+ map("n", m.rename, "<cmd>lua vim.lsp.buf.rename()<CR>")
+ map("n", m.code_action, "<cmd>lua vim.lsp.buf.code_action()<CR>")
+ map("n", m.references, "<cmd>lua vim.lsp.buf.references()<CR>")
+ map("n", m.float_diagnostics, "<cmd>lua vim.diagnostic.open_float()<CR>")
+ map("n", m.goto_prev, "<cmd>lua vim.diagnostic.goto_prev()<CR>")
+ map("n", m.goto_next, "<cmd>lua vim.diagnostic.goto_next()<CR>")
+ map("n", m.set_loclist, "<cmd>lua vim.diagnostic.setloclist()<CR>")
+ map("n", m.formatting, "<cmd>lua vim.lsp.buf.formatting()<CR>")
+end
+
+M.nvimtree = function()
+ map("n", plugin_maps.nvimtree.toggle, ":NvimTreeToggle <CR>")
+ map("n", plugin_maps.nvimtree.focus, ":NvimTreeFocus <CR>")
+end
+
+M.telescope = function()
+ local m = plugin_maps.telescope
+
+ map("n", m.buffers, ":Telescope buffers <CR>")
+ map("n", m.find_files, ":Telescope find_files <CR>")
+ map("n", m.find_hiddenfiles, ":Telescope find_files follow=true no_ignore=true hidden=true <CR>")
+ map("n", m.git_commits, ":Telescope git_commits <CR>")
+ map("n", m.git_status, ":Telescope git_status <CR>")
+ map("n", m.help_tags, ":Telescope help_tags <CR>")
+ map("n", m.live_grep, ":Telescope live_grep <CR>")
+ map("n", m.oldfiles, ":Telescope oldfiles <CR>")
+ map("n", m.themes, ":Telescope themes <CR>")
+end
+
+return M
diff --git a/NvChad/lua/core/options.lua b/NvChad/lua/core/options.lua
new file mode 100644
index 0000000..f8436a8
--- /dev/null
+++ b/NvChad/lua/core/options.lua
@@ -0,0 +1,81 @@
+local opt = vim.opt
+local g = vim.g
+
+local options = require("core.utils").load_config().options
+
+opt.title = true
+opt.clipboard = options.clipboard
+opt.cmdheight = options.cmdheight
+opt.cul = true -- cursor line
+
+-- Indentline
+opt.expandtab = options.expandtab
+opt.shiftwidth = options.shiftwidth
+opt.smartindent = options.smartindent
+
+-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758
+opt.fillchars = options.fillchars
+
+opt.hidden = options.hidden
+opt.ignorecase = options.ignorecase
+opt.smartcase = options.smartcase
+opt.mouse = options.mouse
+
+-- Numbers
+opt.number = options.number
+opt.numberwidth = options.numberwidth
+opt.relativenumber = options.relativenumber
+opt.ruler = options.ruler
+
+-- disable nvim intro
+opt.shortmess:append "sI"
+
+opt.signcolumn = "yes"
+opt.splitbelow = true
+opt.splitright = true
+opt.tabstop = options.tabstop
+opt.termguicolors = true
+opt.timeoutlen = options.timeoutlen
+opt.undofile = options.undofile
+
+-- interval for writing swap file to disk, also used by gitsigns
+opt.updatetime = options.updatetime
+
+-- go to previous/next line with h,l,left arrow and right arrow
+-- when cursor reaches end/beginning of line
+opt.whichwrap:append "<>[]hl"
+
+g.mapleader = options.mapleader
+
+-- disable some builtin vim plugins
+local disabled_built_ins = {
+ "2html_plugin",
+ "getscript",
+ "getscriptPlugin",
+ "gzip",
+ "logipat",
+ "netrw",
+ "netrwPlugin",
+ "netrwSettings",
+ "netrwFileHandlers",
+ "matchit",
+ "tar",
+ "tarPlugin",
+ "rrhelper",
+ "spellfile_plugin",
+ "vimball",
+ "vimballPlugin",
+ "zip",
+ "zipPlugin",
+}
+
+for _, plugin in pairs(disabled_built_ins) do
+ g["loaded_" .. plugin] = 1
+end
+
+--Defer loading shada until after startup_
+vim.opt.shadafile = "NONE"
+vim.schedule(function()
+ vim.opt.shadafile = require("core.utils").load_config().options.shadafile
+ vim.cmd [[ silent! rsh ]]
+end)
diff --git a/NvChad/lua/core/utils.lua b/NvChad/lua/core/utils.lua
new file mode 100644
index 0000000..9c16c53
--- /dev/null
+++ b/NvChad/lua/core/utils.lua
@@ -0,0 +1,317 @@
+local M = {}
+
+local cmd = vim.cmd
+M.close_buffer = function(force)
+ -- This is a modification of a NeoVim plugin from
+ -- Author: ojroques - Olivier Roques
+ -- Src: https://github.com/ojroques/nvim-bufdel
+ -- (Author has okayed copy-paste)
+
+ -- Options
+ local opts = {
+ next = "cycle", -- how to retrieve the next buffer
+ quit = false, -- exit when last buffer is deleted
+ --TODO make this a chadrc flag/option
+ }
+
+ -- ----------------
+ -- Helper functions
+ -- ----------------
+
+ -- Switch to buffer 'buf' on each window from list 'windows'
+ local function switch_buffer(windows, buf)
+ local cur_win = vim.fn.winnr()
+ for _, winid in ipairs(windows) do
+ winid = tonumber(winid) or 0
+ vim.cmd(string.format("%d wincmd w", vim.fn.win_id2win(winid)))
+ vim.cmd(string.format("buffer %d", buf))
+ end
+ vim.cmd(string.format("%d wincmd w", cur_win)) -- return to original window
+ end
+
+ -- Select the first buffer with a number greater than given buffer
+ local function get_next_buf(buf)
+ local next = vim.fn.bufnr "#"
+ if opts.next == "alternate" and vim.fn.buflisted(next) == 1 then
+ return next
+ end
+ for i = 0, vim.fn.bufnr "$" - 1 do
+ next = (buf + i) % vim.fn.bufnr "$" + 1 -- will loop back to 1
+ if vim.fn.buflisted(next) == 1 then
+ return next
+ end
+ end
+ end
+
+ -- ----------------
+ -- End helper functions
+ -- ----------------
+
+ local buf = vim.fn.bufnr()
+ if vim.fn.buflisted(buf) == 0 then -- exit if buffer number is invalid
+ vim.cmd "close"
+ return
+ end
+
+ if #vim.fn.getbufinfo { buflisted = 1 } < 2 then
+ if opts.quit then
+ -- exit when there is only one buffer left
+ if force then
+ vim.cmd "qall!"
+ else
+ vim.cmd "confirm qall"
+ end
+ return
+ end
+
+ local chad_term, _ = pcall(function()
+ return vim.api.nvim_buf_get_var(buf, "term_type")
+ end)
+
+ if chad_term then
+ -- Must be a window type
+ vim.cmd(string.format("setlocal nobl", buf))
+ vim.cmd "enew"
+ return
+ end
+ -- don't exit and create a new empty buffer
+ vim.cmd "enew"
+ vim.cmd "bp"
+ end
+
+ local next_buf = get_next_buf(buf)
+ local windows = vim.fn.getbufinfo(buf)[1].windows
+
+ -- force deletion of terminal buffers to avoid the prompt
+ if force or vim.fn.getbufvar(buf, "&buftype") == "terminal" then
+ local chad_term, type = pcall(function()
+ return vim.api.nvim_buf_get_var(buf, "term_type")
+ end)
+
+ -- TODO this scope is error prone, make resilient
+ if chad_term then
+ if type == "wind" then
+ -- hide from bufferline
+ vim.cmd(string.format("%d bufdo setlocal nobl", buf))
+ -- switch to another buff
+ -- TODO switch to next buffer, this works too
+ vim.cmd "BufferLineCycleNext"
+ else
+ local cur_win = vim.fn.winnr()
+ -- we can close this window
+ vim.cmd(string.format("%d wincmd c", cur_win))
+ return
+ end
+ else
+ switch_buffer(windows, next_buf)
+ vim.cmd(string.format("bd! %d", buf))
+ end
+ else
+ switch_buffer(windows, next_buf)
+ vim.cmd(string.format("silent! confirm bd %d", buf))
+ end
+ -- revert buffer switches if user has canceled deletion
+ if vim.fn.buflisted(buf) == 1 then
+ switch_buffer(windows, buf)
+ end
+end
+
+-- hide statusline
+-- tables fetched from load_config function
+M.hide_statusline = function()
+ local hidden = require("core.utils").load_config().plugins.options.statusline.hidden
+ local shown = require("core.utils").load_config().plugins.options.statusline.shown
+ local api = vim.api
+ local buftype = api.nvim_buf_get_option(0, "ft")
+
+ -- shown table from config has the highest priority
+ if vim.tbl_contains(shown, buftype) then
+ api.nvim_set_option("laststatus", 2)
+ return
+ end
+
+ if vim.tbl_contains(hidden, buftype) then
+ api.nvim_set_option("laststatus", 0)
+ return
+ end
+
+ api.nvim_set_option("laststatus", 2)
+end
+
+M.load_config = function()
+ local conf = require "core.default_config"
+
+ local chadrcExists, change = pcall(require, "custom.chadrc")
+
+ -- if chadrc exists , then merge its table into the default config's
+
+ if chadrcExists then
+ conf = vim.tbl_deep_extend("force", conf, change)
+ end
+
+ return conf
+end
+
+M.map = function(mode, keys, command, opt)
+ local options = { noremap = true, silent = true }
+ if opt then
+ options = vim.tbl_extend("force", options, opt)
+ end
+
+ -- all valid modes allowed for mappings
+ -- :h map-modes
+ local valid_modes = {
+ [""] = true,
+ ["n"] = true,
+ ["v"] = true,
+ ["s"] = true,
+ ["x"] = true,
+ ["o"] = true,
+ ["!"] = true,
+ ["i"] = true,
+ ["l"] = true,
+ ["c"] = true,
+ ["t"] = true,
+ }
+
+ -- helper function for M.map
+ -- can gives multiple modes and keys
+ local function map_wrapper(sub_mode, lhs, rhs, sub_options)
+ if type(lhs) == "table" then
+ for _, key in ipairs(lhs) do
+ map_wrapper(sub_mode, key, rhs, sub_options)
+ end
+ else
+ if type(sub_mode) == "table" then
+ for _, m in ipairs(sub_mode) do
+ map_wrapper(m, lhs, rhs, sub_options)
+ end
+ else
+ if valid_modes[sub_mode] and lhs and rhs then
+ vim.api.nvim_set_keymap(sub_mode, lhs, rhs, sub_options)
+ else
+ sub_mode, lhs, rhs = sub_mode or "", lhs or "", rhs or ""
+ print(
+ "Cannot set mapping [ mode = '" .. sub_mode .. "' | key = '" .. lhs .. "' | cmd = '" .. rhs .. "' ]"
+ )
+ end
+ end
+ end
+ end
+
+ map_wrapper(mode, keys, command, options)
+end
+
+-- load plugin after entering vim ui
+M.packer_lazy_load = function(plugin, timer)
+ if plugin then
+ timer = timer or 0
+ vim.defer_fn(function()
+ require("packer").loader(plugin)
+ end, timer)
+ end
+end
+
+-- Highlights functions
+
+-- Define bg color
+-- @param group Group
+-- @param color Color
+
+M.bg = function(group, col)
+ cmd("hi " .. group .. " guibg=" .. col)
+end
+
+-- Define fg color
+-- @param group Group
+-- @param color Color
+M.fg = function(group, col)
+ cmd("hi " .. group .. " guifg=" .. col)
+end
+
+-- Define bg and fg color
+-- @param group Group
+-- @param fgcol Fg Color
+-- @param bgcol Bg Color
+M.fg_bg = function(group, fgcol, bgcol)
+ cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
+end
+
+-- Override default config of a plugin based on the path provided in the chadrc
+-- Arguments:
+-- 1st - name of plugin
+-- 2nd - default config path
+-- 3rd - optional function name which will called from default_config path
+-- e.g: if given args - "telescope", "plugins.configs.telescope", "setup"
+-- then return "require('plugins.configs.telescope').setup()"
+-- if 3rd arg not given, then return "require('plugins.configs.telescope')"
+-- if override is a table, mark set the override flag for the default config to true
+-- override flag being true tells the plugin to call tbl_override_req as part of configuration
+
+M.override_req = function(name, default_config, config_function)
+ local override, apply_table_override =
+ require("core.utils").load_config().plugins.default_plugin_config_replace[name], "false"
+ local result = default_config
+ if type(override) == "string" and override ~= "" then
+ return "require('" .. override .. "')"
+ elseif type(override) == "table" then
+ apply_table_override = "true"
+ elseif type(override) == "function" then
+ return override
+ end
+
+ result = "('" .. result .. "')"
+ if type(config_function) == "string" and config_function ~= "" then
+ -- add the . to call the functions and concatenate true or false as argument
+ result = result .. "." .. config_function .. "(" .. apply_table_override .. ")"
+ end
+
+ return "require" .. result
+end
+
+-- Override parts of default config of a plugin based on the table provided in the chadrc
+
+-- FUNCTION: tbl_override_req, use `chadrc` plugin config override to modify default config if present
+-- name = name inside `default_config` / `chadrc`
+-- default_table = the default configuration table of the plugin
+-- returns the modified configuration table
+M.tbl_override_req = function(name, default_table)
+ local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name] or {}
+ return vim.tbl_deep_extend("force", default_table, override)
+end
+
+--provide labels to plugins instead of integers
+M.label_plugins = function(plugins)
+ local plugins_labeled = {}
+ for _, plugin in ipairs(plugins) do
+ plugins_labeled[plugin[1]] = plugin
+ end
+ return plugins_labeled
+end
+
+-- remove plugins specified by user from the plugins table
+M.remove_default_plugins = function(plugins)
+ local removals = require("core.utils").load_config().plugins.default_plugin_remove or {}
+ if not vim.tbl_isempty(removals) then
+ for _, plugin in pairs(removals) do
+ plugins[plugin] = nil
+ end
+ end
+ return plugins
+end
+
+-- append user plugins to default plugins
+M.add_user_plugins = function(plugins)
+ local user_Plugins = require("core.utils").load_config().plugins.install or {}
+ if type(user_Plugins) == "string"
+ then user_Plugins=require(user_Plugins)
+ end
+ if not vim.tbl_isempty(user_Plugins) then
+ for _, v in pairs(user_Plugins) do
+ plugins[v[1]] = v
+ end
+ end
+ return plugins
+end
+
+return M
diff --git a/NvChad/lua/custom/chadrc.lua b/NvChad/lua/custom/chadrc.lua
new file mode 100644
index 0000000..369fb0a
--- /dev/null
+++ b/NvChad/lua/custom/chadrc.lua
@@ -0,0 +1,30 @@
+local M = {}
+
+local plugin_conf = require "custom.plugins.configs"
+local userPlugins = require "custom.plugins"
+
+M.plugins = {
+ status = {
+ colorizer = true,
+ },
+
+ options = {
+ lspconfig = {
+ setup_lspconf = "custom.plugins.lspconfig",
+ },
+ },
+
+ default_plugin_config_replace = {
+ nvim_treesitter = plugin_conf.treesitter,
+ nvim_tree = plugin_conf.nvimtree,
+ },
+
+ install = userPlugins,
+}
+
+
+M.ui = {
+ theme = "tomorrow-night",
+}
+
+return M
diff --git a/NvChad/lua/custom/init.lua b/NvChad/lua/custom/init.lua
new file mode 100644
index 0000000..fe9a055
--- /dev/null
+++ b/NvChad/lua/custom/init.lua
@@ -0,0 +1 @@
+require "custom.mappings"
diff --git a/NvChad/lua/custom/mappings.lua b/NvChad/lua/custom/mappings.lua
new file mode 100644
index 0000000..0ddd88e
--- /dev/null
+++ b/NvChad/lua/custom/mappings.lua
@@ -0,0 +1,6 @@
+local map = require("core.utils").map
+
+map("n", "<leader>r", ":NvimTreeRefresh<CR>")
+map("n", "<C-b>", ":NvimTreeToggle<CR>")
+map("n", "<C-F>", ":!tmux-sessionizer<CR>")
+
diff --git a/NvChad/lua/custom/plugins/configs.lua b/NvChad/lua/custom/plugins/configs.lua
new file mode 100644
index 0000000..1250cd7
--- /dev/null
+++ b/NvChad/lua/custom/plugins/configs.lua
@@ -0,0 +1,26 @@
+local M = {}
+
+-- overriding default plugin configs!
+M.treesitter = {
+ ensure_installed = {
+ "lua",
+ "vim",
+ "html",
+ "css",
+ "javascript",
+ "json",
+ "toml",
+ "markdown",
+ "c",
+ "rust",
+ "bash",
+ },
+}
+
+M.nvimtree = {
+ git = {
+ enable = true,
+ },
+}
+
+return M \ No newline at end of file
diff --git a/NvChad/lua/custom/plugins/init.lua b/NvChad/lua/custom/plugins/init.lua
new file mode 100644
index 0000000..8c07f0c
--- /dev/null
+++ b/NvChad/lua/custom/plugins/init.lua
@@ -0,0 +1,91 @@
+return {
+
+ {
+ "williamboman/nvim-lsp-installer",
+ requires = 'nvim-lspconfig',
+ after = 'nvim-lspconfig',
+ config = function()
+ local lsp_installer = require "nvim-lsp-installer"
+
+ lsp_installer.settings({
+ ui = {
+ icons = {
+ server_installed = "✓",
+ server_pending = "➜",
+ server_uninstalled = "✗"
+ }
+ }
+ })
+
+ lsp_installer.on_server_ready(function(server)
+ local opts = {}
+
+ server:setup(opts)
+ vim.cmd [[ do User LspAttachBuffers ]]
+ end)
+ end,
+ },
+
+
+ {
+ 'TimUntersberger/neogit',
+ cmd = 'Neogit',
+ config = function()
+ require('neogit').setup {
+ disable_commit_confirmation = true,
+ disable_signs = true
+ }
+ end
+ },
+
+ {
+ "jose-elias-alvarez/null-ls.nvim",
+ after = "nvim-lspconfig",
+ config = function()
+ require("custom.plugins.null-ls").setup()
+ end,
+
+ },
+
+
+ {
+ "nvim-telescope/telescope-frecency.nvim",
+ after = "telescope.nvim",
+ config = function()
+ require("telescope").load_extension("frecency")
+ end,
+ requires = 'tami5/sqlite.lua',
+ },
+
+ {
+ "nvim-telescope/telescope-fzf-native.nvim",
+ after = "telescope.nvim",
+ config = function()
+ require("telescope").setup {
+ extensions = {
+ fzf = {
+ fuzzy = true, -- false will only do exact matching
+ override_generic_sorter = true, -- override the generic sorter
+ override_file_sorter = true, -- override the file sorter
+ case_mode = "smart_case", -- or "ignore_case" or "respect_case"
+ }
+ }
+ }
+ require("telescope").load_extension("fzf")
+ end,
+ run = 'make',
+ },
+
+ {
+ "karb94/neoscroll.nvim",
+ opt = true,
+ config = function()
+ require("neoscroll").setup()
+ end,
+
+ -- lazy loading
+ setup = function()
+ require("core.utils").packer_lazy_load "neoscroll.nvim"
+ end,
+}
+}
diff --git a/NvChad/lua/custom/plugins/lspconfig.lua b/NvChad/lua/custom/plugins/lspconfig.lua
new file mode 100644
index 0000000..2a6e969
--- /dev/null
+++ b/NvChad/lua/custom/plugins/lspconfig.lua
@@ -0,0 +1,29 @@
+local M = {}
+
+M.setup_lsp = function(attach, capabilities)
+ local lspconfig = require "lspconfig"
+
+ lspconfig.tsserver.setup {
+ on_attach = function(client, bufnr)
+ client.resolved_capabilities.document_formatting = false
+ vim.api.nvim_buf_set_keymap(bufnr, "n", "A-F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {})
+ end,
+ }
+
+ -- lspservers with default config
+ local servers = { "html", "cssls", "bashls", "clangd", "emmet_ls" }
+
+
+ for _, lsp in ipairs(servers) do
+ lspconfig[lsp].setup {
+ on_attach = attach,
+ capabilities = capabilities,
+ flags = {
+ debounce_text_changes = 150,
+ },
+ }
+ end
+
+end
+
+return M
diff --git a/NvChad/lua/custom/plugins/null-ls.lua b/NvChad/lua/custom/plugins/null-ls.lua
new file mode 100644
index 0000000..f0b540f
--- /dev/null
+++ b/NvChad/lua/custom/plugins/null-ls.lua
@@ -0,0 +1,29 @@
+local null_s = require "null-ls"
+
+local b = null_ls.builtins
+
+local sources = {
+
+ -- webdev stuff
+ b.formatting.deno_fmt,
+ b.formatting.prettierd.with { filetypes = { "html", "markdown", "css" } },
+
+ -- Lua
+ b.formatting.stylua,
+ b.diagnostics.luacheck.with { extra_args = { "--global vim" } },
+
+ -- Shell
+ b.formatting.shfmt,
+ b.diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" },
+}
+
+local M = {}
+
+M.setup = function()
+ null_ls.setup {
+ debug = true,
+ sources = sources,
+ }
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/alpha.lua b/NvChad/lua/plugins/configs/alpha.lua
new file mode 100644
index 0000000..7171306
--- /dev/null
+++ b/NvChad/lua/plugins/configs/alpha.lua
@@ -0,0 +1,86 @@
+local present, alpha = pcall(require, "alpha")
+
+if not present then
+ return
+end
+
+local ascii = {
+ " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
+ " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
+ " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
+ " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
+ " ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
+ " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
+ " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
+ " ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
+ " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
+ " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
+ " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
+}
+
+local header = {
+ type = "text",
+ val = ascii,
+ opts = {
+ position = "center",
+ hl = "AlphaHeader",
+ },
+}
+
+local function button(sc, txt, keybind)
+ local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
+
+ local opts = {
+ position = "center",
+ text = txt,
+ shortcut = sc,
+ cursor = 5,
+ width = 36,
+ align_shortcut = "right",
+ hl = "AlphaButtons",
+ }
+
+ if keybind then
+ opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
+ end
+
+ return {
+ type = "button",
+ val = txt,
+ on_press = function()
+ local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
+ vim.api.nvim_feedkeys(key, "normal", false)
+ end,
+ opts = opts,
+ }
+end
+
+local buttons = {
+ type = "group",
+ val = {
+ button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
+ button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
+ button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
+ button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
+ button("SPC t h", " Themes ", ":Telescope themes<CR>"),
+ button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
+ },
+ opts = {
+ spacing = 1,
+ },
+}
+
+local section = {
+ header = header,
+ buttons = buttons,
+}
+
+alpha.setup {
+ layout = {
+ { type = "padding", val = 5 },
+ section.header,
+ { type = "padding", val = 2 },
+ section.buttons,
+ },
+ opts = {},
+}
diff --git a/NvChad/lua/plugins/configs/bufferline.lua b/NvChad/lua/plugins/configs/bufferline.lua
new file mode 100644
index 0000000..98557fd
--- /dev/null
+++ b/NvChad/lua/plugins/configs/bufferline.lua
@@ -0,0 +1,148 @@
+local present, bufferline = pcall(require, "bufferline")
+if not present then
+ return
+end
+
+local default = {
+ colors = require("colors").get(),
+}
+default = {
+ options = {
+ offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
+ buffer_close_icon = "",
+ modified_icon = "",
+ close_icon = "",
+ show_close_icon = true,
+ left_trunc_marker = "",
+ right_trunc_marker = "",
+ max_name_length = 14,
+ max_prefix_length = 13,
+ tab_size = 20,
+ show_tab_indicators = true,
+ enforce_regular_tabs = false,
+ view = "multiwindow",
+ show_buffer_close_icons = true,
+ separator_style = "thin",
+ always_show_bufferline = true,
+ diagnostics = false,
+ custom_filter = function(buf_number)
+ -- Func to filter out our managed/persistent split terms
+ local present_type, type = pcall(function()
+ return vim.api.nvim_buf_get_var(buf_number, "term_type")
+ end)
+
+ if present_type then
+ if type == "vert" then
+ return false
+ elseif type == "hori" then
+ return false
+ end
+ return true
+ end
+
+ return true
+ end,
+ },
+
+ highlights = {
+ background = {
+ guifg = default.colors.grey_fg,
+ guibg = default.colors.black2,
+ },
+
+ -- buffers
+ buffer_selected = {
+ guifg = default.colors.white,
+ guibg = default.colors.black,
+ gui = "bold",
+ },
+ buffer_visible = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.black2,
+ },
+
+ -- for diagnostics = "nvim_lsp"
+ error = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.black2,
+ },
+ error_diagnostic = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.black2,
+ },
+
+ -- close buttons
+ close_button = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.black2,
+ },
+ close_button_visible = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.black2,
+ },
+ close_button_selected = {
+ guifg = default.colors.red,
+ guibg = default.colors.black,
+ },
+ fill = {
+ guifg = default.colors.grey_fg,
+ guibg = default.colors.black2,
+ },
+ indicator_selected = {
+ guifg = default.colors.black,
+ guibg = default.colors.black,
+ },
+
+ -- modified
+ modified = {
+ guifg = default.colors.red,
+ guibg = default.colors.black2,
+ },
+ modified_visible = {
+ guifg = default.colors.red,
+ guibg = default.colors.black2,
+ },
+ modified_selected = {
+ guifg = default.colors.green,
+ guibg = default.colors.black,
+ },
+
+ -- separators
+ separator = {
+ guifg = default.colors.black2,
+ guibg = default.colors.black2,
+ },
+ separator_visible = {
+ guifg = default.colors.black2,
+ guibg = default.colors.black2,
+ },
+ separator_selected = {
+ guifg = default.colors.black2,
+ guibg = default.colors.black2,
+ },
+
+ -- tabs
+ tab = {
+ guifg = default.colors.light_grey,
+ guibg = default.colors.one_bg3,
+ },
+ tab_selected = {
+ guifg = default.colors.black2,
+ guibg = default.colors.nord_blue,
+ },
+ tab_close = {
+ guifg = default.colors.red,
+ guibg = default.colors.black,
+ },
+ },
+}
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("bufferline", default)
+ end
+ bufferline.setup(default)
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/cmp.lua b/NvChad/lua/plugins/configs/cmp.lua
new file mode 100644
index 0000000..94944b7
--- /dev/null
+++ b/NvChad/lua/plugins/configs/cmp.lua
@@ -0,0 +1,76 @@
+local present, cmp = pcall(require, "cmp")
+
+if not present then
+ return
+end
+
+vim.opt.completeopt = "menuone,noselect"
+
+local default = {
+ snippet = {
+ expand = function(args)
+ require("luasnip").lsp_expand(args.body)
+ end,
+ },
+ formatting = {
+ format = function(entry, vim_item)
+ local icons = require "plugins.configs.lspkind_icons"
+ vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
+
+ vim_item.menu = ({
+ nvim_lsp = "[LSP]",
+ nvim_lua = "[Lua]",
+ buffer = "[BUF]",
+ })[entry.source.name]
+
+ return vim_item
+ end,
+ },
+ mapping = {
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-n>"] = cmp.mapping.select_next_item(),
+ ["<C-d>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<C-e>"] = cmp.mapping.close(),
+ ["<CR>"] = cmp.mapping.confirm {
+ behavior = cmp.ConfirmBehavior.Replace,
+ select = true,
+ },
+ ["<Tab>"] = function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif require("luasnip").expand_or_jumpable() then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
+ else
+ fallback()
+ end
+ end,
+ ["<S-Tab>"] = function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ elseif require("luasnip").jumpable(-1) then
+ vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
+ else
+ fallback()
+ end
+ end,
+ },
+ sources = {
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "buffer" },
+ { name = "nvim_lua" },
+ { name = "path" },
+ },
+}
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_cmp", default)
+ end
+ cmp.setup(default)
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/icons.lua b/NvChad/lua/plugins/configs/icons.lua
new file mode 100644
index 0000000..4f23dd9
--- /dev/null
+++ b/NvChad/lua/plugins/configs/icons.lua
@@ -0,0 +1,158 @@
+local present, icons = pcall(require, "nvim-web-devicons")
+if not present then
+ return
+end
+
+local default = {
+ colors = require("colors").get(),
+}
+
+default = {
+ override = {
+ c = {
+ icon = "",
+ color = default.colors.blue,
+ name = "c",
+ },
+ css = {
+ icon = "",
+ color = default.colors.blue,
+ name = "css",
+ },
+ deb = {
+ icon = "",
+ color = default.colors.cyan,
+ name = "deb",
+ },
+ Dockerfile = {
+ icon = "",
+ color = default.colors.cyan,
+ name = "Dockerfile",
+ },
+ html = {
+ icon = "",
+ color = default.colors.baby_pink,
+ name = "html",
+ },
+ jpeg = {
+ icon = "",
+ color = default.colors.dark_purple,
+ name = "jpeg",
+ },
+ jpg = {
+ icon = "",
+ color = default.colors.dark_purple,
+ name = "jpg",
+ },
+ js = {
+ icon = "",
+ color = default.colors.sun,
+ name = "js",
+ },
+ kt = {
+ icon = "󱈙",
+ color = default.colors.orange,
+ name = "kt",
+ },
+ lock = {
+ icon = "",
+ color = default.colors.red,
+ name = "lock",
+ },
+ lua = {
+ icon = "",
+ color = default.colors.blue,
+ name = "lua",
+ },
+ mp3 = {
+ icon = "",
+ color = default.colors.white,
+ name = "mp3",
+ },
+ mp4 = {
+ icon = "",
+ color = default.colors.white,
+ name = "mp4",
+ },
+ out = {
+ icon = "",
+ color = default.colors.white,
+ name = "out",
+ },
+ png = {
+ icon = "",
+ color = default.colors.dark_purple,
+ name = "png",
+ },
+ py = {
+ icon = "",
+ color = default.colors.cyan,
+ name = "py",
+ },
+ ["robots.txt"] = {
+ icon = "ﮧ",
+ color = default.colors.red,
+ name = "robots",
+ },
+ toml = {
+ icon = "",
+ color = default.colors.blue,
+ name = "toml",
+ },
+ ts = {
+ icon = "ﯤ",
+ color = default.colors.teal,
+ name = "ts",
+ },
+ ttf = {
+ icon = "",
+ color = default.colors.white,
+ name = "TrueTypeFont",
+ },
+ rb = {
+ icon = "",
+ color = default.colors.pink,
+ name = "rb",
+ },
+ rpm = {
+ icon = "",
+ color = default.colors.orange,
+ name = "rpm",
+ },
+ vue = {
+ icon = "﵂",
+ color = default.colors.vibrant_green,
+ name = "vue",
+ },
+ woff = {
+ icon = "",
+ color = default.colors.white,
+ name = "WebOpenFontFormat",
+ },
+ woff2 = {
+ icon = "",
+ color = default.colors.white,
+ name = "WebOpenFontFormat2",
+ },
+ xz = {
+ icon = "",
+ color = default.colors.sun,
+ name = "xz",
+ },
+ zip = {
+ icon = "",
+ color = default.colors.sun,
+ name = "zip",
+ },
+ },
+}
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_web_devicons", default)
+ end
+ icons.setup(default)
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/lspconfig.lua b/NvChad/lua/plugins/configs/lspconfig.lua
new file mode 100644
index 0000000..2d1273b
--- /dev/null
+++ b/NvChad/lua/plugins/configs/lspconfig.lua
@@ -0,0 +1,36 @@
+require("plugins.configs.others").lsp_handlers()
+
+local function on_attach(_, bufnr)
+ local function buf_set_option(...)
+ vim.api.nvim_buf_set_option(bufnr, ...)
+ end
+
+ -- Enable completion triggered by <c-x><c-o>
+ buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
+
+ require("core.mappings").lspconfig()
+end
+
+local capabilities = vim.lsp.protocol.make_client_capabilities()
+capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" }
+capabilities.textDocument.completion.completionItem.snippetSupport = true
+capabilities.textDocument.completion.completionItem.preselectSupport = true
+capabilities.textDocument.completion.completionItem.insertReplaceSupport = true
+capabilities.textDocument.completion.completionItem.labelDetailsSupport = true
+capabilities.textDocument.completion.completionItem.deprecatedSupport = true
+capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
+capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } }
+capabilities.textDocument.completion.completionItem.resolveSupport = {
+ properties = {
+ "documentation",
+ "detail",
+ "additionalTextEdits",
+ },
+}
+
+-- requires a file containing user's lspconfigs
+local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
+
+if #addlsp_confs ~= 0 then
+ require(addlsp_confs).setup_lsp(on_attach, capabilities)
+end
diff --git a/NvChad/lua/plugins/configs/lspkind_icons.lua b/NvChad/lua/plugins/configs/lspkind_icons.lua
new file mode 100644
index 0000000..2d538a7
--- /dev/null
+++ b/NvChad/lua/plugins/configs/lspkind_icons.lua
@@ -0,0 +1,29 @@
+local icons = {
+ Text = "",
+ Method = "",
+ Function = "",
+ Constructor = "",
+ Field = "ﰠ",
+ Variable = "",
+ Class = "ﴯ",
+ Interface = "",
+ Module = "",
+ Property = "ﰠ",
+ Unit = "塞",
+ Value = "",
+ Enum = "",
+ Keyword = "",
+ Snippet = "",
+ Color = "",
+ File = "",
+ Reference = "",
+ Folder = "",
+ EnumMember = "",
+ Constant = "",
+ Struct = "פּ",
+ Event = "",
+ Operator = "",
+ TypeParameter = "",
+}
+
+return icons
diff --git a/NvChad/lua/plugins/configs/nvimtree.lua b/NvChad/lua/plugins/configs/nvimtree.lua
new file mode 100644
index 0000000..d74f4f5
--- /dev/null
+++ b/NvChad/lua/plugins/configs/nvimtree.lua
@@ -0,0 +1,80 @@
+local present, nvimtree = pcall(require, "nvim-tree")
+
+if not present then
+ return
+end
+
+local g = vim.g
+
+g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
+g.nvim_tree_git_hl = 0
+g.nvim_tree_highlight_opened_files = 0
+g.nvim_tree_indent_markers = 1
+g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
+
+g.nvim_tree_show_icons = {
+ folders = 1,
+ files = 1,
+ git = 1,
+}
+
+g.nvim_tree_icons = {
+ default = "",
+ symlink = "",
+ git = {
+ deleted = "",
+ ignored = "◌",
+ renamed = "➜",
+ staged = "✓",
+ unmerged = "",
+ unstaged = "✗",
+ untracked = "★",
+ },
+ folder = {
+ default = "",
+ empty = "",
+ empty_open = "",
+ open = "",
+ symlink = "",
+ symlink_open = "",
+ },
+}
+
+local default = {
+ filters = {
+ dotfiles = false,
+ },
+ disable_netrw = true,
+ hijack_netrw = true,
+ ignore_ft_on_setup = { "dashboard" },
+ auto_close = false,
+ open_on_tab = false,
+ hijack_cursor = true,
+ hijack_unnamed_buffer_when_opening = false,
+ update_cwd = true,
+ update_focused_file = {
+ enable = true,
+ update_cwd = false,
+ },
+ view = {
+ allow_resize = true,
+ side = "left",
+ width = 25,
+ hide_root_folder = true,
+ },
+ git = {
+ enable = false,
+ ignore = false,
+ },
+}
+
+local M = {}
+
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_tree", default)
+ end
+ nvimtree.setup(default)
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/others.lua b/NvChad/lua/plugins/configs/others.lua
new file mode 100644
index 0000000..99877cc
--- /dev/null
+++ b/NvChad/lua/plugins/configs/others.lua
@@ -0,0 +1,196 @@
+local M = {}
+
+local chadrc_config = require("core.utils").load_config()
+
+M.autopairs = function(override_flag)
+ local present1, autopairs = pcall(require, "nvim-autopairs")
+ local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
+
+ if present1 and present2 then
+ local default = { fast_wrap = {} }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_autopairs", default)
+ end
+ autopairs.setup(default)
+
+ local cmp = require "cmp"
+ cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
+ end
+end
+
+M.better_escape = function()
+ require("better_escape").setup {
+ mapping = chadrc_config.mappings.plugins.better_escape.esc_insertmode,
+ timeout = chadrc_config.plugins.options.esc_insertmode_timeout,
+ }
+end
+
+M.blankline = function(override_flag)
+ local default = {
+ indentLine_enabled = 1,
+ char = "▏",
+ filetype_exclude = {
+ "help",
+ "terminal",
+ "alpha",
+ "packer",
+ "lspinfo",
+ "TelescopePrompt",
+ "TelescopeResults",
+ "nvchad_cheatsheet",
+ "lsp-installer",
+ "",
+ },
+ buftype_exclude = { "terminal" },
+ show_trailing_blankline_indent = false,
+ show_first_indent_level = false,
+ }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("indent_blankline", default)
+ end
+ require("indent_blankline").setup(default)
+end
+
+M.colorizer = function(override_flag)
+ local present, colorizer = pcall(require, "colorizer")
+ if present then
+ local default = {
+ filetypes = {
+ "*",
+ },
+ user_default_options = {
+ RGB = true, -- #RGB hex codes
+ RRGGBB = true, -- #RRGGBB hex codes
+ names = false, -- "Name" codes like Blue
+ RRGGBBAA = false, -- #RRGGBBAA hex codes
+ rgb_fn = false, -- CSS rgb() and rgba() functions
+ hsl_fn = false, -- CSS hsl() and hsla() functions
+ css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+ css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
+
+ -- Available modes: foreground, background
+ mode = "background", -- Set the display mode.
+ },
+ }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_colorizer", default)
+ end
+ colorizer.setup(default["filetypes"], default["user_default_options"])
+ vim.cmd "ColorizerReloadAllBuffers"
+ end
+end
+
+M.comment = function(override_flag)
+ local present, nvim_comment = pcall(require, "Comment")
+ if present then
+ local default = {}
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_comment", default)
+ end
+ nvim_comment.setup(default)
+ end
+end
+
+M.luasnip = function(override_flag)
+ local present, luasnip = pcall(require, "luasnip")
+ if present then
+ local default = {
+ history = true,
+ updateevents = "TextChanged,TextChangedI",
+ }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("luasnip", default)
+ end
+ luasnip.config.set_config(default)
+ require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
+ require("luasnip/loaders/from_vscode").load()
+ end
+end
+
+M.signature = function(override_flag)
+ local present, lspsignature = pcall(require, "lsp_signature")
+ if present then
+ local default = {
+ bind = true,
+ doc_lines = 0,
+ floating_window = true,
+ fix_pos = true,
+ hint_enable = true,
+ hint_prefix = " ",
+ hint_scheme = "String",
+ hi_parameter = "Search",
+ max_height = 22,
+ max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
+ handler_opts = {
+ border = "single", -- double, single, shadow, none
+ },
+ zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
+ padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
+ }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("signature", default)
+ end
+ lspsignature.setup(default)
+ end
+end
+
+M.lsp_handlers = function()
+ local function lspSymbol(name, icon)
+ local hl = "DiagnosticSign" .. name
+ vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
+ end
+
+ lspSymbol("Error", "")
+ lspSymbol("Info", "")
+ lspSymbol("Hint", "")
+ lspSymbol("Warn", "")
+
+ vim.diagnostic.config {
+ virtual_text = {
+ prefix = "",
+ },
+ signs = true,
+ underline = true,
+ update_in_insert = false,
+ }
+
+ vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
+ border = "single",
+ })
+ vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
+ border = "single",
+ })
+
+ -- suppress error messages from lang servers
+ vim.notify = function(msg, log_level)
+ if msg:match "exit code" then
+ return
+ end
+ if log_level == vim.log.levels.ERROR then
+ vim.api.nvim_err_writeln(msg)
+ else
+ vim.api.nvim_echo({ { msg } }, true, {})
+ end
+ end
+end
+
+M.gitsigns = function(override_flag)
+ local present, gitsigns = pcall(require, "gitsigns")
+ if present then
+ local default = {
+ signs = {
+ add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
+ change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
+ delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
+ topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
+ changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
+ },
+ }
+ if override_flag then
+ default = require("core.utils").tbl_override_req("gitsigns", default)
+ end
+ gitsigns.setup(default)
+ end
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/statusline.lua b/NvChad/lua/plugins/configs/statusline.lua
new file mode 100644
index 0000000..ddad9d5
--- /dev/null
+++ b/NvChad/lua/plugins/configs/statusline.lua
@@ -0,0 +1,438 @@
+local present, feline = pcall(require, "feline")
+if not present then
+ return
+end
+
+local default = {
+ colors = require("colors").get(),
+ lsp = require "feline.providers.lsp",
+ lsp_severity = vim.diagnostic.severity,
+ config = require("core.utils").load_config().plugins.options.statusline,
+}
+
+default.icon_styles = {
+ default = {
+ left = "",
+ right = " ",
+ main_icon = "  ",
+ vi_mode_icon = " ",
+ position_icon = " ",
+ },
+ arrow = {
+ left = "",
+ right = "",
+ main_icon = "  ",
+ vi_mode_icon = " ",
+ position_icon = " ",
+ },
+
+ block = {
+ left = " ",
+ right = " ",
+ main_icon = "  ",
+ vi_mode_icon = "  ",
+ position_icon = "  ",
+ },
+
+ round = {
+ left = "",
+ right = "",
+ main_icon = "  ",
+ vi_mode_icon = " ",
+ position_icon = " ",
+ },
+
+ slant = {
+ left = " ",
+ right = " ",
+ main_icon = "  ",
+ vi_mode_icon = " ",
+ position_icon = " ",
+ },
+}
+
+-- statusline style
+default.statusline_style = default.icon_styles[default.config.style]
+
+-- show short statusline on small screens
+default.shortline = default.config.shortline == false and true
+
+-- Initialize the components table
+default.components = {
+ active = {},
+}
+
+default.main_icon = {
+ provider = default.statusline_style.main_icon,
+
+ hl = {
+ fg = default.colors.statusline_bg,
+ bg = default.colors.nord_blue,
+ },
+
+ right_sep = {
+ str = default.statusline_style.right,
+ hl = {
+ fg = default.colors.nord_blue,
+ bg = default.colors.lightbg,
+ },
+ },
+}
+
+default.file_name = {
+ provider = function()
+ local filename = vim.fn.expand "%:t"
+ local extension = vim.fn.expand "%:e"
+ local icon = require("nvim-web-devicons").get_icon(filename, extension)
+ if icon == nil then
+ icon = " "
+ return icon
+ end
+ return " " .. icon .. " " .. filename .. " "
+ end,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
+ end,
+ hl = {
+ fg = default.colors.white,
+ bg = default.colors.lightbg,
+ },
+
+ right_sep = {
+ str = default.statusline_style.right,
+ hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
+ },
+}
+
+default.dir_name = {
+ provider = function()
+ local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
+ return "  " .. dir_name .. " "
+ end,
+
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
+ end,
+
+ hl = {
+ fg = default.colors.grey_fg2,
+ bg = default.colors.lightbg2,
+ },
+ right_sep = {
+ str = default.statusline_style.right,
+ hi = {
+ fg = default.colors.lightbg2,
+ bg = default.colors.statusline_bg,
+ },
+ },
+}
+
+default.diff = {
+ add = {
+ provider = "git_diff_added",
+ hl = {
+ fg = default.colors.grey_fg2,
+ bg = default.colors.statusline_bg,
+ },
+ icon = " ",
+ },
+
+ change = {
+ provider = "git_diff_changed",
+ hl = {
+ fg = default.colors.grey_fg2,
+ bg = default.colors.statusline_bg,
+ },
+ icon = "  ",
+ },
+
+ remove = {
+ provider = "git_diff_removed",
+ hl = {
+ fg = default.colors.grey_fg2,
+ bg = default.colors.statusline_bg,
+ },
+ icon = "  ",
+ },
+}
+
+default.git_branch = {
+ provider = "git_branch",
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
+ end,
+ hl = {
+ fg = default.colors.grey_fg2,
+ bg = default.colors.statusline_bg,
+ },
+ icon = "  ",
+}
+
+default.diagnostic = {
+ error = {
+ provider = "diagnostic_errors",
+ enabled = function()
+ return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
+ end,
+
+ hl = { fg = default.colors.red },
+ icon = "  ",
+ },
+
+ warning = {
+ provider = "diagnostic_warnings",
+ enabled = function()
+ return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
+ end,
+ hl = { fg = default.colors.yellow },
+ icon = "  ",
+ },
+
+ hint = {
+ provider = "diagnostic_hints",
+ enabled = function()
+ return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
+ end,
+ hl = { fg = default.colors.grey_fg2 },
+ icon = "  ",
+ },
+
+ info = {
+ provider = "diagnostic_info",
+ enabled = function()
+ return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
+ end,
+ hl = { fg = default.colors.green },
+ icon = "  ",
+ },
+}
+
+default.lsp_progress = {
+ provider = function()
+ local Lsp = vim.lsp.util.get_progress_messages()[1]
+
+ if Lsp then
+ local msg = Lsp.message or ""
+ local percentage = Lsp.percentage or 0
+ local title = Lsp.title or ""
+ local spinners = {
+ "",
+ "",
+ "",
+ }
+
+ local success_icon = {
+ "",
+ "",
+ "",
+ }
+
+ local ms = vim.loop.hrtime() / 1000000
+ local frame = math.floor(ms / 120) % #spinners
+
+ if percentage >= 70 then
+ return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
+ end
+
+ return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
+ end
+
+ return ""
+ end,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
+ end,
+ hl = { fg = default.colors.green },
+}
+
+default.lsp_icon = {
+ provider = function()
+ if next(vim.lsp.buf_get_clients()) ~= nil then
+ return " LSP"
+ else
+ return ""
+ end
+ end,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
+ end,
+ hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
+}
+
+default.mode_colors = {
+ ["n"] = { "NORMAL", default.colors.red },
+ ["no"] = { "N-PENDING", default.colors.red },
+ ["i"] = { "INSERT", default.colors.dark_purple },
+ ["ic"] = { "INSERT", default.colors.dark_purple },
+ ["t"] = { "TERMINAL", default.colors.green },
+ ["v"] = { "VISUAL", default.colors.cyan },
+ ["V"] = { "V-LINE", default.colors.cyan },
+ [""] = { "V-BLOCK", default.colors.cyan },
+ ["R"] = { "REPLACE", default.colors.orange },
+ ["Rv"] = { "V-REPLACE", default.colors.orange },
+ ["s"] = { "SELECT", default.colors.nord_blue },
+ ["S"] = { "S-LINE", default.colors.nord_blue },
+ [""] = { "S-BLOCK", default.colors.nord_blue },
+ ["c"] = { "COMMAND", default.colors.pink },
+ ["cv"] = { "COMMAND", default.colors.pink },
+ ["ce"] = { "COMMAND", default.colors.pink },
+ ["r"] = { "PROMPT", default.colors.teal },
+ ["rm"] = { "MORE", default.colors.teal },
+ ["r?"] = { "CONFIRM", default.colors.teal },
+ ["!"] = { "SHELL", default.colors.green },
+}
+
+default.chad_mode_hl = function()
+ return {
+ fg = default.mode_colors[vim.fn.mode()][2],
+ bg = default.colors.one_bg,
+ }
+end
+
+default.empty_space = {
+ provider = " " .. default.statusline_style.left,
+ hl = {
+ fg = default.colors.one_bg2,
+ bg = default.colors.statusline_bg,
+ },
+}
+
+-- this matches the vi mode color
+default.empty_spaceColored = {
+ provider = default.statusline_style.left,
+ hl = function()
+ return {
+ fg = default.mode_colors[vim.fn.mode()][2],
+ bg = default.colors.one_bg2,
+ }
+ end,
+}
+
+default.mode_icon = {
+ provider = default.statusline_style.vi_mode_icon,
+ hl = function()
+ return {
+ fg = default.colors.statusline_bg,
+ bg = default.mode_colors[vim.fn.mode()][2],
+ }
+ end,
+}
+
+default.empty_space2 = {
+ provider = function()
+ return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
+ end,
+ hl = default.chad_mode_hl,
+}
+
+default.separator_right = {
+ provider = default.statusline_style.left,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
+ end,
+ hl = {
+ fg = default.colors.grey,
+ bg = default.colors.one_bg,
+ },
+}
+
+default.separator_right2 = {
+ provider = default.statusline_style.left,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
+ end,
+ hl = {
+ fg = default.colors.green,
+ bg = default.colors.grey,
+ },
+}
+
+default.position_icon = {
+ provider = default.statusline_style.position_icon,
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
+ end,
+ hl = {
+ fg = default.colors.black,
+ bg = default.colors.green,
+ },
+}
+
+default.current_line = {
+ provider = function()
+ local current_line = vim.fn.line "."
+ local total_line = vim.fn.line "$"
+
+ if current_line == 1 then
+ return " Top "
+ elseif current_line == vim.fn.line "$" then
+ return " Bot "
+ end
+ local result, _ = math.modf((current_line / total_line) * 100)
+ return " " .. result .. "%% "
+ end,
+
+ enabled = default.shortline or function(winid)
+ return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
+ end,
+
+ hl = {
+ fg = default.colors.green,
+ bg = default.colors.one_bg,
+ },
+}
+
+local function add_table(a, b)
+ table.insert(a, b)
+end
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("feline", default)
+ end
+ -- components are divided in 3 sections
+ default.left = {}
+ default.middle = {}
+ default.right = {}
+
+ -- left
+ add_table(default.left, default.main_icon)
+ add_table(default.left, default.file_name)
+ add_table(default.left, default.dir_name)
+ add_table(default.left, default.diff.add)
+ add_table(default.left, default.diff.change)
+ add_table(default.left, default.diff.remove)
+ add_table(default.left, default.diagnostic.error)
+ add_table(default.left, default.diagnostic.warning)
+ add_table(default.left, default.diagnostic.hint)
+ add_table(default.left, default.diagnostic.info)
+
+ add_table(default.middle, default.lsp_progress)
+
+ -- right
+ add_table(default.right, default.lsp_icon)
+ add_table(default.right, default.git_branch)
+ add_table(default.right, default.empty_space)
+ add_table(default.right, default.empty_spaceColored)
+ add_table(default.right, default.mode_icon)
+ add_table(default.right, default.empty_space2)
+ add_table(default.right, default.separator_right)
+ add_table(default.right, default.separator_right2)
+ add_table(default.right, default.position_icon)
+ add_table(default.right, default.current_line)
+
+ default.components.active[1] = default.left
+ default.components.active[2] = default.middle
+ default.components.active[3] = default.right
+
+ feline.setup {
+ theme = {
+ bg = default.colors.statusline_bg,
+ fg = default.colors.fg,
+ },
+ components = default.components,
+ }
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/telescope.lua b/NvChad/lua/plugins/configs/telescope.lua
new file mode 100644
index 0000000..5d4ea01
--- /dev/null
+++ b/NvChad/lua/plugins/configs/telescope.lua
@@ -0,0 +1,72 @@
+local present, telescope = pcall(require, "telescope")
+
+if not present then
+ return
+end
+
+local default = {
+ defaults = {
+ vimgrep_arguments = {
+ "rg",
+ "--color=never",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ "--smart-case",
+ },
+ prompt_prefix = "  ",
+ selection_caret = " ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "ascending",
+ layout_strategy = "horizontal",
+ layout_config = {
+ horizontal = {
+ prompt_position = "top",
+ preview_width = 0.55,
+ results_width = 0.8,
+ },
+ vertical = {
+ mirror = false,
+ },
+ width = 0.87,
+ height = 0.80,
+ preview_cutoff = 120,
+ },
+ file_sorter = require("telescope.sorters").get_fuzzy_file,
+ file_ignore_patterns = { "node_modules" },
+ generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
+ path_display = { "truncate" },
+ winblend = 0,
+ border = {},
+ borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
+ color_devicons = true,
+ use_less = true,
+ set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
+ file_previewer = require("telescope.previewers").vim_buffer_cat.new,
+ grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
+ qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
+ -- Developer configurations: Not meant for general override
+ buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
+ },
+}
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("telescope", default)
+ end
+
+ telescope.setup(default)
+
+ local extensions = { "themes", "terms" }
+ pcall(function()
+ for _, ext in ipairs(extensions) do
+ telescope.load_extension(ext)
+ end
+ end)
+end
+
+return M
diff --git a/NvChad/lua/plugins/configs/treesitter.lua b/NvChad/lua/plugins/configs/treesitter.lua
new file mode 100644
index 0000000..777b907
--- /dev/null
+++ b/NvChad/lua/plugins/configs/treesitter.lua
@@ -0,0 +1,26 @@
+local present, ts_config = pcall(require, "nvim-treesitter.configs")
+
+if not present then
+ return
+end
+
+local default = {
+ ensure_installed = {
+ "lua",
+ "vim",
+ },
+ highlight = {
+ enable = true,
+ use_languagetree = true,
+ },
+}
+
+local M = {}
+M.setup = function(override_flag)
+ if override_flag then
+ default = require("core.utils").tbl_override_req("nvim_treesitter", default)
+ end
+ ts_config.setup(default)
+end
+
+return M
diff --git a/NvChad/lua/plugins/init.lua b/NvChad/lua/plugins/init.lua
new file mode 100644
index 0000000..2e83bdd
--- /dev/null
+++ b/NvChad/lua/plugins/init.lua
@@ -0,0 +1,237 @@
+local plugin_settings = require("core.utils").load_config().plugins
+local present, packer = pcall(require, plugin_settings.options.packer.init_file)
+
+if not present then
+ return false
+end
+
+local override_req = require("core.utils").override_req
+
+local plugins = {
+ { "NvChad/extensions" },
+ { "nvim-lua/plenary.nvim" },
+ { "lewis6991/impatient.nvim" },
+ { "nathom/filetype.nvim" },
+
+ {
+ "wbthomason/packer.nvim",
+ event = "VimEnter",
+ },
+
+ {
+ "NvChad/nvim-base16.lua",
+ after = "packer.nvim",
+ config = function()
+ require("colors").init()
+ end,
+ },
+
+ {
+ "kyazdani42/nvim-web-devicons",
+ after = "nvim-base16.lua",
+ config = override_req("nvim_web_devicons", "plugins.configs.icons", "setup"),
+ },
+
+ {
+ "feline-nvim/feline.nvim",
+ disable = not plugin_settings.status.feline,
+ after = "nvim-web-devicons",
+ config = override_req("feline", "plugins.configs.statusline", "setup"),
+ },
+
+ {
+ "akinsho/bufferline.nvim",
+ disable = not plugin_settings.status.bufferline,
+ after = "nvim-web-devicons",
+ config = override_req("bufferline", "plugins.configs.bufferline", "setup"),
+ setup = function()
+ require("core.mappings").bufferline()
+ end,
+ },
+
+ {
+ "lukas-reineke/indent-blankline.nvim",
+ disable = not plugin_settings.status.blankline,
+ event = "BufRead",
+ config = override_req("indent_blankline", "plugins.configs.others", "blankline"),
+ },
+
+ {
+ "NvChad/nvim-colorizer.lua",
+ disable = not plugin_settings.status.colorizer,
+ event = "BufRead",
+ config = override_req("nvim_colorizer", "plugins.configs.others", "colorizer"),
+ },
+
+ {
+ "nvim-treesitter/nvim-treesitter",
+ event = { "BufRead", "BufNewFile" },
+ config = override_req("nvim_treesitter", "plugins.configs.treesitter", "setup"),
+ run = ":TSUpdate",
+ },
+
+ -- git stuff
+ {
+ "lewis6991/gitsigns.nvim",
+ disable = not plugin_settings.status.gitsigns,
+ opt = true,
+ config = override_req("gitsigns", "plugins.configs.others", "gitsigns"),
+ setup = function()
+ require("core.utils").packer_lazy_load "gitsigns.nvim"
+ end,
+ },
+
+ -- lsp stuff
+
+ {
+ "neovim/nvim-lspconfig",
+ module = "lspconfig",
+ opt = true,
+ setup = function()
+ require("core.utils").packer_lazy_load "nvim-lspconfig"
+ -- reload the current file so lsp actually starts for it
+ vim.defer_fn(function()
+ vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %'
+ end, 0)
+ end,
+ config = override_req("lspconfig", "plugins.configs.lspconfig"),
+ },
+
+ {
+ "ray-x/lsp_signature.nvim",
+ disable = not plugin_settings.status.lspsignature,
+ after = "nvim-lspconfig",
+ config = override_req("signature", "plugins.configs.others", "signature"),
+ },
+
+ {
+ "andymass/vim-matchup",
+ disable = not plugin_settings.status.vim_matchup,
+ opt = true,
+ setup = function()
+ require("core.utils").packer_lazy_load "vim-matchup"
+ end,
+ },
+
+ {
+ "max397574/better-escape.nvim",
+ disable = not plugin_settings.status.better_escape,
+ event = "InsertCharPre",
+ config = override_req("better_escape", "plugins.configs.others", "better_escape"),
+ },
+
+ -- load luasnips + cmp related in insert mode only
+
+ {
+ "rafamadriz/friendly-snippets",
+ module = "cmp_nvim_lsp",
+ disable = not plugin_settings.status.cmp,
+ event = "InsertEnter",
+ },
+
+ {
+ "hrsh7th/nvim-cmp",
+ disable = not plugin_settings.status.cmp,
+ after = "friendly-snippets",
+ config = override_req("nvim_cmp", "plugins.configs.cmp", "setup"),
+ },
+
+ {
+ "L3MON4D3/LuaSnip",
+ disable = not plugin_settings.status.cmp,
+ wants = "friendly-snippets",
+ after = "nvim-cmp",
+ config = override_req("luasnip", "plugins.configs.others", "luasnip"),
+ },
+
+ {
+ "saadparwaiz1/cmp_luasnip",
+ disable = not plugin_settings.status.cmp,
+ after = plugin_settings.options.cmp.lazy_load and "LuaSnip",
+ },
+
+ {
+ "hrsh7th/cmp-nvim-lua",
+ disable = not plugin_settings.status.cmp,
+ after = "cmp_luasnip",
+ },
+
+ {
+ "hrsh7th/cmp-nvim-lsp",
+ disable = not plugin_settings.status.cmp,
+ after = "cmp-nvim-lua",
+ },
+
+ {
+ "hrsh7th/cmp-buffer",
+ disable = not plugin_settings.status.cmp,
+ after = "cmp-nvim-lsp",
+ },
+
+ {
+ "hrsh7th/cmp-path",
+ disable = not plugin_settings.status.cmp,
+ after = "cmp-buffer",
+ },
+
+ -- misc plugins
+ {
+ "windwp/nvim-autopairs",
+ disable = not plugin_settings.status.autopairs,
+ after = plugin_settings.options.autopairs.loadAfter,
+ config = override_req("nvim_autopairs", "plugins.configs.others", "autopairs"),
+ },
+
+ {
+ disable = not plugin_settings.status.alpha,
+ "goolord/alpha-nvim",
+ config = override_req("alpha", "plugins.configs.alpha"),
+ },
+
+ {
+ "numToStr/Comment.nvim",
+ disable = not plugin_settings.status.comment,
+ module = "Comment",
+ keys = { "gcc" },
+ config = override_req("nvim_comment", "plugins.configs.others", "comment"),
+ setup = function()
+ require("core.mappings").comment()
+ end,
+ },
+
+ -- file managing , picker etc
+ {
+ "kyazdani42/nvim-tree.lua",
+ disable = not plugin_settings.status.nvimtree,
+ -- only set "after" if lazy load is disabled and vice versa for "cmd"
+ after = not plugin_settings.options.nvimtree.lazy_load and "nvim-web-devicons",
+ cmd = plugin_settings.options.nvimtree.lazy_load and { "NvimTreeToggle", "NvimTreeFocus" },
+ config = override_req("nvim_tree", "plugins.configs.nvimtree", "setup"),
+ setup = function()
+ require("core.mappings").nvimtree()
+ end,
+ },
+
+ {
+ "nvim-telescope/telescope.nvim",
+ module = "telescope",
+ cmd = "Telescope",
+ config = override_req("telescope", "plugins.configs.telescope", "setup"),
+ setup = function()
+ require("core.mappings").telescope()
+ end,
+ },
+}
+
+--label plugins for operational assistance
+plugins = require("core.utils").label_plugins(plugins)
+--remove plugins specified in chadrc
+plugins = require("core.utils").remove_default_plugins(plugins)
+--add plugins specified in chadrc
+plugins = require("core.utils").add_user_plugins(plugins)
+
+return packer.startup(function(use)
+ for _, v in pairs(plugins) do
+ use(v)
+ end
+end)
diff --git a/NvChad/lua/plugins/packerInit.lua b/NvChad/lua/plugins/packerInit.lua
new file mode 100644
index 0000000..cafdd4f
--- /dev/null
+++ b/NvChad/lua/plugins/packerInit.lua
@@ -0,0 +1,44 @@
+vim.cmd "packadd packer.nvim"
+
+local present, packer = pcall(require, "packer")
+
+if not present then
+ local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
+
+ print "Cloning packer.."
+ -- remove the dir before cloning
+ vim.fn.delete(packer_path, "rf")
+ vim.fn.system {
+ "git",
+ "clone",
+ "https://github.com/wbthomason/packer.nvim",
+ "--depth",
+ "20",
+ packer_path,
+ }
+
+ vim.cmd "packadd packer.nvim"
+ present, packer = pcall(require, "packer")
+
+ if present then
+ print "Packer cloned successfully."
+ else
+ error("Couldn't clone packer !\nPacker path: " .. packer_path .. "\n" .. packer)
+ end
+end
+
+packer.init {
+ display = {
+ open_fn = function()
+ return require("packer.util").float { border = "single" }
+ end,
+ prompt_border = "single",
+ },
+ git = {
+ clone_timeout = 6000, -- seconds
+ },
+ auto_clean = true,
+ compile_on_sync = true,
+}
+
+return packer