set shiftwidth to 2 | format all files

big thanks to @ghifarit53
This commit is contained in:
siduck 2022-07-22 16:00:00 +00:00
parent ce027efbe9
commit 6f0aa376a8
22 changed files with 1341 additions and 1340 deletions

View file

@ -1,6 +1,6 @@
column_width = 120 column_width = 120
line_endings = "Unix" line_endings = "Unix"
indent_type = "Spaces" indent_type = "Spaces"
indent_width = 3 indent_width = 2
quote_style = "AutoPreferDouble" quote_style = "AutoPreferDouble"
call_parentheses = "None" call_parentheses = "None"

View file

@ -6,7 +6,7 @@ local M = {}
-- example of changing theme: -- example of changing theme:
M.ui = { M.ui = {
theme = "gruvchad", theme = "gruvchad",
} }
return M return M

View file

@ -2,7 +2,7 @@ require "core"
require "core.options" require "core.options"
vim.defer_fn(function() vim.defer_fn(function()
require("core.utils").load_mappings() require("core.utils").load_mappings()
end, 0) end, 0)
-- setup packer + plugins -- setup packer + plugins

View file

@ -3,34 +3,34 @@
local M = {} local M = {}
M.options = { M.options = {
-- load your options here or load module with options -- load your options here or load module with options
user = function() end, user = function() end,
nvChad = { nvChad = {
update_url = "https://github.com/NvChad/NvChad", update_url = "https://github.com/NvChad/NvChad",
update_branch = "main", update_branch = "main",
}, },
} }
M.ui = { M.ui = {
-- hl = highlights -- hl = highlights
hl_add = {}, hl_add = {},
hl_override = {}, hl_override = {},
changed_themes = {}, changed_themes = {},
theme_toggle = { "onedark", "one_light" }, theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme theme = "onedark", -- default theme
transparency = false, transparency = false,
} }
M.plugins = { M.plugins = {
override = {}, override = {},
remove = {}, remove = {},
user = {}, user = {},
options = { options = {
lspconfig = { lspconfig = {
setup_lspconf = "", -- path of lspconfig file setup_lspconf = "", -- path of lspconfig file
}, },
}, },
} }
-- check core.mappings for table structure -- check core.mappings for table structure

View file

@ -10,38 +10,38 @@ local api = vim.api
-- dont list quickfix buffers -- dont list quickfix buffers
autocmd("FileType", { autocmd("FileType", {
pattern = "qf", pattern = "qf",
callback = function() callback = function()
vim.opt_local.buflisted = false vim.opt_local.buflisted = false
end, end,
}) })
-- wrap the PackerSync command to warn people before using it in NvChadSnapshots -- wrap the PackerSync command to warn people before using it in NvChadSnapshots
autocmd("VimEnter", { autocmd("VimEnter", {
callback = function() callback = function()
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync(<f-args>)" vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync(<f-args>)"
end, end,
}) })
-- Disable statusline in dashboard -- Disable statusline in dashboard
autocmd("FileType", { autocmd("FileType", {
pattern = "alpha", pattern = "alpha",
callback = function() callback = function()
vim.opt.laststatus = 0 vim.opt.laststatus = 0
end, end,
}) })
autocmd("BufUnload", { autocmd("BufUnload", {
buffer = 0, buffer = 0,
callback = function() callback = function()
vim.opt.laststatus = 3 vim.opt.laststatus = 3
end, end,
}) })
-- Don't auto commenting new lines -- Don't auto commenting new lines
autocmd("BufEnter", { autocmd("BufEnter", {
pattern = "*", pattern = "*",
command = "set fo-=c fo-=r fo-=o", command = "set fo-=c fo-=r fo-=o",
}) })
-- store listed buffers in tab local var -- store listed buffers in tab local var
@ -50,34 +50,34 @@ vim.t.bufs = vim.api.nvim_list_bufs()
-- autocmds for tabufline -> store bufnrs on bufadd, bufenter events -- autocmds for tabufline -> store bufnrs on bufadd, bufenter events
-- thx to https://github.com/ii14 & stores buffer per tab -> table -- thx to https://github.com/ii14 & stores buffer per tab -> table
autocmd({ "BufAdd", "BufEnter" }, { autocmd({ "BufAdd", "BufEnter" }, {
callback = function(args) callback = function(args)
if vim.t.bufs == nil then if vim.t.bufs == nil then
vim.t.bufs = { args.buf } vim.t.bufs = { args.buf }
else else
local bufs = vim.t.bufs local bufs = vim.t.bufs
-- check for duplicates -- check for duplicates
if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then
table.insert(bufs, args.buf) table.insert(bufs, args.buf)
vim.t.bufs = bufs vim.t.bufs = bufs
end
end end
end, end
end,
}) })
autocmd("BufDelete", { autocmd("BufDelete", {
callback = function(args) callback = function(args)
for _, tab in ipairs(api.nvim_list_tabpages()) do for _, tab in ipairs(api.nvim_list_tabpages()) do
local bufs = vim.t[tab].bufs local bufs = vim.t[tab].bufs
if bufs then if bufs then
for i, bufnr in ipairs(bufs) do for i, bufnr in ipairs(bufs) do
if bufnr == args.buf then if bufnr == args.buf then
table.remove(bufs, i) table.remove(bufs, i)
vim.t[tab].bufs = bufs vim.t[tab].bufs = bufs
break break
end end
end end
end
end end
end, end
end,
}) })

View file

@ -4,37 +4,37 @@ local autocmd = vim.api.nvim_create_autocmd
-- This must be used for plugins that need to be loaded just after a file -- This must be used for plugins that need to be loaded just after a file
-- ex : treesitter, lspconfig etc -- ex : treesitter, lspconfig etc
M.lazy_load = function(tb) M.lazy_load = function(tb)
autocmd(tb.events, { autocmd(tb.events, {
pattern = "*", pattern = "*",
group = vim.api.nvim_create_augroup(tb.augroup_name, {}), group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function() callback = function()
if tb.condition() then if tb.condition() then
vim.api.nvim_del_augroup_by_name(tb.augroup_name) vim.api.nvim_del_augroup_by_name(tb.augroup_name)
-- dont defer for treesitter as it will show slow highlighting -- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename" -- This deferring only happens only when we do "nvim filename"
if tb.plugins ~= "nvim-treesitter" then if tb.plugins ~= "nvim-treesitter" then
vim.defer_fn(function() vim.defer_fn(function()
vim.cmd("PackerLoad " .. tb.plugins) vim.cmd("PackerLoad " .. tb.plugins)
end, 0) end, 0)
else else
vim.cmd("PackerLoad " .. tb.plugins) vim.cmd("PackerLoad " .. tb.plugins)
end end
end end
end, end,
}) })
end end
M.colorizer = function() M.colorizer = function()
M.lazy_load { M.lazy_load {
events = { "BufRead", "BufNewFile" }, events = { "BufRead", "BufNewFile" },
augroup_name = "ColorizerLazy", augroup_name = "ColorizerLazy",
plugins = "nvim-colorizer.lua", plugins = "nvim-colorizer.lua",
condition = function() condition = function()
return true return true
end, end,
} }
end end
-- load certain plugins only when there's a file opened in the buffer -- load certain plugins only when there's a file opened in the buffer
@ -42,65 +42,65 @@ end
-- This gives an instant preview of nvim with the file opened -- This gives an instant preview of nvim with the file opened
M.on_file_open = function(plugin_name) M.on_file_open = function(plugin_name)
M.lazy_load { M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" }, events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name, augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugins = plugin_name, plugins = plugin_name,
condition = function() condition = function()
local file = vim.fn.expand "%" local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
end, end,
} }
end end
-- lspinstaller & lspconfig cmds for lazyloading -- lspinstaller & lspconfig cmds for lazyloading
M.lsp_cmds = { M.lsp_cmds = {
"LspInfo", "LspInfo",
"LspStart", "LspStart",
"LspRestart", "LspRestart",
"LspStop", "LspStop",
"LspInstall", "LspInstall",
"LspUnInstall", "LspUnInstall",
"LspUnInstallAll", "LspUnInstallAll",
"LspInstall", "LspInstall",
"LspInstallInfo", "LspInstallInfo",
"LspInstallLog", "LspInstallLog",
"LspLog", "LspLog",
"LspPrintInstalled", "LspPrintInstalled",
} }
M.treesitter_cmds = { M.treesitter_cmds = {
"TSInstall", "TSInstall",
"TSBufEnable", "TSBufEnable",
"TSBufDisable", "TSBufDisable",
"TSEnable", "TSEnable",
"TSDisable", "TSDisable",
"TSModuleInfo", "TSModuleInfo",
} }
M.gitsigns = function() M.gitsigns = function()
-- taken from https://github.com/max397574 -- taken from https://github.com/max397574
autocmd({ "BufRead" }, { autocmd({ "BufRead" }, {
callback = function() callback = function()
local function onexit(code, _) local function onexit(code, _)
if code == 0 then if code == 0 then
vim.schedule(function() vim.schedule(function()
require("packer").loader "gitsigns.nvim" require("packer").loader "gitsigns.nvim"
end) end)
end end
end end
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
if lines ~= { "" } then if lines ~= { "" } then
vim.loop.spawn("git", { vim.loop.spawn("git", {
args = { args = {
"ls-files", "ls-files",
"--error-unmatch", "--error-unmatch",
vim.fn.expand "%:p:h", vim.fn.expand "%:p:h",
}, },
}, onexit) }, onexit)
end end
end, end,
}) })
end end
return M return M

View file

@ -1,387 +1,387 @@
-- n, v, i, t = mode names -- n, v, i, t = mode names
local function termcodes(str) local function termcodes(str)
return vim.api.nvim_replace_termcodes(str, true, true, true) return vim.api.nvim_replace_termcodes(str, true, true, true)
end end
local M = {} local M = {}
M.general = { M.general = {
i = { i = {
-- go to beginning and end -- go to beginning and end
["<C-b>"] = { "<ESC>^i", "論 beginning of line" }, ["<C-b>"] = { "<ESC>^i", "論 beginning of line" },
["<C-e>"] = { "<End>", "壟 end of line" }, ["<C-e>"] = { "<End>", "壟 end of line" },
-- navigate within insert mode -- navigate within insert mode
["<C-h>"] = { "<Left>", " move left" }, ["<C-h>"] = { "<Left>", " move left" },
["<C-l>"] = { "<Right>", " move right" }, ["<C-l>"] = { "<Right>", " move right" },
["<C-j>"] = { "<Down>", " move down" }, ["<C-j>"] = { "<Down>", " move down" },
["<C-k>"] = { "<Up>", " move up" }, ["<C-k>"] = { "<Up>", " move up" },
}, },
n = { n = {
["<ESC>"] = { "<cmd> noh <CR>", " no highlight" }, ["<ESC>"] = { "<cmd> noh <CR>", " no highlight" },
-- switch between windows -- switch between windows
["<C-h>"] = { "<C-w>h", " window left" }, ["<C-h>"] = { "<C-w>h", " window left" },
["<C-l>"] = { "<C-w>l", " window right" }, ["<C-l>"] = { "<C-w>l", " window right" },
["<C-j>"] = { "<C-w>j", " window down" }, ["<C-j>"] = { "<C-w>j", " window down" },
["<C-k>"] = { "<C-w>k", " window up" }, ["<C-k>"] = { "<C-w>k", " window up" },
-- save -- save
["<C-s>"] = { "<cmd> w <CR>", "﬚ save file" }, ["<C-s>"] = { "<cmd> w <CR>", "﬚ save file" },
-- Copy all -- Copy all
["<C-c>"] = { "<cmd> %y+ <CR>", " copy whole file" }, ["<C-c>"] = { "<cmd> %y+ <CR>", " copy whole file" },
-- line numbers -- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", " toggle line number" }, ["<leader>n"] = { "<cmd> set nu! <CR>", " toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", " toggle relative number" }, ["<leader>rn"] = { "<cmd> set rnu! <CR>", " toggle relative number" },
-- update nvchad -- update nvchad
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", " update nvchad" }, ["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", " update nvchad" },
["<leader>tt"] = { ["<leader>tt"] = {
function() function()
require("base46").toggle_theme() require("base46").toggle_theme()
end, end,
" toggle theme", " toggle theme",
}, },
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down> -- 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/ -- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map -- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour -- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
}, },
t = { t = {
["<C-x>"] = { termcodes "<C-\\><C-N>", " escape terminal mode" }, ["<C-x>"] = { termcodes "<C-\\><C-N>", " escape terminal mode" },
}, },
v = { v = {
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, ["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, ["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } }, ["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } }, ["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', opts = { expr = true } },
-- Don't copy the replaced text after pasting in visual mode -- Don't copy the replaced text after pasting in visual mode
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste -- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', opts = { silent = true } }, ["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', opts = { silent = true } },
}, },
} }
M.tabufline = { M.tabufline = {
n = { n = {
-- new buffer -- new buffer
["<S-b>"] = { "<cmd> enew <CR>", "烙 new buffer" }, ["<S-b>"] = { "<cmd> enew <CR>", "烙 new buffer" },
-- cycle through buffers -- cycle through buffers
["<TAB>"] = { "<cmd> Tbufnext <CR>", " goto next buffer" }, ["<TAB>"] = { "<cmd> Tbufnext <CR>", " goto next buffer" },
["<S-Tab>"] = { "<cmd> Tbufprev <CR> ", " goto prev buffer" }, ["<S-Tab>"] = { "<cmd> Tbufprev <CR> ", " goto prev buffer" },
-- cycle through tabs -- cycle through tabs
["<leader>tp"] = { "<cmd> tabprevious <CR>", " goto next tab" }, ["<leader>tp"] = { "<cmd> tabprevious <CR>", " goto next tab" },
["<leader>tn"] = { "<cmd> tabnext <CR> ", " goto prev tab" }, ["<leader>tn"] = { "<cmd> tabnext <CR> ", " goto prev tab" },
-- close buffer + hide terminal buffer -- close buffer + hide terminal buffer
["<leader>x"] = { ["<leader>x"] = {
function() function()
require("core.utils").close_buffer() require("core.utils").close_buffer()
end, end,
" close buffer", " close buffer",
}, },
}, },
} }
M.comment = { M.comment = {
-- toggle comment in both modes -- toggle comment in both modes
n = { n = {
["<leader>/"] = { ["<leader>/"] = {
function() function()
require("Comment.api").toggle_current_linewise() require("Comment.api").toggle_current_linewise()
end, end,
"蘒 toggle comment", "蘒 toggle comment",
}, },
}, },
v = { v = {
["<leader>/"] = { ["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>", "<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>",
"蘒 toggle comment", "蘒 toggle comment",
}, },
}, },
} }
M.lspconfig = { M.lspconfig = {
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions -- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
n = { n = {
["gD"] = { ["gD"] = {
function() function()
vim.lsp.buf.declaration() vim.lsp.buf.declaration()
end, end,
" lsp declaration", " lsp declaration",
}, },
["gd"] = { ["gd"] = {
function() function()
vim.lsp.buf.definition() vim.lsp.buf.definition()
end, end,
" lsp definition", " lsp definition",
}, },
["K"] = { ["K"] = {
function() function()
vim.lsp.buf.hover() vim.lsp.buf.hover()
end, end,
" lsp hover", " lsp hover",
}, },
["gi"] = { ["gi"] = {
function() function()
vim.lsp.buf.implementation() vim.lsp.buf.implementation()
end, end,
" lsp implementation", " lsp implementation",
}, },
["<leader>ls"] = { ["<leader>ls"] = {
function() function()
vim.lsp.buf.signature_help() vim.lsp.buf.signature_help()
end, end,
" lsp signature_help", " lsp signature_help",
}, },
["<leader>D"] = { ["<leader>D"] = {
function() function()
vim.lsp.buf.type_definition() vim.lsp.buf.type_definition()
end, end,
" lsp definition type", " lsp definition type",
}, },
["<leader>ra"] = { ["<leader>ra"] = {
function() function()
require("nvchad_ui.renamer").open() require("nvchad_ui.renamer").open()
end, end,
" lsp rename", " lsp rename",
}, },
["<leader>ca"] = { ["<leader>ca"] = {
function() function()
vim.lsp.buf.code_action() vim.lsp.buf.code_action()
end, end,
" lsp code_action", " lsp code_action",
}, },
["gr"] = { ["gr"] = {
function() function()
vim.lsp.buf.references() vim.lsp.buf.references()
end, end,
" lsp references", " lsp references",
}, },
["<leader>f"] = { ["<leader>f"] = {
function() function()
vim.diagnostic.open_float() vim.diagnostic.open_float()
end, end,
" floating diagnostic", " floating diagnostic",
}, },
["[d"] = { ["[d"] = {
function() function()
vim.diagnostic.goto_prev() vim.diagnostic.goto_prev()
end, end,
" goto prev", " goto prev",
}, },
["d]"] = { ["d]"] = {
function() function()
vim.diagnostic.goto_next() vim.diagnostic.goto_next()
end, end,
" goto_next", " goto_next",
}, },
["<leader>q"] = { ["<leader>q"] = {
function() function()
vim.diagnostic.setloclist() vim.diagnostic.setloclist()
end, end,
" diagnostic setloclist", " diagnostic setloclist",
}, },
["<leader>fm"] = { ["<leader>fm"] = {
function() function()
vim.lsp.buf.formatting() vim.lsp.buf.formatting()
end, end,
" lsp formatting", " lsp formatting",
}, },
["<leader>wa"] = { ["<leader>wa"] = {
function() function()
vim.lsp.buf.add_workspace_folder() vim.lsp.buf.add_workspace_folder()
end, end,
" add workspace folder", " add workspace folder",
}, },
["<leader>wr"] = { ["<leader>wr"] = {
function() function()
vim.lsp.buf.remove_workspace_folder() vim.lsp.buf.remove_workspace_folder()
end, end,
" remove workspace folder", " remove workspace folder",
}, },
["<leader>wl"] = { ["<leader>wl"] = {
function() function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, end,
" list workspace folders", " list workspace folders",
}, },
}, },
} }
M.nvimtree = { M.nvimtree = {
n = { n = {
-- toggle -- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" }, ["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" },
-- focus -- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" }, ["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" },
}, },
} }
M.telescope = { M.telescope = {
n = { n = {
-- find -- find
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" }, ["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" },
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" }, ["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" },
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" }, ["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" }, ["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" }, ["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" }, ["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" },
["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" }, ["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" },
-- git -- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" }, ["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", " git status" }, ["<leader>gt"] = { "<cmd> Telescope git_status <CR>", " git status" },
-- pick a hidden term -- pick a hidden term
["<leader>pt"] = { "<cmd> Telescope terms <CR>", " pick hidden term" }, ["<leader>pt"] = { "<cmd> Telescope terms <CR>", " pick hidden term" },
-- theme switcher -- theme switcher
["<leader>th"] = { "<cmd> Telescope themes <CR>", " nvchad themes" }, ["<leader>th"] = { "<cmd> Telescope themes <CR>", " nvchad themes" },
}, },
} }
M.nvterm = { M.nvterm = {
t = { t = {
-- toggle in terminal mode -- toggle in terminal mode
["<A-i>"] = { ["<A-i>"] = {
function() function()
require("nvterm.terminal").toggle "float" require("nvterm.terminal").toggle "float"
end, end,
" toggle floating term", " toggle floating term",
}, },
["<A-h>"] = { ["<A-h>"] = {
function() function()
require("nvterm.terminal").toggle "horizontal" require("nvterm.terminal").toggle "horizontal"
end, end,
" toggle horizontal term", " toggle horizontal term",
}, },
["<A-v>"] = { ["<A-v>"] = {
function() function()
require("nvterm.terminal").toggle "vertical" require("nvterm.terminal").toggle "vertical"
end, end,
" toggle vertical term", " toggle vertical term",
}, },
}, },
n = { n = {
-- toggle in normal mode -- toggle in normal mode
["<A-i>"] = { ["<A-i>"] = {
function() function()
require("nvterm.terminal").toggle "float" require("nvterm.terminal").toggle "float"
end, end,
" toggle floating term", " toggle floating term",
}, },
["<A-h>"] = { ["<A-h>"] = {
function() function()
require("nvterm.terminal").toggle "horizontal" require("nvterm.terminal").toggle "horizontal"
end, end,
" toggle horizontal term", " toggle horizontal term",
}, },
["<A-v>"] = { ["<A-v>"] = {
function() function()
require("nvterm.terminal").toggle "vertical" require("nvterm.terminal").toggle "vertical"
end, end,
" toggle vertical term", " toggle vertical term",
}, },
-- new -- new
["<leader>h"] = { ["<leader>h"] = {
function() function()
require("nvterm.terminal").new "horizontal" require("nvterm.terminal").new "horizontal"
end, end,
" new horizontal term", " new horizontal term",
}, },
["<leader>v"] = { ["<leader>v"] = {
function() function()
require("nvterm.terminal").new "vertical" require("nvterm.terminal").new "vertical"
end, end,
" new vertical term", " new vertical term",
}, },
}, },
} }
M.whichkey = { M.whichkey = {
n = { n = {
["<leader>wK"] = { ["<leader>wK"] = {
function() function()
vim.cmd "WhichKey" vim.cmd "WhichKey"
end, end,
" which-key all keymaps", " which-key all keymaps",
}, },
["<leader>wk"] = { ["<leader>wk"] = {
function() function()
local input = vim.fn.input "WhichKey: " local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input) vim.cmd("WhichKey " .. input)
end, end,
" which-key query lookup", " which-key query lookup",
}, },
}, },
} }
M.blankline = { M.blankline = {
n = { n = {
["<leader>bc"] = { ["<leader>bc"] = {
function() function()
local ok, start = require("indent_blankline.utils").get_current_context( local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns, vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope vim.g.indent_blankline_use_treesitter_scope
) )
if ok then if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]] vim.cmd [[normal! _]]
end end
end, end,
" Jump to current_context", " Jump to current_context",
}, },
}, },
} }
return M return M

View file

@ -20,8 +20,10 @@ opt.cul = true -- cursor line
-- Indenting -- Indenting
opt.expandtab = true opt.expandtab = true
opt.shiftwidth = 3 opt.shiftwidth = 2
opt.smartindent = true opt.smartindent = true
opt.tabstop = 2
opt.softtabstop = 2
opt.fillchars = { eob = " " } opt.fillchars = { eob = " " }
opt.ignorecase = true opt.ignorecase = true
@ -39,7 +41,6 @@ opt.shortmess:append "sI"
opt.signcolumn = "yes" opt.signcolumn = "yes"
opt.splitbelow = true opt.splitbelow = true
opt.splitright = true opt.splitright = true
opt.tabstop = 8
opt.termguicolors = true opt.termguicolors = true
opt.timeoutlen = 400 opt.timeoutlen = 400
opt.undofile = true opt.undofile = true
@ -55,53 +56,53 @@ g.mapleader = " "
-- disable some builtin vim plugins -- disable some builtin vim plugins
local default_plugins = { local default_plugins = {
"2html_plugin", "2html_plugin",
"getscript", "getscript",
"getscriptPlugin", "getscriptPlugin",
"gzip", "gzip",
"logipat", "logipat",
"netrw", "netrw",
"netrwPlugin", "netrwPlugin",
"netrwSettings", "netrwSettings",
"netrwFileHandlers", "netrwFileHandlers",
"matchit", "matchit",
"tar", "tar",
"tarPlugin", "tarPlugin",
"rrhelper", "rrhelper",
"spellfile_plugin", "spellfile_plugin",
"vimball", "vimball",
"vimballPlugin", "vimballPlugin",
"zip", "zip",
"zipPlugin", "zipPlugin",
"tutor", "tutor",
"rplugin", "rplugin",
"syntax", "syntax",
"synmenu", "synmenu",
"optwin", "optwin",
"compiler", "compiler",
"bugreport", "bugreport",
"ftplugin", "ftplugin",
} }
for _, plugin in pairs(default_plugins) do for _, plugin in pairs(default_plugins) do
g["loaded_" .. plugin] = 1 g["loaded_" .. plugin] = 1
end end
local default_providers = { local default_providers = {
"node", "node",
"perl", "perl",
"python3", "python3",
"ruby", "ruby",
} }
for _, provider in ipairs(default_providers) do for _, provider in ipairs(default_providers) do
vim.g["loaded_" .. provider .. "_provider"] = 0 vim.g["loaded_" .. provider .. "_provider"] = 0
end end
-- set shada path -- set shada path
vim.schedule(function() vim.schedule(function()
vim.opt.shadafile = vim.fn.expand "$HOME" .. "/.local/share/nvim/shada/main.shada" vim.opt.shadafile = vim.fn.expand "$HOME" .. "/.local/share/nvim/shada/main.shada"
vim.cmd [[ silent! rsh ]] vim.cmd [[ silent! rsh ]]
end) end)
-- load user options -- load user options

View file

@ -1,59 +1,59 @@
local M = {} local M = {}
M.bootstrap = function() M.bootstrap = function()
local fn = vim.fn local fn = vim.fn
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" })
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
print "Cloning packer .." print "Cloning packer .."
fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path } fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
-- install plugins + compile their configs -- install plugins + compile their configs
vim.cmd "packadd packer.nvim" vim.cmd "packadd packer.nvim"
require "plugins" require "plugins"
vim.cmd "PackerSync" vim.cmd "PackerSync"
end end
end end
M.options = { M.options = {
auto_clean = true, auto_clean = true,
compile_on_sync = true, compile_on_sync = true,
git = { clone_timeout = 6000 }, git = { clone_timeout = 6000 },
display = { display = {
working_sym = "", working_sym = "",
error_sym = "", error_sym = "",
done_sym = "", done_sym = "",
removed_sym = "", removed_sym = "",
moved_sym = "", moved_sym = "",
open_fn = function() open_fn = function()
return require("packer.util").float { border = "single" } return require("packer.util").float { border = "single" }
end, end,
}, },
} }
-- merge overrides if there are any -- merge overrides if there are any
M.options = require("core.utils").load_override(M.options, "wbthomason/packer.nvim") M.options = require("core.utils").load_override(M.options, "wbthomason/packer.nvim")
M.run = function(plugins) M.run = function(plugins)
local present, packer = pcall(require, "packer") local present, packer = pcall(require, "packer")
if not present then if not present then
return return
end end
-- Override with chadrc values -- Override with chadrc values
plugins = require("core.utils").remove_default_plugins(plugins) plugins = require("core.utils").remove_default_plugins(plugins)
plugins = require("core.utils").merge_plugins(plugins) plugins = require("core.utils").merge_plugins(plugins)
packer.init(M.options) packer.init(M.options)
packer.startup(function(use) packer.startup(function(use)
for _, v in pairs(plugins) do for _, v in pairs(plugins) do
use(v) use(v)
end end
end) end)
end end
return M return M

View file

@ -4,225 +4,225 @@ local api = vim.api
local merge_tb = vim.tbl_deep_extend local merge_tb = vim.tbl_deep_extend
M.close_buffer = function(bufnr) M.close_buffer = function(bufnr)
if vim.bo.buftype == "terminal" then if vim.bo.buftype == "terminal" then
vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide") vim.cmd(vim.bo.buflisted and "set nobl | enew" or "hide")
elseif vim.bo.modified then elseif vim.bo.modified then
print "save the file bruh" print "save the file bruh"
else else
bufnr = bufnr or api.nvim_get_current_buf() bufnr = bufnr or api.nvim_get_current_buf()
require("core.utils").tabuflinePrev() require("core.utils").tabuflinePrev()
vim.cmd("bd" .. bufnr) vim.cmd("bd" .. bufnr)
end end
end end
M.load_config = function() M.load_config = function()
local config = require "core.default_config" local config = require "core.default_config"
local chadrc_exists, chadrc = pcall(require, "custom.chadrc") local chadrc_exists, chadrc = pcall(require, "custom.chadrc")
if chadrc_exists then if chadrc_exists then
-- merge user config if it exists and is a table; otherwise display an error -- merge user config if it exists and is a table; otherwise display an error
if type(chadrc) == "table" then if type(chadrc) == "table" then
M.remove_default_keys() M.remove_default_keys()
config = merge_tb("force", config, chadrc) config = merge_tb("force", config, chadrc)
else else
error "chadrc must return a table!" error "chadrc must return a table!"
end end
end end
config.mappings.disabled = nil config.mappings.disabled = nil
return config return config
end end
M.remove_default_keys = function() M.remove_default_keys = function()
local chadrc = require "custom.chadrc" local chadrc = require "custom.chadrc"
local user_mappings = chadrc.mappings or {} local user_mappings = chadrc.mappings or {}
local user_keys = {} local user_keys = {}
local user_sections = vim.tbl_keys(user_mappings) local user_sections = vim.tbl_keys(user_mappings)
-- push user_map keys in user_keys table -- push user_map keys in user_keys table
for _, section in ipairs(user_sections) do for _, section in ipairs(user_sections) do
user_keys = vim.tbl_deep_extend("force", user_keys, user_mappings[section]) user_keys = vim.tbl_deep_extend("force", user_keys, user_mappings[section])
end end
local function disable_key(mode, keybind, mode_mapping) local function disable_key(mode, keybind, mode_mapping)
local keys_in_mode = vim.tbl_keys(user_keys[mode] or {}) local keys_in_mode = vim.tbl_keys(user_keys[mode] or {})
if vim.tbl_contains(keys_in_mode, keybind) then if vim.tbl_contains(keys_in_mode, keybind) then
mode_mapping[keybind] = nil mode_mapping[keybind] = nil
end
end
local default_mappings = require("core.default_config").mappings
-- remove user_maps from default mapping table
for _, section_mappings in pairs(default_mappings) do
for mode, mode_mapping in pairs(section_mappings) do
for keybind, _ in pairs(mode_mapping) do
disable_key(mode, keybind, mode_mapping)
end end
end end
end
local default_mappings = require("core.default_config").mappings
-- remove user_maps from default mapping table
for _, section_mappings in pairs(default_mappings) do
for mode, mode_mapping in pairs(section_mappings) do
for keybind, _ in pairs(mode_mapping) do
disable_key(mode, keybind, mode_mapping)
end
end
end
end end
M.load_mappings = function(mappings, mapping_opt) M.load_mappings = function(mappings, mapping_opt)
-- set mapping function with/without whichkey -- set mapping function with/without whichkey
local set_maps local set_maps
local whichkey_exists, wk = pcall(require, "which-key") local whichkey_exists, wk = pcall(require, "which-key")
if whichkey_exists then if whichkey_exists then
set_maps = function(keybind, mapping_info, opts) set_maps = function(keybind, mapping_info, opts)
wk.register({ [keybind] = mapping_info }, opts) wk.register({ [keybind] = mapping_info }, opts)
end
else
set_maps = function(keybind, mapping_info, opts)
local mode = opts.mode
opts.mode = nil
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
mappings = mappings or vim.deepcopy(M.load_config().mappings)
mappings.lspconfig = nil
for _, section in pairs(mappings) do
for mode, mode_values in pairs(section) do
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
if mapping_info.opts then
mapping_info.opts = nil
end
set_maps(keybind, mapping_info, opts)
end end
else end
set_maps = function(keybind, mapping_info, opts) end
local mode = opts.mode
opts.mode = nil
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
mappings = mappings or vim.deepcopy(M.load_config().mappings)
mappings.lspconfig = nil
for _, section in pairs(mappings) do
for mode, mode_values in pairs(section) do
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
if mapping_info.opts then
mapping_info.opts = nil
end
set_maps(keybind, mapping_info, opts)
end
end
end
end end
-- remove plugins defined in chadrc -- remove plugins defined in chadrc
M.remove_default_plugins = function(plugins) M.remove_default_plugins = function(plugins)
local removals = M.load_config().plugins.remove or {} local removals = M.load_config().plugins.remove or {}
if not vim.tbl_isempty(removals) then if not vim.tbl_isempty(removals) then
for _, plugin in pairs(removals) do for _, plugin in pairs(removals) do
plugins[plugin] = nil plugins[plugin] = nil
end end
end end
return plugins return plugins
end end
-- merge default/user plugin tables -- merge default/user plugin tables
M.merge_plugins = function(default_plugins) M.merge_plugins = function(default_plugins)
local user_plugins = M.load_config().plugins.user local user_plugins = M.load_config().plugins.user
-- merge default + user plugin table -- merge default + user plugin table
default_plugins = merge_tb("force", default_plugins, user_plugins) default_plugins = merge_tb("force", default_plugins, user_plugins)
local final_table = {} local final_table = {}
for key, _ in pairs(default_plugins) do for key, _ in pairs(default_plugins) do
default_plugins[key][1] = key default_plugins[key][1] = key
final_table[#final_table + 1] = default_plugins[key] final_table[#final_table + 1] = default_plugins[key]
end end
return final_table return final_table
end end
M.load_override = function(default_table, plugin_name) M.load_override = function(default_table, plugin_name)
local user_table = M.load_config().plugins.override[plugin_name] or {} local user_table = M.load_config().plugins.override[plugin_name] or {}
user_table = type(user_table) == "table" and user_table or user_table() user_table = type(user_table) == "table" and user_table or user_table()
return merge_tb("force", default_table, user_table) return merge_tb("force", default_table, user_table)
end end
M.packer_sync = function(...) M.packer_sync = function(...)
local git_exists, git = pcall(require, "nvchad.utils.git") local git_exists, git = pcall(require, "nvchad.utils.git")
local defaults_exists, defaults = pcall(require, "nvchad.utils.config") local defaults_exists, defaults = pcall(require, "nvchad.utils.config")
local packer_exists, packer = pcall(require, "packer") local packer_exists, packer = pcall(require, "packer")
if git_exists and defaults_exists then if git_exists and defaults_exists then
local current_branch_name = git.get_current_branch_name() local current_branch_name = git.get_current_branch_name()
-- warn the user if we are on a snapshot branch -- warn the user if we are on a snapshot branch
if current_branch_name:match(defaults.snaps.base_snap_branch_name .. "(.+)" .. "$") then if current_branch_name:match(defaults.snaps.base_snap_branch_name .. "(.+)" .. "$") then
vim.api.nvim_echo({ vim.api.nvim_echo({
{ "WARNING: You are trying to use ", "WarningMsg" }, { "WARNING: You are trying to use ", "WarningMsg" },
{ "PackerSync" }, { "PackerSync" },
{ {
" on a NvChadSnapshot. This will cause issues if NvChad dependencies contain " " on a NvChadSnapshot. This will cause issues if NvChad dependencies contain "
.. "any breaking changes! Plugin updates will not be included in this " .. "any breaking changes! Plugin updates will not be included in this "
.. "snapshot, so they will be lost after switching between snapshots! Would " .. "snapshot, so they will be lost after switching between snapshots! Would "
.. "you still like to continue? [y/N]\n", .. "you still like to continue? [y/N]\n",
"WarningMsg", "WarningMsg",
}, },
}, false, {}) }, false, {})
local ans = vim.trim(string.lower(vim.fn.input "-> ")) local ans = vim.trim(string.lower(vim.fn.input "-> "))
if ans ~= "y" then if ans ~= "y" then
return return
end
end end
end end
end
if packer_exists then if packer_exists then
packer.sync(...) packer.sync(...)
else else
error "Packer could not be loaded!" error "Packer could not be loaded!"
end end
end end
M.bufilter = function() M.bufilter = function()
local bufs = vim.t.bufs local bufs = vim.t.bufs
for i = #bufs, 1, -1 do for i = #bufs, 1, -1 do
if not vim.api.nvim_buf_is_valid(bufs[i]) then if not vim.api.nvim_buf_is_valid(bufs[i]) then
table.remove(bufs, i) table.remove(bufs, i)
end end
end end
return bufs return bufs
end end
M.tabuflineNext = function() M.tabuflineNext = function()
local bufs = M.bufilter() or {} local bufs = M.bufilter() or {}
for i, v in ipairs(bufs) do for i, v in ipairs(bufs) do
if api.nvim_get_current_buf() == v then if api.nvim_get_current_buf() == v then
vim.cmd(i == #bufs and "b" .. bufs[1] or "b" .. bufs[i + 1]) vim.cmd(i == #bufs and "b" .. bufs[1] or "b" .. bufs[i + 1])
break break
end end
end end
end end
M.tabuflinePrev = function() M.tabuflinePrev = function()
local bufs = M.bufilter() or {} local bufs = M.bufilter() or {}
for i, v in ipairs(bufs) do for i, v in ipairs(bufs) do
if api.nvim_get_current_buf() == v then if api.nvim_get_current_buf() == v then
vim.cmd(i == 1 and "b" .. bufs[#bufs] or "b" .. bufs[i - 1]) vim.cmd(i == 1 and "b" .. bufs[#bufs] or "b" .. bufs[i - 1])
break break
end end
end end
end end
-- closes tab + all of its buffers -- closes tab + all of its buffers
M.closeAllBufs = function(action) M.closeAllBufs = function(action)
local bufs = vim.t.bufs local bufs = vim.t.bufs
if action == "closeTab" then if action == "closeTab" then
vim.cmd "tabclose" vim.cmd "tabclose"
end end
for _, buf in ipairs(bufs) do for _, buf in ipairs(bufs) do
M.close_buffer(buf) M.close_buffer(buf)
end end
if action ~= "closeTab" then if action ~= "closeTab" then
vim.cmd "enew" vim.cmd "enew"
end end
end end
return M return M

View file

@ -1,77 +1,77 @@
local present, alpha = pcall(require, "alpha") local present, alpha = pcall(require, "alpha")
if not present then if not present then
return return
end end
require("base46").load_highlight "alpha" require("base46").load_highlight "alpha"
local function button(sc, txt, keybind) local function button(sc, txt, keybind)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>") local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = { local opts = {
position = "center", position = "center",
text = txt, text = txt,
shortcut = sc, shortcut = sc,
cursor = 5, cursor = 5,
width = 36, width = 36,
align_shortcut = "right", align_shortcut = "right",
hl = "AlphaButtons", hl = "AlphaButtons",
} }
if keybind then if keybind then
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } } opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
end end
return { return {
type = "button", type = "button",
val = txt, val = txt,
on_press = function() on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
vim.api.nvim_feedkeys(key, "normal", false) vim.api.nvim_feedkeys(key, "normal", false)
end, end,
opts = opts, opts = opts,
} }
end end
local options = {} local options = {}
local ascii = { local ascii = {
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ", " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ", " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ", " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ", " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ", " ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ", " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ", " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ", " ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ", " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
} }
options.header = { options.header = {
type = "text", type = "text",
val = ascii, val = ascii,
opts = { opts = {
position = "center", position = "center",
hl = "AlphaHeader", hl = "AlphaHeader",
}, },
} }
options.buttons = { options.buttons = {
type = "group", type = "group",
val = { val = {
button("SPC f f", " Find File ", ":Telescope find_files<CR>"), button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"), button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"), button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"), button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
button("SPC t h", " Themes ", ":Telescope themes<CR>"), button("SPC t h", " Themes ", ":Telescope themes<CR>"),
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"), button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
}, },
opts = { opts = {
spacing = 1, spacing = 1,
}, },
} }
options = require("core.utils").load_override(options, "goolord/alpha-nvim") options = require("core.utils").load_override(options, "goolord/alpha-nvim")
@ -82,11 +82,11 @@ local marginTopPercent = 0.3
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) } local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
alpha.setup { alpha.setup {
layout = { layout = {
{ type = "padding", val = headerPadding }, { type = "padding", val = headerPadding },
options.header, options.header,
{ type = "padding", val = 2 }, { type = "padding", val = 2 },
options.buttons, options.buttons,
}, },
opts = {}, opts = {},
} }

View file

@ -1,7 +1,7 @@
local present, cmp = pcall(require, "cmp") local present, cmp = pcall(require, "cmp")
if not present then if not present then
return return
end end
require("base46").load_highlight "cmp" require("base46").load_highlight "cmp"
@ -9,92 +9,92 @@ require("base46").load_highlight "cmp"
vim.opt.completeopt = "menuone,noselect" vim.opt.completeopt = "menuone,noselect"
local function border(hl_name) local function border(hl_name)
return { return {
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
{ "", hl_name }, { "", hl_name },
} }
end end
local cmp_window = require "cmp.utils.window" local cmp_window = require "cmp.utils.window"
cmp_window.info_ = cmp_window.info cmp_window.info_ = cmp_window.info
cmp_window.info = function(self) cmp_window.info = function(self)
local info = self:info_() local info = self:info_()
info.scrollable = false info.scrollable = false
return info return info
end end
local options = { local options = {
window = { window = {
completion = { completion = {
border = border "CmpBorder", border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
}, },
documentation = { documentation = {
border = border "CmpDocBorder", border = border "CmpDocBorder",
}, },
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end,
}, },
formatting = { formatting = {
format = function(_, vim_item) format = function(_, vim_item)
local icons = require("nvchad_ui.icons").lspkind local icons = require("nvchad_ui.icons").lspkind
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind) vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
return vim_item return vim_item
end, end,
}, },
mapping = { mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = false, select = false,
}, },
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "") vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else else
fallback() fallback()
end end
end, { end, {
"i", "i",
"s", "s",
}), }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "") vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else else
fallback() fallback()
end end
end, { end, {
"i", "i",
"s", "s",
}), }),
}, },
sources = { sources = {
{ name = "luasnip" }, { name = "luasnip" },
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "buffer" }, { name = "buffer" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
{ name = "path" }, { name = "path" },
}, },
} }
-- check for any override -- check for any override

View file

@ -1,34 +1,34 @@
local present, lsp_installer = pcall(require, "nvim-lsp-installer") local present, lsp_installer = pcall(require, "nvim-lsp-installer")
if not present then if not present then
return return
end end
local options = { local options = {
-- ensure_installed is not needed as automatic_installation is enabled -- ensure_installed is not needed as automatic_installation is enabled
-- then any lsp server you setup by lspconfig is going to get installed automatically! -- then any lsp server you setup by lspconfig is going to get installed automatically!
-- ensure_installed = { "lua" }, -- ensure_installed = { "lua" },
automatic_installation = true, automatic_installation = true,
ui = { ui = {
icons = { icons = {
server_installed = "", server_installed = "",
server_pending = "", server_pending = "",
server_uninstalled = "", server_uninstalled = "",
}, },
keymaps = { keymaps = {
toggle_server_expand = "<CR>", toggle_server_expand = "<CR>",
install_server = "i", install_server = "i",
update_server = "u", update_server = "u",
check_server_version = "c", check_server_version = "c",
update_all_servers = "U", update_all_servers = "U",
check_outdated_servers = "C", check_outdated_servers = "C",
uninstall_server = "X", uninstall_server = "X",
}, },
}, },
max_concurrent_installers = 10, max_concurrent_installers = 10,
} }
options = require("core.utils").load_override(options, "williamboman/nvim-lsp-installer") options = require("core.utils").load_override(options, "williamboman/nvim-lsp-installer")

View file

@ -1,7 +1,7 @@
local present, lspconfig = pcall(require, "lspconfig") local present, lspconfig = pcall(require, "lspconfig")
if not present then if not present then
return return
end end
require("base46").load_highlight "lsp" require("base46").load_highlight "lsp"
@ -11,72 +11,72 @@ local M = {}
local utils = require "core.utils" local utils = require "core.utils"
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
local vim_version = vim.version() local vim_version = vim.version()
if vim_version.minor > 7 then if vim_version.minor > 7 then
-- nightly -- nightly
client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = false
else else
-- stable -- stable
client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false client.resolved_capabilities.document_range_formatting = false
end end
local lsp_mappings = utils.load_config().mappings.lspconfig local lsp_mappings = utils.load_config().mappings.lspconfig
utils.load_mappings({ lsp_mappings }, { buffer = bufnr }) utils.load_mappings({ lsp_mappings }, { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then if client.server_capabilities.signatureHelpProvider then
require("nvchad_ui.signature").setup(client) require("nvchad_ui.signature").setup(client)
end end
end end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem = { capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" }, documentationFormat = { "markdown", "plaintext" },
snippetSupport = true, snippetSupport = true,
preselectSupport = true, preselectSupport = true,
insertReplaceSupport = true, insertReplaceSupport = true,
labelDetailsSupport = true, labelDetailsSupport = true,
deprecatedSupport = true, deprecatedSupport = true,
commitCharactersSupport = true, commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } }, tagSupport = { valueSet = { 1 } },
resolveSupport = { resolveSupport = {
properties = { properties = {
"documentation", "documentation",
"detail", "detail",
"additionalTextEdits", "additionalTextEdits",
}, },
}, },
} }
lspconfig.sumneko_lua.setup { lspconfig.sumneko_lua.setup {
on_attach = M.on_attach, on_attach = M.on_attach,
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {
globals = { "vim" }, globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
}, },
}, workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
} }
-- requires a file containing user's lspconfigs -- requires a file containing user's lspconfigs
local addlsp_confs = utils.load_config().plugins.options.lspconfig.setup_lspconf local addlsp_confs = utils.load_config().plugins.options.lspconfig.setup_lspconf
if #addlsp_confs ~= 0 then if #addlsp_confs ~= 0 then
require(addlsp_confs).setup_lsp(M.on_attach, capabilities) require(addlsp_confs).setup_lsp(M.on_attach, capabilities)
end end
return M return M

View file

@ -1,22 +1,22 @@
local present, _ = pcall(require, "nvchad_ui") local present, _ = pcall(require, "nvchad_ui")
if not present then if not present then
return return
end end
local options = { local options = {
statusline = { statusline = {
separator_style = "default", -- default/round/block/arrow separator_style = "default", -- default/round/block/arrow
overriden_modules = nil, overriden_modules = nil,
}, },
-- lazyload it when there are 1+ buffers -- lazyload it when there are 1+ buffers
tabufline = { tabufline = {
enabled = true, enabled = true,
lazyload = true, lazyload = true,
overriden_modules = nil, overriden_modules = nil,
}, },
} }
options = require("core.utils").load_override(options, "NvChad/ui") options = require("core.utils").load_override(options, "NvChad/ui")
@ -25,16 +25,16 @@ require "nvchad_ui.tabufline.lazyload"(options.tabufline)
-- ignore this as it might scare you XD -- ignore this as it might scare you XD
return { return {
statusline = function() statusline = function()
return require("nvchad_ui.statusline").setup(options) return require("nvchad_ui.statusline").setup(options)
end, end,
tabufline = function() tabufline = function()
return require("nvchad_ui.tabufline").setup(options) return require("nvchad_ui.tabufline").setup(options)
end, end,
load_ui_plugins = function() load_ui_plugins = function()
vim.opt.statusline = "%!v:lua.require('plugins.configs.nvchad_ui').statusline()" vim.opt.statusline = "%!v:lua.require('plugins.configs.nvchad_ui').statusline()"
vim.opt.tabline = "%!v:lua.require('plugins.configs.nvchad_ui').tabufline()" vim.opt.tabline = "%!v:lua.require('plugins.configs.nvchad_ui').tabufline()"
end, end,
} }

View file

@ -1,86 +1,86 @@
local present, nvimtree = pcall(require, "nvim-tree") local present, nvimtree = pcall(require, "nvim-tree")
if not present then if not present then
return return
end end
require("base46").load_highlight "nvimtree" require("base46").load_highlight "nvimtree"
local options = { local options = {
filters = { filters = {
dotfiles = false, dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" }, exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
}, },
disable_netrw = true, disable_netrw = true,
hijack_netrw = true, hijack_netrw = true,
open_on_setup = false, open_on_setup = false,
ignore_ft_on_setup = { "alpha" }, ignore_ft_on_setup = { "alpha" },
hijack_cursor = true, hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false, hijack_unnamed_buffer_when_opening = false,
update_cwd = true, update_cwd = true,
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_cwd = false, update_cwd = false,
}, },
view = { view = {
adaptive_size = true, adaptive_size = true,
side = "left", side = "left",
width = 25, width = 25,
hide_root_folder = true, hide_root_folder = true,
}, },
git = { git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false, enable = false,
ignore = true, },
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
highlight_git = false,
highlight_opened_files = "none",
indent_markers = { icons = {
enable = false, show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
}, },
icons = { glyphs = {
show = { default = "",
file = true, symlink = "",
folder = true, folder = {
folder_arrow = true, default = "",
git = false, empty = "",
}, empty_open = "",
open = "",
glyphs = { symlink = "",
default = "", symlink_open = "",
symlink = "", arrow_open = "",
folder = { arrow_closed = "",
default = "", },
empty = "", git = {
empty_open = "", unstaged = "",
open = "", staged = "",
symlink = "", unmerged = "",
symlink_open = "", renamed = "",
arrow_open = "", untracked = "",
arrow_closed = "", deleted = "",
}, ignored = "",
git = { },
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
}, },
}, },
},
} }
-- check for any override -- check for any override

View file

@ -1,32 +1,32 @@
local present, nvterm = pcall(require, "nvterm") local present, nvterm = pcall(require, "nvterm")
if not present then if not present then
return return
end end
require "base46.term" require "base46.term"
local options = { local options = {
terminals = { terminals = {
list = {}, list = {},
type_opts = { type_opts = {
float = { float = {
relative = "editor", relative = "editor",
row = 0.3, row = 0.3,
col = 0.25, col = 0.25,
width = 0.5, width = 0.5,
height = 0.4, height = 0.4,
border = "single", border = "single",
},
horizontal = { location = "rightbelow", split_ratio = 0.3 },
vertical = { location = "rightbelow", split_ratio = 0.5 },
}, },
}, horizontal = { location = "rightbelow", split_ratio = 0.3 },
behavior = { vertical = { location = "rightbelow", split_ratio = 0.5 },
close_on_exit = true, },
auto_insert = true, },
}, behavior = {
enable_new_mappings = true, close_on_exit = true,
auto_insert = true,
},
enable_new_mappings = true,
} }
options = require("core.utils").load_override(options, "NvChad/nvterm") options = require("core.utils").load_override(options, "NvChad/nvterm")

View file

@ -3,163 +3,163 @@ local M = {}
local load_override = require("core.utils").load_override local load_override = require("core.utils").load_override
M.autopairs = function() M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs") local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp = pcall(require, "cmp") local present2, cmp = pcall(require, "cmp")
if not (present1 and present2) then if not (present1 and present2) then
return return
end end
local options = { local options = {
fast_wrap = {}, fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" }, disable_filetype = { "TelescopePrompt", "vim" },
} }
options = load_override(options, "windwp/nvim-autopairs") options = load_override(options, "windwp/nvim-autopairs")
autopairs.setup(options) autopairs.setup(options)
local cmp_autopairs = require "nvim-autopairs.completion.cmp" local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end end
M.blankline = function() M.blankline = function()
local present, blankline = pcall(require, "indent_blankline") local present, blankline = pcall(require, "indent_blankline")
if not present then if not present then
return return
end end
require("base46").load_highlight "blankline" require("base46").load_highlight "blankline"
local options = { local options = {
indentLine_enabled = 1, indentLine_enabled = 1,
filetype_exclude = { filetype_exclude = {
"help", "help",
"terminal", "terminal",
"alpha", "alpha",
"packer", "packer",
"lspinfo", "lspinfo",
"TelescopePrompt", "TelescopePrompt",
"TelescopeResults", "TelescopeResults",
"lsp-installer", "lsp-installer",
"", "",
}, },
buftype_exclude = { "terminal" }, buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false, show_trailing_blankline_indent = false,
show_first_indent_level = false, show_first_indent_level = false,
show_current_context = true, show_current_context = true,
show_current_context_start = true, show_current_context_start = true,
} }
options = load_override(options, "lukas-reineke/indent-blankline.nvim") options = load_override(options, "lukas-reineke/indent-blankline.nvim")
blankline.setup(options) blankline.setup(options)
end end
M.colorizer = function() M.colorizer = function()
local present, colorizer = pcall(require, "colorizer") local present, colorizer = pcall(require, "colorizer")
if not present then if not present then
return return
end end
local options = { local options = {
filetypes = { filetypes = {
"*", "*",
}, },
user_default_options = { user_default_options = {
RGB = true, -- #RGB hex codes RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue names = false, -- "Name" codes like Blue
RRGGBBAA = false, -- #RRGGBBAA hex codes RRGGBBAA = false, -- #RRGGBBAA hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = "background", -- Set the display mode. mode = "background", -- Set the display mode.
}, },
} }
options = load_override(options, "NvChad/nvim-colorizer.lua") options = load_override(options, "NvChad/nvim-colorizer.lua")
colorizer.setup(options["filetypes"], options["user_default_options"]) colorizer.setup(options["filetypes"], options["user_default_options"])
vim.cmd "ColorizerAttachToBuffer" vim.cmd "ColorizerAttachToBuffer"
end end
M.comment = function() M.comment = function()
local present, nvim_comment = pcall(require, "Comment") local present, nvim_comment = pcall(require, "Comment")
if not present then if not present then
return return
end end
local options = {} local options = {}
options = load_override(options, "numToStr/Comment.nvim") options = load_override(options, "numToStr/Comment.nvim")
nvim_comment.setup(options) nvim_comment.setup(options)
end end
M.luasnip = function() M.luasnip = function()
local present, luasnip = pcall(require, "luasnip") local present, luasnip = pcall(require, "luasnip")
if not present then if not present then
return return
end end
local options = { local options = {
history = true, history = true,
updateevents = "TextChanged,TextChangedI", updateevents = "TextChanged,TextChangedI",
} }
options = load_override(options, "L3MON4D3/LuaSnip") options = load_override(options, "L3MON4D3/LuaSnip")
luasnip.config.set_config(options) luasnip.config.set_config(options)
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" } require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", { vim.api.nvim_create_autocmd("InsertLeave", {
callback = function() callback = function()
if if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active and not require("luasnip").session.jump_active
then then
require("luasnip").unlink_current() require("luasnip").unlink_current()
end end
end, end,
}) })
end end
M.gitsigns = function() M.gitsigns = function()
local present, gitsigns = pcall(require, "gitsigns") local present, gitsigns = pcall(require, "gitsigns")
if not present then if not present then
return return
end end
require("base46").load_highlight "git" require("base46").load_highlight "git"
local options = { local options = {
signs = { signs = {
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" }, add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" }, change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" }, topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" }, changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
}, },
} }
options = load_override(options, "lewis6991/gitsigns.nvim") options = load_override(options, "lewis6991/gitsigns.nvim")
gitsigns.setup(options) gitsigns.setup(options)
end end
M.devicons = function() M.devicons = function()
local present, devicons = pcall(require, "nvim-web-devicons") local present, devicons = pcall(require, "nvim-web-devicons")
if present then if present then
require("base46").load_highlight "devicons" require("base46").load_highlight "devicons"
local options = { override = require("nvchad_ui.icons").devicons } local options = { override = require("nvchad_ui.icons").devicons }
options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons") options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons")
devicons.setup(options) devicons.setup(options)
end end
end end
return M return M

View file

@ -1,7 +1,7 @@
local present, telescope = pcall(require, "telescope") local present, telescope = pcall(require, "telescope")
if not present then if not present then
return return
end end
vim.g.theme_switcher_loaded = true vim.g.theme_switcher_loaded = true
@ -9,56 +9,56 @@ vim.g.theme_switcher_loaded = true
require("base46").load_highlight "telescope" require("base46").load_highlight "telescope"
local options = { local options = {
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
"rg", "rg",
"--color=never", "--color=never",
"--no-heading", "--no-heading",
"--with-filename", "--with-filename",
"--line-number", "--line-number",
"--column", "--column",
"--smart-case", "--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,
}, },
prompt_prefix = "", vertical = {
selection_caret = " ", mirror = false,
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, width = 0.87,
file_ignore_patterns = { "node_modules" }, height = 0.80,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, preview_cutoff = 120,
path_display = { "truncate" }, },
winblend = 0, file_sorter = require("telescope.sorters").get_fuzzy_file,
border = {}, file_ignore_patterns = { "node_modules" },
borderchars = { "", "", "", "", "", "", "", "" }, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
color_devicons = true, path_display = { "truncate" },
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, winblend = 0,
file_previewer = require("telescope.previewers").vim_buffer_cat.new, border = {},
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, borderchars = { "", "", "", "", "", "", "", "" },
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, color_devicons = true,
-- Developer configurations: Not meant for general override set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, file_previewer = require("telescope.previewers").vim_buffer_cat.new,
mappings = { grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
n = { ["q"] = require("telescope.actions").close }, 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,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" }, extensions_list = { "themes", "terms" },
} }
-- check for any override -- check for any override
@ -67,7 +67,7 @@ telescope.setup(options)
-- load extensions -- load extensions
pcall(function() pcall(function()
for _, ext in ipairs(options.extensions_list) do for _, ext in ipairs(options.extensions_list) do
telescope.load_extension(ext) telescope.load_extension(ext)
end end
end) end)

View file

@ -1,20 +1,20 @@
local present, treesitter = pcall(require, "nvim-treesitter.configs") local present, treesitter = pcall(require, "nvim-treesitter.configs")
if not present then if not present then
return return
end end
require("base46").load_highlight "syntax" require("base46").load_highlight "syntax"
require("base46").load_highlight "treesitter" require("base46").load_highlight "treesitter"
local options = { local options = {
ensure_installed = { ensure_installed = {
"lua", "lua",
}, },
highlight = { highlight = {
enable = true, enable = true,
use_languagetree = true, use_languagetree = true,
}, },
} }
-- check for any override -- check for any override

View file

@ -1,39 +1,39 @@
local present, wk = pcall(require, "which-key") local present, wk = pcall(require, "which-key")
if not present then if not present then
return return
end end
require("base46").load_highlight "whichkey" require("base46").load_highlight "whichkey"
local options = { local options = {
icons = { icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group group = "+", -- symbol prepended to a group
}, },
popup_mappings = { popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup scroll_up = "<c-u>", -- binding to scroll up inside the popup
}, },
window = { window = {
border = "none", -- none/single/double/shadow border = "none", -- none/single/double/shadow
}, },
layout = { layout = {
spacing = 6, -- spacing between columns spacing = 6, -- spacing between columns
}, },
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " },
triggers_blacklist = { triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey -- list of mode / prefixes that should never be hooked by WhichKey
i = { "j", "k" }, i = { "j", "k" },
v = { "j", "k" }, v = { "j", "k" },
}, },
} }
options = require("core.utils").load_override(options, "folke/which-key.nvim") options = require("core.utils").load_override(options, "folke/which-key.nvim")

View file

@ -2,192 +2,192 @@ vim.cmd "packadd packer.nvim"
local plugins = { local plugins = {
["nvim-lua/plenary.nvim"] = { module = "plenary" }, ["nvim-lua/plenary.nvim"] = { module = "plenary" },
["wbthomason/packer.nvim"] = {}, ["wbthomason/packer.nvim"] = {},
["NvChad/extensions"] = { module = { "telescope", "nvchad" } }, ["NvChad/extensions"] = { module = { "telescope", "nvchad" } },
["NvChad/base46"] = { ["NvChad/base46"] = {
config = function() config = function()
local ok, base46 = pcall(require, "base46") local ok, base46 = pcall(require, "base46")
if ok then if ok then
base46.load_theme() base46.load_theme()
end end
end, end,
}, },
["NvChad/ui"] = { ["NvChad/ui"] = {
after = "base46", after = "base46",
config = function() config = function()
require("plugins.configs.nvchad_ui").load_ui_plugins() require("plugins.configs.nvchad_ui").load_ui_plugins()
end, end,
}, },
["NvChad/nvterm"] = { ["NvChad/nvterm"] = {
module = "nvterm", module = "nvterm",
config = function() config = function()
require "plugins.configs.nvterm" require "plugins.configs.nvterm"
end, end,
}, },
["kyazdani42/nvim-web-devicons"] = { ["kyazdani42/nvim-web-devicons"] = {
module = "nvim-web-devicons", module = "nvim-web-devicons",
config = function() config = function()
require("plugins.configs.others").devicons() require("plugins.configs.others").devicons()
end, end,
}, },
["lukas-reineke/indent-blankline.nvim"] = { ["lukas-reineke/indent-blankline.nvim"] = {
opt = true, opt = true,
setup = function() setup = function()
require("core.lazy_load").on_file_open "indent-blankline.nvim" require("core.lazy_load").on_file_open "indent-blankline.nvim"
end, end,
config = function() config = function()
require("plugins.configs.others").blankline() require("plugins.configs.others").blankline()
end, end,
}, },
["NvChad/nvim-colorizer.lua"] = { ["NvChad/nvim-colorizer.lua"] = {
opt = true, opt = true,
setup = function() setup = function()
require("core.lazy_load").colorizer() require("core.lazy_load").colorizer()
end, end,
config = function() config = function()
require("plugins.configs.others").colorizer() require("plugins.configs.others").colorizer()
end, end,
}, },
["nvim-treesitter/nvim-treesitter"] = { ["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter", module = "nvim-treesitter",
setup = function() setup = function()
require("core.lazy_load").on_file_open "nvim-treesitter" require("core.lazy_load").on_file_open "nvim-treesitter"
end, end,
cmd = require("core.lazy_load").treesitter_cmds, cmd = require("core.lazy_load").treesitter_cmds,
run = ":TSUpdate", run = ":TSUpdate",
config = function() config = function()
require "plugins.configs.treesitter" require "plugins.configs.treesitter"
end, end,
}, },
-- git stuff -- git stuff
["lewis6991/gitsigns.nvim"] = { ["lewis6991/gitsigns.nvim"] = {
ft = "gitcommit", ft = "gitcommit",
setup = function() setup = function()
require("core.lazy_load").gitsigns() require("core.lazy_load").gitsigns()
end, end,
config = function() config = function()
require("plugins.configs.others").gitsigns() require("plugins.configs.others").gitsigns()
end, end,
}, },
-- lsp stuff -- lsp stuff
["williamboman/nvim-lsp-installer"] = { ["williamboman/nvim-lsp-installer"] = {
opt = true, opt = true,
cmd = require("core.lazy_load").lsp_cmds, cmd = require("core.lazy_load").lsp_cmds,
setup = function() setup = function()
require("core.lazy_load").on_file_open "nvim-lsp-installer" require("core.lazy_load").on_file_open "nvim-lsp-installer"
end, end,
}, },
["neovim/nvim-lspconfig"] = { ["neovim/nvim-lspconfig"] = {
after = "nvim-lsp-installer", after = "nvim-lsp-installer",
module = "lspconfig", module = "lspconfig",
config = function() config = function()
require "plugins.configs.lsp_installer" require "plugins.configs.lsp_installer"
require "plugins.configs.lspconfig" require "plugins.configs.lspconfig"
end, end,
}, },
-- load luasnips + cmp related in insert mode only -- load luasnips + cmp related in insert mode only
["rafamadriz/friendly-snippets"] = { ["rafamadriz/friendly-snippets"] = {
module = "cmp_nvim_lsp", module = "cmp_nvim_lsp",
event = "InsertEnter", event = "InsertEnter",
}, },
["hrsh7th/nvim-cmp"] = { ["hrsh7th/nvim-cmp"] = {
after = "friendly-snippets", after = "friendly-snippets",
config = function() config = function()
require "plugins.configs.cmp" require "plugins.configs.cmp"
end, end,
}, },
["L3MON4D3/LuaSnip"] = { ["L3MON4D3/LuaSnip"] = {
wants = "friendly-snippets", wants = "friendly-snippets",
after = "nvim-cmp", after = "nvim-cmp",
config = function() config = function()
require("plugins.configs.others").luasnip() require("plugins.configs.others").luasnip()
end, end,
}, },
["saadparwaiz1/cmp_luasnip"] = { ["saadparwaiz1/cmp_luasnip"] = {
after = "LuaSnip", after = "LuaSnip",
}, },
["hrsh7th/cmp-nvim-lua"] = { ["hrsh7th/cmp-nvim-lua"] = {
after = "cmp_luasnip", after = "cmp_luasnip",
}, },
["hrsh7th/cmp-nvim-lsp"] = { ["hrsh7th/cmp-nvim-lsp"] = {
after = "cmp-nvim-lua", after = "cmp-nvim-lua",
}, },
["hrsh7th/cmp-buffer"] = { ["hrsh7th/cmp-buffer"] = {
after = "cmp-nvim-lsp", after = "cmp-nvim-lsp",
}, },
["hrsh7th/cmp-path"] = { ["hrsh7th/cmp-path"] = {
after = "cmp-buffer", after = "cmp-buffer",
}, },
-- misc plugins -- misc plugins
["windwp/nvim-autopairs"] = { ["windwp/nvim-autopairs"] = {
after = "nvim-cmp", after = "nvim-cmp",
config = function() config = function()
require("plugins.configs.others").autopairs() require("plugins.configs.others").autopairs()
end, end,
}, },
["goolord/alpha-nvim"] = { ["goolord/alpha-nvim"] = {
after = "base46", after = "base46",
disable = true, disable = true,
config = function() config = function()
require "plugins.configs.alpha" require "plugins.configs.alpha"
end, end,
}, },
["numToStr/Comment.nvim"] = { ["numToStr/Comment.nvim"] = {
module = "Comment", module = "Comment",
keys = { "gc", "gb" }, keys = { "gc", "gb" },
config = function() config = function()
require("plugins.configs.others").comment() require("plugins.configs.others").comment()
end, end,
}, },
-- file managing , picker etc -- file managing , picker etc
["kyazdani42/nvim-tree.lua"] = { ["kyazdani42/nvim-tree.lua"] = {
ft = "alpha", ft = "alpha",
cmd = { "NvimTreeToggle", "NvimTreeFocus" }, cmd = { "NvimTreeToggle", "NvimTreeFocus" },
config = function() config = function()
require "plugins.configs.nvimtree" require "plugins.configs.nvimtree"
end, end,
}, },
["nvim-telescope/telescope.nvim"] = { ["nvim-telescope/telescope.nvim"] = {
cmd = "Telescope", cmd = "Telescope",
config = function() config = function()
require "plugins.configs.telescope" require "plugins.configs.telescope"
end, end,
}, },
-- Only load whichkey after all the gui -- Only load whichkey after all the gui
["folke/which-key.nvim"] = { ["folke/which-key.nvim"] = {
module = "which-key", module = "which-key",
config = function() config = function()
require "plugins.configs.whichkey" require "plugins.configs.whichkey"
end, end,
}, },
} }
require("core.packer").run(plugins) require("core.packer").run(plugins)