clean up!

This commit is contained in:
siduck 2021-11-17 11:00:57 +05:30
parent aa9667a5de
commit 3330d1cc06
14 changed files with 68 additions and 101 deletions

View File

@ -82,9 +82,11 @@ fg("DashboardHeader", grey_fg)
fg("DashboardShortcut", grey_fg) fg("DashboardShortcut", grey_fg)
-- Git signs -- Git signs
fg_bg("DiffAdd", nord_blue, "none") fg_bg("DiffAdd", blue, "NONE")
fg_bg("DiffChange", grey_fg, "none") fg_bg("DiffChange", grey_fg, "NONE")
fg_bg("DiffModified", nord_blue, "none") fg_bg("DiffChangeDelete", red, "NONE")
fg_bg("DiffModified", red, "NONE")
fg_bg("DiffDelete", red, "NONE")
-- Indent blankline plugin -- Indent blankline plugin
fg("IndentBlanklineChar", line) fg("IndentBlanklineChar", line)
@ -137,7 +139,7 @@ if ui.transparency then
bg("NvimTreeStatusLineNC", "NONE") bg("NvimTreeStatusLineNC", "NONE")
bg("NvimTreeVertSplit", "NONE") bg("NvimTreeVertSplit", "NONE")
fg("NvimTreeVertSplit", grey) fg("NvimTreeVertSplit", grey)
end end
if #override ~= 0 then if #override ~= 0 then
require(override) require(override)

View File

@ -19,9 +19,7 @@ M.init = function(theme)
package.loaded["colors.highlights" or false] = nil package.loaded["colors.highlights" or false] = nil
-- then load the highlights -- then load the highlights
require "colors.highlights" require "colors.highlights"
else end
return false
end
end end
-- returns a table of colors for givem or current theme -- returns a table of colors for givem or current theme

View File

@ -108,9 +108,6 @@ M.misc = function()
-- add NvChadUpdate command and mapping -- add NvChadUpdate command and mapping
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()" cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>") map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
-- add ChadReload command and maping
-- cmd "silent! command! NvChadReload lua require('nvchad').reload_config()"
end end
non_config_mappings() non_config_mappings()

View File

@ -132,25 +132,25 @@ M.hide_statusline = function()
if vim.tbl_contains(hidden, buftype) then if vim.tbl_contains(hidden, buftype) then
api.nvim_set_option("laststatus", 0) api.nvim_set_option("laststatus", 0)
return return
else
api.nvim_set_option("laststatus", 2)
end end
api.nvim_set_option("laststatus", 2)
end end
M.load_config = function(reload) M.load_config = function()
local conf = require "core.default_config" local conf = require "core.default_config"
local chadrcExists, _ = pcall(require, "custom.chadrc") local chadrcExists, _ = pcall(require, "custom.chadrc")
-- if chadrc exists , then merge its table into the default config's -- if chadrc exists , then merge its table into the default config's
if chadrcExists then if chadrcExists then
local change = require "custom.chadrc" local change = require "custom.chadrc"
conf = vim.tbl_deep_extend("force", conf, change) conf = vim.tbl_deep_extend("force", conf, change)
return conf return conf
end end
-- or load default config -- or load default config
return conf return conf
end end

View File

@ -10,7 +10,6 @@ bufferline.setup {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
buffer_close_icon = "", buffer_close_icon = "",
modified_icon = "", modified_icon = "",
-- close_icon = "%@NvChad_bufferline_quitvim@%X",
close_icon = "", close_icon = "",
show_close_icon = true, show_close_icon = true,
left_trunc_marker = "", left_trunc_marker = "",
@ -24,7 +23,7 @@ bufferline.setup {
show_buffer_close_icons = true, show_buffer_close_icons = true,
separator_style = "thin", separator_style = "thin",
always_show_bufferline = true, always_show_bufferline = true,
diagnostics = false, -- "or nvim_lsp" diagnostics = false,
custom_filter = function(buf_number) custom_filter = function(buf_number)
-- Func to filter out our managed/persistent split terms -- Func to filter out our managed/persistent split terms
local present_type, type = pcall(function() local present_type, type = pcall(function()
@ -36,12 +35,11 @@ bufferline.setup {
return false return false
elseif type == "hori" then elseif type == "hori" then
return false return false
else
return true
end end
else
return true return true
end end
return true
end, end,
}, },
@ -121,6 +119,7 @@ bufferline.setup {
guifg = colors.black2, guifg = colors.black2,
guibg = colors.black2, guibg = colors.black2,
}, },
-- tabs -- tabs
tab = { tab = {
guifg = colors.light_grey, guifg = colors.light_grey,

View File

@ -6,7 +6,6 @@ end
vim.opt.completeopt = "menuone,noselect" vim.opt.completeopt = "menuone,noselect"
-- nvim-cmp setup
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -15,12 +14,8 @@ cmp.setup {
}, },
formatting = { formatting = {
format = function(entry, vim_item) format = function(entry, vim_item)
-- load lspkind icons local icons = require "plugins.configs.lspkind_icons"
vim_item.kind = string.format( vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
"%s %s",
require("plugins.configs.lspkind_icons").icons[vim_item.kind],
vim_item.kind
)
vim_item.menu = ({ vim_item.menu = ({
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",

View File

@ -1,34 +0,0 @@
local present, gitsigns = pcall(require, "gitsigns")
if not present then
return
end
gitsigns.setup {
keymaps = {
-- Default keymap options
buffer = true,
noremap = true,
["n ]c"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
["n [c"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
numhl = false,
sign_priority = 5,
signs = {
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
},
status_formatter = nil, -- Use default
watch_gitdir = {
interval = 100,
},
}

View File

@ -1,6 +1,4 @@
local M = {} local icons = {
M.icons = {
Text = "", Text = "",
Method = "", Method = "",
Function = "", Function = "",
@ -28,4 +26,4 @@ M.icons = {
TypeParameter = "", TypeParameter = "",
} }
return M return icons

View File

@ -17,10 +17,9 @@ g.nvim_tree_indent_markers = 1
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" } g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" } g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
--
g.nvim_tree_show_icons = { g.nvim_tree_show_icons = {
folders = 1, folders = 1,
-- folder_arrows= 1
files = 1, files = 1,
git = git_status, git = git_status,
} }
@ -38,11 +37,8 @@ g.nvim_tree_icons = {
untracked = "", untracked = "",
}, },
folder = { folder = {
-- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below!
-- arrow_open = "",
-- arrow_closed = "",
default = "", default = "",
empty = "", --  empty = "",
empty_open = "", empty_open = "",
open = "", open = "",
symlink = "", symlink = "",

View File

@ -1,19 +1,17 @@
local M = {} local M = {}
local chadrc_config = require("core.utils").load_config() local chadrc_config = require("core.utils").load_config()
M.autopairs = function() M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs") local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp") local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
if not (present1 or present2) then if present1 and present2 then
return autopairs.setup()
local cmp = require "cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end end
autopairs.setup()
-- not needed if you disable cmp, the above var related to cmp tooo! override default config for autopairs
local cmp = require "cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end end
M.better_escape = function() M.better_escape = function()
@ -71,17 +69,15 @@ end
M.luasnip = function() M.luasnip = function()
local present, luasnip = pcall(require, "luasnip") local present, luasnip = pcall(require, "luasnip")
if not present then if present then
return luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
}
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
require("luasnip/loaders/from_vscode").load()
end end
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
}
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
require("luasnip/loaders/from_vscode").load()
end end
M.signature = function() M.signature = function()
@ -114,8 +110,8 @@ M.lsp_handlers = function()
lspSymbol("Error", "") lspSymbol("Error", "")
lspSymbol("Information", "") lspSymbol("Information", "")
lspSymbol("Hint", "") lspSymbol("Hint", "")
lspSymbol("Warning", "") lspSymbol("Warning", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = { virtual_text = {
@ -146,4 +142,19 @@ M.lsp_handlers = function()
end end
end end
M.gitsigns = function()
local present, gitsigns = pcall(require, "gitsigns")
if present then
gitsigns.setup {
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" },
},
}
end
end
return M return M

View File

@ -43,10 +43,12 @@ local icon_styles = {
} }
local config = require("core.utils").load_config().plugins.options.statusline local config = require("core.utils").load_config().plugins.options.statusline
-- statusline style -- statusline style
local user_statusline_style = config.style local user_statusline_style = config.style
local statusline_style = icon_styles[user_statusline_style] local statusline_style = icon_styles[user_statusline_style]
-- if show short statusline on small screens
-- show short statusline on small screens
local shortline = config.shortline == false and true local shortline = config.shortline == false and true
-- Initialize the components table -- Initialize the components table
@ -55,7 +57,6 @@ local components = {
inactive = {}, inactive = {},
} }
-- Initialize left, mid and right
table.insert(components.active, {}) table.insert(components.active, {})
table.insert(components.active, {}) table.insert(components.active, {})
table.insert(components.active, {}) table.insert(components.active, {})
@ -186,6 +187,7 @@ components.active[1][10] = {
components.active[2][1] = { components.active[2][1] = {
provider = function() provider = function()
local Lsp = vim.lsp.util.get_progress_messages()[1] local Lsp = vim.lsp.util.get_progress_messages()[1]
if Lsp then if Lsp then
local msg = Lsp.message or "" local msg = Lsp.message or ""
local percentage = Lsp.percentage or 0 local percentage = Lsp.percentage or 0
@ -207,10 +209,11 @@ components.active[2][1] = {
if percentage >= 70 then if percentage >= 70 then
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage) return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
else
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
end end
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
end end
return "" return ""
end, end,
enabled = shortline or function(winid) enabled = shortline or function(winid)

View File

@ -1,4 +1,5 @@
local present, telescope = pcall(require, "telescope") local present, telescope = pcall(require, "telescope")
if not present then if not present then
return return
end end

View File

@ -1,4 +1,5 @@
local present, ts_config = pcall(require, "nvim-treesitter.configs") local present, ts_config = pcall(require, "nvim-treesitter.configs")
if not present then if not present then
return return
end end

View File

@ -78,7 +78,7 @@ return packer.startup(function()
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
disable = not plugin_settings.status.gitsigns, disable = not plugin_settings.status.gitsigns,
opt = true, opt = true,
config = override_req("gitsigns", "plugins.configs.gitsigns"), config = override_req("gitsigns", "(plugins.configs.others).gitsigns()"),
setup = function() setup = function()
require("core.utils").packer_lazy_load "gitsigns.nvim" require("core.utils").packer_lazy_load "gitsigns.nvim"
end, end,