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

View File

@ -19,8 +19,6 @@ M.init = function(theme)
package.loaded["colors.highlights" or false] = nil
-- then load the highlights
require "colors.highlights"
else
return false
end
end

View File

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

View File

@ -132,25 +132,25 @@ M.hide_statusline = function()
if vim.tbl_contains(hidden, buftype) then
api.nvim_set_option("laststatus", 0)
return
else
api.nvim_set_option("laststatus", 2)
end
api.nvim_set_option("laststatus", 2)
end
M.load_config = function(reload)
M.load_config = function()
local conf = require "core.default_config"
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"
conf = vim.tbl_deep_extend("force", conf, change)
return conf
end
end
-- or load default config
-- or load default config
return conf
end

View File

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

View File

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

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 = {}
M.icons = {
local icons = {
Text = "",
Method = "",
Function = "",
@ -28,4 +26,4 @@ M.icons = {
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_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_show_icons = {
folders = 1,
-- folder_arrows= 1
files = 1,
git = git_status,
}
@ -38,11 +37,8 @@ g.nvim_tree_icons = {
untracked = "",
},
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 = "",
empty = "", -- 
empty = "",
empty_open = "",
open = "",
symlink = "",

View File

@ -1,19 +1,17 @@
local M = {}
local chadrc_config = require("core.utils").load_config()
M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
if not (present1 or present2) then
return
end
if present1 and present2 then
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()
@ -71,10 +69,7 @@ end
M.luasnip = function()
local present, luasnip = pcall(require, "luasnip")
if not present then
return
end
if present then
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
@ -82,6 +77,7 @@ M.luasnip = function()
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()
@ -114,8 +110,8 @@ M.lsp_handlers = function()
lspSymbol("Error", "")
lspSymbol("Information", "")
lspSymbol("Hint", "")
lspSymbol("Warning", "")
lspSymbol("Hint", "")
lspSymbol("Warning", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {
@ -146,4 +142,19 @@ M.lsp_handlers = function()
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

View File

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

View File

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

View File

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

View File

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