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
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 3
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

View file

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

View file

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

View file

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

View file

@ -10,38 +10,38 @@ local api = vim.api
-- dont list quickfix buffers
autocmd("FileType", {
pattern = "qf",
callback = function()
vim.opt_local.buflisted = false
end,
pattern = "qf",
callback = function()
vim.opt_local.buflisted = false
end,
})
-- wrap the PackerSync command to warn people before using it in NvChadSnapshots
autocmd("VimEnter", {
callback = function()
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync(<f-args>)"
end,
callback = function()
vim.cmd "command! -nargs=* -complete=customlist,v:lua.require'packer'.plugin_complete PackerSync lua require('core.utils').packer_sync(<f-args>)"
end,
})
-- Disable statusline in dashboard
autocmd("FileType", {
pattern = "alpha",
callback = function()
vim.opt.laststatus = 0
end,
pattern = "alpha",
callback = function()
vim.opt.laststatus = 0
end,
})
autocmd("BufUnload", {
buffer = 0,
callback = function()
vim.opt.laststatus = 3
end,
buffer = 0,
callback = function()
vim.opt.laststatus = 3
end,
})
-- Don't auto commenting new lines
autocmd("BufEnter", {
pattern = "*",
command = "set fo-=c fo-=r fo-=o",
pattern = "*",
command = "set fo-=c fo-=r fo-=o",
})
-- 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
-- thx to https://github.com/ii14 & stores buffer per tab -> table
autocmd({ "BufAdd", "BufEnter" }, {
callback = function(args)
if vim.t.bufs == nil then
vim.t.bufs = { args.buf }
else
local bufs = vim.t.bufs
callback = function(args)
if vim.t.bufs == nil then
vim.t.bufs = { args.buf }
else
local bufs = vim.t.bufs
-- check for duplicates
if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then
table.insert(bufs, args.buf)
vim.t.bufs = bufs
end
-- check for duplicates
if not vim.tbl_contains(bufs, args.buf) and (args.event == "BufAdd" or vim.bo[args.buf].buflisted) then
table.insert(bufs, args.buf)
vim.t.bufs = bufs
end
end,
end
end,
})
autocmd("BufDelete", {
callback = function(args)
for _, tab in ipairs(api.nvim_list_tabpages()) do
local bufs = vim.t[tab].bufs
if bufs then
for i, bufnr in ipairs(bufs) do
if bufnr == args.buf then
table.remove(bufs, i)
vim.t[tab].bufs = bufs
break
end
end
end
callback = function(args)
for _, tab in ipairs(api.nvim_list_tabpages()) do
local bufs = vim.t[tab].bufs
if bufs then
for i, bufnr in ipairs(bufs) do
if bufnr == args.buf then
table.remove(bufs, i)
vim.t[tab].bufs = bufs
break
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
-- ex : treesitter, lspconfig etc
M.lazy_load = function(tb)
autocmd(tb.events, {
pattern = "*",
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function()
if tb.condition() then
vim.api.nvim_del_augroup_by_name(tb.augroup_name)
autocmd(tb.events, {
pattern = "*",
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function()
if tb.condition() then
vim.api.nvim_del_augroup_by_name(tb.augroup_name)
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if tb.plugins ~= "nvim-treesitter" then
vim.defer_fn(function()
vim.cmd("PackerLoad " .. tb.plugins)
end, 0)
else
vim.cmd("PackerLoad " .. tb.plugins)
end
end
end,
})
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if tb.plugins ~= "nvim-treesitter" then
vim.defer_fn(function()
vim.cmd("PackerLoad " .. tb.plugins)
end, 0)
else
vim.cmd("PackerLoad " .. tb.plugins)
end
end
end,
})
end
M.colorizer = function()
M.lazy_load {
events = { "BufRead", "BufNewFile" },
augroup_name = "ColorizerLazy",
plugins = "nvim-colorizer.lua",
M.lazy_load {
events = { "BufRead", "BufNewFile" },
augroup_name = "ColorizerLazy",
plugins = "nvim-colorizer.lua",
condition = function()
return true
end,
}
condition = function()
return true
end,
}
end
-- 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
M.on_file_open = function(plugin_name)
M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugins = plugin_name,
condition = function()
local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
end,
}
M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugins = plugin_name,
condition = function()
local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
end,
}
end
-- lspinstaller & lspconfig cmds for lazyloading
M.lsp_cmds = {
"LspInfo",
"LspStart",
"LspRestart",
"LspStop",
"LspInstall",
"LspUnInstall",
"LspUnInstallAll",
"LspInstall",
"LspInstallInfo",
"LspInstallLog",
"LspLog",
"LspPrintInstalled",
"LspInfo",
"LspStart",
"LspRestart",
"LspStop",
"LspInstall",
"LspUnInstall",
"LspUnInstallAll",
"LspInstall",
"LspInstallInfo",
"LspInstallLog",
"LspLog",
"LspPrintInstalled",
}
M.treesitter_cmds = {
"TSInstall",
"TSBufEnable",
"TSBufDisable",
"TSEnable",
"TSDisable",
"TSModuleInfo",
"TSInstall",
"TSBufEnable",
"TSBufDisable",
"TSEnable",
"TSDisable",
"TSModuleInfo",
}
M.gitsigns = function()
-- taken from https://github.com/max397574
autocmd({ "BufRead" }, {
callback = function()
local function onexit(code, _)
if code == 0 then
vim.schedule(function()
require("packer").loader "gitsigns.nvim"
end)
end
end
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
if lines ~= { "" } then
vim.loop.spawn("git", {
args = {
"ls-files",
"--error-unmatch",
vim.fn.expand "%:p:h",
},
}, onexit)
end
end,
})
-- taken from https://github.com/max397574
autocmd({ "BufRead" }, {
callback = function()
local function onexit(code, _)
if code == 0 then
vim.schedule(function()
require("packer").loader "gitsigns.nvim"
end)
end
end
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
if lines ~= { "" } then
vim.loop.spawn("git", {
args = {
"ls-files",
"--error-unmatch",
vim.fn.expand "%:p:h",
},
}, onexit)
end
end,
})
end
return M

View file

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

View file

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

View file

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

View file

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

View file

@ -1,77 +1,77 @@
local present, alpha = pcall(require, "alpha")
if not present then
return
return
end
require("base46").load_highlight "alpha"
local function button(sc, txt, keybind)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
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",
}
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
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,
}
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 options = {}
local ascii = {
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
}
options.header = {
type = "text",
val = ascii,
opts = {
position = "center",
hl = "AlphaHeader",
},
type = "text",
val = ascii,
opts = {
position = "center",
hl = "AlphaHeader",
},
}
options.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,
},
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,
},
}
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) }
alpha.setup {
layout = {
{ type = "padding", val = headerPadding },
options.header,
{ type = "padding", val = 2 },
options.buttons,
},
opts = {},
layout = {
{ type = "padding", val = headerPadding },
options.header,
{ type = "padding", val = 2 },
options.buttons,
},
opts = {},
}

View file

@ -1,7 +1,7 @@
local present, cmp = pcall(require, "cmp")
if not present then
return
return
end
require("base46").load_highlight "cmp"
@ -9,92 +9,92 @@ require("base46").load_highlight "cmp"
vim.opt.completeopt = "menuone,noselect"
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
local cmp_window = require "cmp.utils.window"
cmp_window.info_ = cmp_window.info
cmp_window.info = function(self)
local info = self:info_()
info.scrollable = false
return info
local info = self:info_()
info.scrollable = false
return info
end
local options = {
window = {
completion = {
border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
},
documentation = {
border = border "CmpDocBorder",
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = function(_, vim_item)
local icons = require("nvchad_ui.icons").lspkind
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
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 = false,
},
["<Tab>"] = cmp.mapping(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, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(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, {
"i",
"s",
}),
},
sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
window = {
completion = {
border = border "CmpBorder",
winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None",
},
documentation = {
border = border "CmpDocBorder",
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = function(_, vim_item)
local icons = require("nvchad_ui.icons").lspkind
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
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 = false,
},
["<Tab>"] = cmp.mapping(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, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(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, {
"i",
"s",
}),
},
sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
}
-- check for any override

View file

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

View file

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

View file

@ -1,22 +1,22 @@
local present, _ = pcall(require, "nvchad_ui")
if not present then
return
return
end
local options = {
statusline = {
separator_style = "default", -- default/round/block/arrow
overriden_modules = nil,
},
statusline = {
separator_style = "default", -- default/round/block/arrow
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
enabled = true,
lazyload = true,
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
enabled = true,
lazyload = true,
overriden_modules = nil,
},
}
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
return {
statusline = function()
return require("nvchad_ui.statusline").setup(options)
end,
statusline = function()
return require("nvchad_ui.statusline").setup(options)
end,
tabufline = function()
return require("nvchad_ui.tabufline").setup(options)
end,
tabufline = function()
return require("nvchad_ui.tabufline").setup(options)
end,
load_ui_plugins = function()
vim.opt.statusline = "%!v:lua.require('plugins.configs.nvchad_ui').statusline()"
vim.opt.tabline = "%!v:lua.require('plugins.configs.nvchad_ui').tabufline()"
end,
load_ui_plugins = function()
vim.opt.statusline = "%!v:lua.require('plugins.configs.nvchad_ui').statusline()"
vim.opt.tabline = "%!v:lua.require('plugins.configs.nvchad_ui').tabufline()"
end,
}

View file

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

View file

@ -1,32 +1,32 @@
local present, nvterm = pcall(require, "nvterm")
if not present then
return
return
end
require "base46.term"
local options = {
terminals = {
list = {},
type_opts = {
float = {
relative = "editor",
row = 0.3,
col = 0.25,
width = 0.5,
height = 0.4,
border = "single",
},
horizontal = { location = "rightbelow", split_ratio = 0.3 },
vertical = { location = "rightbelow", split_ratio = 0.5 },
terminals = {
list = {},
type_opts = {
float = {
relative = "editor",
row = 0.3,
col = 0.25,
width = 0.5,
height = 0.4,
border = "single",
},
},
behavior = {
close_on_exit = true,
auto_insert = true,
},
enable_new_mappings = true,
horizontal = { location = "rightbelow", split_ratio = 0.3 },
vertical = { location = "rightbelow", split_ratio = 0.5 },
},
},
behavior = {
close_on_exit = true,
auto_insert = true,
},
enable_new_mappings = true,
}
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
M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp = pcall(require, "cmp")
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp = pcall(require, "cmp")
if not (present1 and present2) then
return
end
if not (present1 and present2) then
return
end
local options = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
}
local options = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
}
options = load_override(options, "windwp/nvim-autopairs")
autopairs.setup(options)
options = load_override(options, "windwp/nvim-autopairs")
autopairs.setup(options)
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
M.blankline = function()
local present, blankline = pcall(require, "indent_blankline")
local present, blankline = pcall(require, "indent_blankline")
if not present then
return
end
if not present then
return
end
require("base46").load_highlight "blankline"
require("base46").load_highlight "blankline"
local options = {
indentLine_enabled = 1,
filetype_exclude = {
"help",
"terminal",
"alpha",
"packer",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"lsp-installer",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
show_current_context = true,
show_current_context_start = true,
}
local options = {
indentLine_enabled = 1,
filetype_exclude = {
"help",
"terminal",
"alpha",
"packer",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"lsp-installer",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
show_current_context = true,
show_current_context_start = true,
}
options = load_override(options, "lukas-reineke/indent-blankline.nvim")
blankline.setup(options)
options = load_override(options, "lukas-reineke/indent-blankline.nvim")
blankline.setup(options)
end
M.colorizer = function()
local present, colorizer = pcall(require, "colorizer")
local present, colorizer = pcall(require, "colorizer")
if not present then
return
end
if not present then
return
end
local options = {
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
mode = "background", -- Set the display mode.
},
}
local options = {
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
mode = "background", -- Set the display mode.
},
}
options = load_override(options, "NvChad/nvim-colorizer.lua")
colorizer.setup(options["filetypes"], options["user_default_options"])
options = load_override(options, "NvChad/nvim-colorizer.lua")
colorizer.setup(options["filetypes"], options["user_default_options"])
vim.cmd "ColorizerAttachToBuffer"
vim.cmd "ColorizerAttachToBuffer"
end
M.comment = function()
local present, nvim_comment = pcall(require, "Comment")
local present, nvim_comment = pcall(require, "Comment")
if not present then
return
end
if not present then
return
end
local options = {}
options = load_override(options, "numToStr/Comment.nvim")
nvim_comment.setup(options)
local options = {}
options = load_override(options, "numToStr/Comment.nvim")
nvim_comment.setup(options)
end
M.luasnip = function()
local present, luasnip = pcall(require, "luasnip")
local present, luasnip = pcall(require, "luasnip")
if not present then
return
end
if not present then
return
end
local options = {
history = true,
updateevents = "TextChanged,TextChangedI",
}
local options = {
history = true,
updateevents = "TextChanged,TextChangedI",
}
options = load_override(options, "L3MON4D3/LuaSnip")
luasnip.config.set_config(options)
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
options = load_override(options, "L3MON4D3/LuaSnip")
luasnip.config.set_config(options)
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
end
M.gitsigns = function()
local present, gitsigns = pcall(require, "gitsigns")
local present, gitsigns = pcall(require, "gitsigns")
if not present then
return
end
if not present then
return
end
require("base46").load_highlight "git"
require("base46").load_highlight "git"
local options = {
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" },
},
}
local options = {
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" },
},
}
options = load_override(options, "lewis6991/gitsigns.nvim")
gitsigns.setup(options)
options = load_override(options, "lewis6991/gitsigns.nvim")
gitsigns.setup(options)
end
M.devicons = function()
local present, devicons = pcall(require, "nvim-web-devicons")
local present, devicons = pcall(require, "nvim-web-devicons")
if present then
require("base46").load_highlight "devicons"
if present then
require("base46").load_highlight "devicons"
local options = { override = require("nvchad_ui.icons").devicons }
options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons")
local options = { override = require("nvchad_ui.icons").devicons }
options = require("core.utils").load_override(options, "kyazdani42/nvim-web-devicons")
devicons.setup(options)
end
devicons.setup(options)
end
end
return M

View file

@ -1,7 +1,7 @@
local present, telescope = pcall(require, "telescope")
if not present then
return
return
end
vim.g.theme_switcher_loaded = true
@ -9,56 +9,56 @@ vim.g.theme_switcher_loaded = true
require("base46").load_highlight "telescope"
local options = {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
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,
},
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,
vertical = {
mirror = false,
},
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,
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,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
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,
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,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
extensions_list = { "themes", "terms" },
}
-- check for any override
@ -67,7 +67,7 @@ telescope.setup(options)
-- load extensions
pcall(function()
for _, ext in ipairs(options.extensions_list) do
telescope.load_extension(ext)
end
for _, ext in ipairs(options.extensions_list) do
telescope.load_extension(ext)
end
end)

View file

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

View file

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

View file

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