BREAKING CHANGE | re-implementation of custom config

This commit is contained in:
siduck 2022-04-27 21:12:28 +05:30
parent d906bb0d9c
commit adecbe719f
20 changed files with 835 additions and 1309 deletions

View file

@ -32,9 +32,9 @@ local function button(sc, txt, keybind)
}
end
local default = {}
local options = {}
default.ascii = {
local ascii = {
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
@ -48,16 +48,16 @@ default.ascii = {
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
}
default.header = {
options.header = {
type = "text",
val = default.ascii,
val = ascii,
opts = {
position = "center",
hl = "AlphaHeader",
},
}
default.buttons = {
options.buttons = {
type = "group",
val = {
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
@ -72,21 +72,14 @@ default.buttons = {
},
}
local M = {}
options = require("core.utils").load_override(options, "goolord/alpha-nvim")
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("alpha", default)
end
alpha.setup {
layout = {
{ type = "padding", val = 9 },
default.header,
{ type = "padding", val = 2 },
default.buttons,
},
opts = {},
}
end
return M
alpha.setup {
layout = {
{ type = "padding", val = 9 },
options.header,
{ type = "padding", val = 2 },
options.buttons,
},
opts = {},
}

View file

@ -3,10 +3,9 @@ if not present then
return
end
local default = {
colors = require("colors").get(),
}
default = {
local colors = require("colors").get()
local options = {
options = {
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
buffer_close_icon = "",
@ -46,103 +45,98 @@ default = {
highlights = {
background = {
guifg = default.colors.grey_fg,
guibg = default.colors.black2,
guifg = colors.grey_fg,
guibg = colors.black2,
},
-- buffers
buffer_selected = {
guifg = default.colors.white,
guibg = default.colors.black,
guifg = colors.white,
guibg = colors.black,
gui = "bold",
},
buffer_visible = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
guifg = colors.light_grey,
guibg = colors.black2,
},
-- for diagnostics = "nvim_lsp"
error = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
guifg = colors.light_grey,
guibg = colors.black2,
},
error_diagnostic = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
guifg = colors.light_grey,
guibg = colors.black2,
},
-- close buttons
close_button = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_visible = {
guifg = default.colors.light_grey,
guibg = default.colors.black2,
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_selected = {
guifg = default.colors.red,
guibg = default.colors.black,
guifg = colors.red,
guibg = colors.black,
},
fill = {
guifg = default.colors.grey_fg,
guibg = default.colors.black2,
guifg = colors.grey_fg,
guibg = colors.black2,
},
indicator_selected = {
guifg = default.colors.black,
guibg = default.colors.black,
guifg = colors.black,
guibg = colors.black,
},
-- modified
modified = {
guifg = default.colors.red,
guibg = default.colors.black2,
guifg = colors.red,
guibg = colors.black2,
},
modified_visible = {
guifg = default.colors.red,
guibg = default.colors.black2,
guifg = colors.red,
guibg = colors.black2,
},
modified_selected = {
guifg = default.colors.green,
guibg = default.colors.black,
guifg = colors.green,
guibg = colors.black,
},
-- separators
separator = {
guifg = default.colors.black2,
guibg = default.colors.black2,
guifg = colors.black2,
guibg = colors.black2,
},
separator_visible = {
guifg = default.colors.black2,
guibg = default.colors.black2,
guifg = colors.black2,
guibg = colors.black2,
},
separator_selected = {
guifg = default.colors.black2,
guibg = default.colors.black2,
guifg = colors.black2,
guibg = colors.black2,
},
-- tabs
tab = {
guifg = default.colors.light_grey,
guibg = default.colors.one_bg3,
guifg = colors.light_grey,
guibg = colors.one_bg3,
},
tab_selected = {
guifg = default.colors.black2,
guibg = default.colors.nord_blue,
guifg = colors.black2,
guibg = colors.nord_blue,
},
tab_close = {
guifg = default.colors.red,
guibg = default.colors.black,
guifg = colors.red,
guibg = colors.black,
},
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("bufferline", default)
end
bufferline.setup(default)
end
-- check for any override
options = require("core.utils").load_override(options, "akinsho/bufferline.nvim")
return M
bufferline.setup(options)

View file

@ -6,7 +6,7 @@ end
vim.opt.completeopt = "menuone,noselect"
local default = {
local options = {
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
@ -45,7 +45,10 @@ local default = {
else
fallback()
end
end, { "i", "s" }),
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
@ -54,7 +57,10 @@ local default = {
else
fallback()
end
end, { "i", "s" }),
end, {
"i",
"s",
}),
},
sources = {
{ name = "nvim_lsp" },
@ -65,12 +71,7 @@ local default = {
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_cmp", default)
end
cmp.setup(default)
end
-- check for any override
-- options = require("core.utils").load_override(options, "cmp")
return M
cmp.setup(options)

View file

@ -1,158 +1,152 @@
local present, icons = pcall(require, "nvim-web-devicons")
local present, devicons = pcall(require, "nvim-web-devicons")
if not present then
return
end
local default = {
colors = require("colors").get(),
}
local colors = require("colors").get()
default = {
local options = {
override = {
c = {
icon = "",
color = default.colors.blue,
color = colors.blue,
name = "c",
},
css = {
icon = "",
color = default.colors.blue,
color = colors.blue,
name = "css",
},
deb = {
icon = "",
color = default.colors.cyan,
color = colors.cyan,
name = "deb",
},
Dockerfile = {
icon = "",
color = default.colors.cyan,
color = colors.cyan,
name = "Dockerfile",
},
html = {
icon = "",
color = default.colors.baby_pink,
color = colors.baby_pink,
name = "html",
},
jpeg = {
icon = "",
color = default.colors.dark_purple,
color = colors.dark_purple,
name = "jpeg",
},
jpg = {
icon = "",
color = default.colors.dark_purple,
color = colors.dark_purple,
name = "jpg",
},
js = {
icon = "",
color = default.colors.sun,
color = colors.sun,
name = "js",
},
kt = {
icon = "󱈙",
color = default.colors.orange,
color = colors.orange,
name = "kt",
},
lock = {
icon = "",
color = default.colors.red,
color = colors.red,
name = "lock",
},
lua = {
icon = "",
color = default.colors.blue,
color = colors.blue,
name = "lua",
},
mp3 = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "mp3",
},
mp4 = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "mp4",
},
out = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "out",
},
png = {
icon = "",
color = default.colors.dark_purple,
color = colors.dark_purple,
name = "png",
},
py = {
icon = "",
color = default.colors.cyan,
color = colors.cyan,
name = "py",
},
["robots.txt"] = {
icon = "",
color = default.colors.red,
color = colors.red,
name = "robots",
},
toml = {
icon = "",
color = default.colors.blue,
color = colors.blue,
name = "toml",
},
ts = {
icon = "",
color = default.colors.teal,
color = colors.teal,
name = "ts",
},
ttf = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "TrueTypeFont",
},
rb = {
icon = "",
color = default.colors.pink,
color = colors.pink,
name = "rb",
},
rpm = {
icon = "",
color = default.colors.orange,
color = colors.orange,
name = "rpm",
},
vue = {
icon = "",
color = default.colors.vibrant_green,
color = colors.vibrant_green,
name = "vue",
},
woff = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "WebOpenFontFormat",
},
woff2 = {
icon = "",
color = default.colors.white,
color = colors.white,
name = "WebOpenFontFormat2",
},
xz = {
icon = "",
color = default.colors.sun,
color = colors.sun,
name = "xz",
},
zip = {
icon = "",
color = default.colors.sun,
color = colors.sun,
name = "zip",
},
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_web_devicons", default)
end
icons.setup(default)
end
-- check for any override
-- options = require("core.utils").load_override(options, "nvim_web_devicons")
return M
devicons.setup(options)

View file

@ -1,4 +1,5 @@
local M = {}
require("plugins.configs.others").lsp_handlers()
function M.on_attach(client, bufnr)

View file

@ -1,8 +1,14 @@
local present, nvimtree = pcall(require, "nvim-tree")
if not present then
return
end
-- globals must be set prior to requiring nvim-tree to function
local g = vim.g
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_git_hl = 0
g.nvim_tree_git_hl = 1
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
@ -34,20 +40,13 @@ g.nvim_tree_icons = {
},
}
local present, nvimtree = pcall(require, "nvim-tree")
if not present then
return
end
local default = {
local options = {
filters = {
dotfiles = false,
},
disable_netrw = true,
hijack_netrw = true,
ignore_ft_on_setup = { "dashboard" },
auto_close = false,
open_on_tab = false,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
@ -57,7 +56,6 @@ local default = {
update_cwd = false,
},
view = {
allow_resize = true,
side = "left",
width = 25,
hide_root_folder = true,
@ -74,17 +72,11 @@ local default = {
renderer = {
indent_markers = {
enable = true,
}
}
},
},
}
local M = {}
-- check for any override
options = require("core.utils").load_override(options, "kyazdani42/nvim-tree.lua")
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_tree", default)
end
nvimtree.setup(default)
end
return M
nvimtree.setup(options)

View file

@ -0,0 +1,43 @@
local present, nvterm = pcall(require, "nvterm")
if not present then
return
end
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 },
},
},
behavior = {
close_on_exit = true,
auto_insert = true,
},
mappings = {
toggle = {
float = "<A-i>",
horizontal = "<A-h>",
vertical = "<A-v>",
},
new = {
horizontal = "<leader>h",
vertical = "<leader>v",
},
},
enable_new_mappings = true,
}
options = require("core.utils").load_override(options, "NvChad/nvterm")
nvterm.setup(options)

View file

@ -1,36 +1,49 @@
local M = {}
local chadrc_config = require("core.utils").load_config()
M.autopairs = function(override_flag)
M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
local present2, cmp = pcall(require, "cmp")
if present1 and present2 then
local default = { fast_wrap = {} }
if override_flag then
default = require("core.utils").tbl_override_req("nvim_autopairs", default)
end
autopairs.setup(default)
local cmp = require "cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
if not present1 and present2 then
return
end
end
M.better_escape = function(override_flag)
local default = {
mapping = chadrc_config.mappings.plugins.better_escape.esc_insertmode,
timeout = chadrc_config.plugins.options.esc_insertmode_timeout,
autopairs.setup {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
}
if override_flag then
default = require("core.utils").tbl_override_req("better_escape", default)
end
require("better_escape").setup(default)
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end
M.blankline = function(override_flag)
local default = {
M.better_escape = function()
local present, escape = pcall(require, "better_escape")
if not present then
return
end
local options = {
mapping = { "jk" }, -- a table with mappings to use
timeout = vim.o.timeoutlen,
clear_empty_lines = false, -- clear line after escaping if there is only whitespace
keys = "<Esc>",
}
options = require("core.utils").load_override(options, "max397574/better-escape.nvim")
escape.setup(options)
end
M.blankline = function()
local present, blankline = pcall(require, "indent_blankline")
if not present then
return
end
local options = {
indentLine_enabled = 1,
char = "",
filetype_exclude = {
@ -49,93 +62,97 @@ M.blankline = function(override_flag)
show_trailing_blankline_indent = false,
show_first_indent_level = false,
}
if override_flag then
default = require("core.utils").tbl_override_req("indent_blankline", default)
end
require("indent_blankline").setup(default)
options = require("core.utils").load_override(options, "lukas-reineke/indent-blankline.nvim")
blankline.setup(options)
end
M.colorizer = function(override_flag)
M.colorizer = function()
local present, colorizer = pcall(require, "colorizer")
if present then
local default = {
filetypes = {
"*",
},
user_default_options = {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue
RRGGBBAA = false, -- #RRGGBBAA hex codes
rgb_fn = false, -- CSS rgb() and rgba() functions
hsl_fn = false, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes: foreground, background
mode = "background", -- Set the display mode.
},
}
if override_flag then
default = require("core.utils").tbl_override_req("nvim_colorizer", default)
end
colorizer.setup(default["filetypes"], default["user_default_options"])
vim.cmd "ColorizerReloadAllBuffers"
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
-- Available modes: foreground, background
mode = "background", -- Set the display mode.
},
}
options = require("core.utils").load_override(options, "NvChad/nvim-colorizer.lua")
colorizer.setup(options["filetypes"], options["user_default_options"])
vim.cmd "ColorizerReloadAllBuffers"
end
M.comment = function(override_flag)
M.comment = function()
local present, nvim_comment = pcall(require, "Comment")
if present then
local default = {}
if override_flag then
default = require("core.utils").tbl_override_req("nvim_comment", default)
end
nvim_comment.setup(default)
if not present then
return
end
nvim_comment.setup()
end
M.luasnip = function(override_flag)
M.luasnip = function()
local present, luasnip = pcall(require, "luasnip")
if present then
local default = {
history = true,
updateevents = "TextChanged,TextChangedI",
}
if override_flag then
default = require("core.utils").tbl_override_req("luasnip", default)
end
luasnip.config.set_config(default)
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
require("luasnip/loaders/from_vscode").load()
return
end
luasnip.config.set_config {
history = true,
updateevents = "TextChanged,TextChangedI",
}
-- add snippet path here!
require("luasnip/loaders/from_vscode").load { paths = {} }
require("luasnip/loaders/from_vscode").load()
end
M.signature = function(override_flag)
local present, lspsignature = pcall(require, "lsp_signature")
if present then
local default = {
bind = true,
doc_lines = 0,
floating_window = true,
fix_pos = true,
hint_enable = true,
hint_prefix = "",
hint_scheme = "String",
hi_parameter = "Search",
max_height = 22,
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single", -- double, single, shadow, none
},
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
}
if override_flag then
default = require("core.utils").tbl_override_req("signature", default)
end
lspsignature.setup(default)
M.signature = function()
local present, lsp_signature = pcall(require, "lsp_signature")
if not present then
return
end
local options = {
bind = true,
doc_lines = 0,
floating_window = true,
fix_pos = true,
hint_enable = true,
hint_prefix = "",
hint_scheme = "String",
hi_parameter = "Search",
max_height = 22,
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
handler_opts = {
border = "single", -- double, single, shadow, none
},
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
}
options = require("core.utils").load_override(options, "ray-x/lsp_signature.nvim")
lsp_signature.setup(options)
end
M.lsp_handlers = function()
@ -178,23 +195,22 @@ M.lsp_handlers = function()
end
end
M.gitsigns = function(override_flag)
M.gitsigns = function()
local present, gitsigns = pcall(require, "gitsigns")
if present then
local default = {
signs = {
add = { hl = "DiffAdd", text = "", numhl = "GitSignsAddNr" },
change = { hl = "DiffChange", text = "", numhl = "GitSignsChangeNr" },
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
topdelete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
},
}
if override_flag then
default = require("core.utils").tbl_override_req("gitsigns", default)
end
gitsigns.setup(default)
if not present then
return
end
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
return M

View file

@ -1,16 +1,14 @@
local present, feline = pcall(require, "feline")
if not present then
return
end
local default = {
colors = require("colors").get(),
lsp = require "feline.providers.lsp",
lsp_severity = vim.diagnostic.severity,
config = require("core.utils").load_config().plugins.options.statusline,
}
local colors = require("colors").get()
local lsp = require "feline.providers.lsp"
local lsp_severity = vim.diagnostic.severity
default.icon_styles = {
local icon_styles = {
default = {
left = "",
right = "",
@ -51,35 +49,31 @@ default.icon_styles = {
},
}
-- statusline style
default.statusline_style = default.icon_styles[default.config.style]
-- show short statusline on small screens
default.shortline = default.config.shortline == false and true
local separator_style = icon_styles.default
-- Initialize the components table
default.components = {
local components = {
active = {},
}
default.main_icon = {
provider = default.statusline_style.main_icon,
local main_icon = {
provider = separator_style.main_icon,
hl = {
fg = default.colors.statusline_bg,
bg = default.colors.nord_blue,
fg = colors.statusline_bg,
bg = colors.nord_blue,
},
right_sep = {
str = default.statusline_style.right,
str = separator_style.right,
hl = {
fg = default.colors.nord_blue,
bg = default.colors.lightbg,
fg = colors.nord_blue,
bg = colors.lightbg,
},
},
}
default.file_name = {
local file_name = {
provider = function()
local filename = vim.fn.expand "%:t"
local extension = vim.fn.expand "%:e"
@ -90,49 +84,42 @@ default.file_name = {
end
return " " .. icon .. " " .. filename .. " "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = {
fg = default.colors.white,
bg = default.colors.lightbg,
fg = colors.white,
bg = colors.lightbg,
},
right_sep = {
str = default.statusline_style.right,
hl = { fg = default.colors.lightbg, bg = default.colors.lightbg2 },
str = separator_style.right,
hl = { fg = colors.lightbg, bg = colors.lightbg2 },
},
}
default.dir_name = {
local dir_name = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
end,
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.lightbg2,
fg = colors.grey_fg2,
bg = colors.lightbg2,
},
right_sep = {
str = default.statusline_style.right,
str = separator_style.right,
hi = {
fg = default.colors.lightbg2,
bg = default.colors.statusline_bg,
fg = colors.lightbg2,
bg = colors.statusline_bg,
},
},
}
default.diff = {
local diff = {
add = {
provider = "git_diff_added",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
fg = colors.grey_fg2,
bg = colors.statusline_bg,
},
icon = "",
},
@ -140,8 +127,8 @@ default.diff = {
change = {
provider = "git_diff_changed",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
fg = colors.grey_fg2,
bg = colors.statusline_bg,
},
icon = "",
},
@ -149,65 +136,62 @@ default.diff = {
remove = {
provider = "git_diff_removed",
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
fg = colors.grey_fg2,
bg = colors.statusline_bg,
},
icon = "",
},
}
default.git_branch = {
local git_branch = {
provider = "git_branch",
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = {
fg = default.colors.grey_fg2,
bg = default.colors.statusline_bg,
fg = colors.grey_fg2,
bg = colors.statusline_bg,
},
icon = "",
}
default.diagnostic = {
local diagnostic = {
error = {
provider = "diagnostic_errors",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.ERROR)
return lsp.diagnostics_exist(lsp_severity.ERROR)
end,
hl = { fg = default.colors.red },
hl = { fg = colors.red },
icon = "",
},
warning = {
provider = "diagnostic_warnings",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.WARN)
return lsp.diagnostics_exist(lsp_severity.WARN)
end,
hl = { fg = default.colors.yellow },
hl = { fg = colors.yellow },
icon = "",
},
hint = {
provider = "diagnostic_hints",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.HINT)
return lsp.diagnostics_exist(lsp_severity.HINT)
end,
hl = { fg = default.colors.grey_fg2 },
hl = { fg = colors.grey_fg2 },
icon = "",
},
info = {
provider = "diagnostic_info",
enabled = function()
return default.lsp.diagnostics_exist(default.lsp_severity.INFO)
return lsp.diagnostics_exist(lsp_severity.INFO)
end,
hl = { fg = default.colors.green },
hl = { fg = colors.green },
icon = "",
},
}
default.lsp_progress = {
local lsp_progress = {
provider = function()
local Lsp = vim.lsp.util.get_progress_messages()[1]
@ -239,13 +223,10 @@ default.lsp_progress = {
return ""
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 80
end,
hl = { fg = default.colors.green },
hl = { fg = colors.green },
}
default.lsp_icon = {
local lsp_icon = {
provider = function()
if next(vim.lsp.buf_get_clients()) ~= nil then
return " LSP"
@ -253,112 +234,100 @@ default.lsp_icon = {
return ""
end
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 70
end,
hl = { fg = default.colors.grey_fg2, bg = default.colors.statusline_bg },
hl = { fg = colors.grey_fg2, bg = colors.statusline_bg },
}
default.mode_colors = {
["n"] = { "NORMAL", default.colors.red },
["no"] = { "N-PENDING", default.colors.red },
["i"] = { "INSERT", default.colors.dark_purple },
["ic"] = { "INSERT", default.colors.dark_purple },
["t"] = { "TERMINAL", default.colors.green },
["v"] = { "VISUAL", default.colors.cyan },
["V"] = { "V-LINE", default.colors.cyan },
[""] = { "V-BLOCK", default.colors.cyan },
["R"] = { "REPLACE", default.colors.orange },
["Rv"] = { "V-REPLACE", default.colors.orange },
["s"] = { "SELECT", default.colors.nord_blue },
["S"] = { "S-LINE", default.colors.nord_blue },
[""] = { "S-BLOCK", default.colors.nord_blue },
["c"] = { "COMMAND", default.colors.pink },
["cv"] = { "COMMAND", default.colors.pink },
["ce"] = { "COMMAND", default.colors.pink },
["r"] = { "PROMPT", default.colors.teal },
["rm"] = { "MORE", default.colors.teal },
["r?"] = { "CONFIRM", default.colors.teal },
["!"] = { "SHELL", default.colors.green },
local mode_colors = {
["n"] = { "NORMAL", colors.red },
["no"] = { "N-PENDING", colors.red },
["i"] = { "INSERT", colors.dark_purple },
["ic"] = { "INSERT", colors.dark_purple },
["t"] = { "TERMINAL", colors.green },
["v"] = { "VISUAL", colors.cyan },
["V"] = { "V-LINE", colors.cyan },
[""] = { "V-BLOCK", colors.cyan },
["R"] = { "REPLACE", colors.orange },
["Rv"] = { "V-REPLACE", colors.orange },
["s"] = { "SELECT", colors.nord_blue },
["S"] = { "S-LINE", colors.nord_blue },
[""] = { "S-BLOCK", colors.nord_blue },
["c"] = { "COMMAND", colors.pink },
["cv"] = { "COMMAND", colors.pink },
["ce"] = { "COMMAND", colors.pink },
["r"] = { "PROMPT", colors.teal },
["rm"] = { "MORE", colors.teal },
["r?"] = { "CONFIRM", colors.teal },
["!"] = { "SHELL", colors.green },
}
default.chad_mode_hl = function()
local chad_mode_hl = function()
return {
fg = default.mode_colors[vim.fn.mode()][2],
bg = default.colors.one_bg,
fg = mode_colors[vim.fn.mode()][2],
bg = colors.one_bg,
}
end
default.empty_space = {
provider = " " .. default.statusline_style.left,
local empty_space = {
provider = " " .. separator_style.left,
hl = {
fg = default.colors.one_bg2,
bg = default.colors.statusline_bg,
fg = colors.one_bg2,
bg = colors.statusline_bg,
},
}
-- this matches the vi mode color
default.empty_spaceColored = {
provider = default.statusline_style.left,
local empty_spaceColored = {
provider = separator_style.left,
hl = function()
return {
fg = default.mode_colors[vim.fn.mode()][2],
bg = default.colors.one_bg2,
fg = mode_colors[vim.fn.mode()][2],
bg = colors.one_bg2,
}
end,
}
default.mode_icon = {
provider = default.statusline_style.vi_mode_icon,
local mode_icon = {
provider = separator_style.vi_mode_icon,
hl = function()
return {
fg = default.colors.statusline_bg,
bg = default.mode_colors[vim.fn.mode()][2],
fg = colors.statusline_bg,
bg = mode_colors[vim.fn.mode()][2],
}
end,
}
default.empty_space2 = {
local empty_space2 = {
provider = function()
return " " .. default.mode_colors[vim.fn.mode()][1] .. " "
return " " .. mode_colors[vim.fn.mode()][1] .. " "
end,
hl = default.chad_mode_hl,
hl = chad_mode_hl,
}
default.separator_right = {
provider = default.statusline_style.left,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
local separator_right = {
provider = separator_style.left,
hl = {
fg = default.colors.grey,
bg = default.colors.one_bg,
fg = colors.grey,
bg = colors.one_bg,
},
}
default.separator_right2 = {
provider = default.statusline_style.left,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
local separator_right2 = {
provider = separator_style.left,
hl = {
fg = default.colors.green,
bg = default.colors.grey,
fg = colors.green,
bg = colors.grey,
},
}
default.position_icon = {
provider = default.statusline_style.position_icon,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
local position_icon = {
provider = separator_style.position_icon,
hl = {
fg = default.colors.black,
bg = default.colors.green,
fg = colors.black,
bg = colors.green,
},
}
default.current_line = {
local current_line = {
provider = function()
local current_line = vim.fn.line "."
local total_line = vim.fn.line "$"
@ -372,13 +341,9 @@ default.current_line = {
return " " .. result .. "%% "
end,
enabled = default.shortline or function(winid)
return vim.api.nvim_win_get_width(tonumber(winid) or 0) > 90
end,
hl = {
fg = default.colors.green,
bg = default.colors.one_bg,
fg = colors.green,
bg = colors.one_bg,
},
}
@ -386,53 +351,45 @@ local function add_table(a, b)
table.insert(a, b)
end
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("feline", default)
end
-- components are divided in 3 sections
default.left = {}
default.middle = {}
default.right = {}
-- components are divided in 3 sections
local left = {}
local middle = {}
local right = {}
-- left
add_table(default.left, default.main_icon)
add_table(default.left, default.file_name)
add_table(default.left, default.dir_name)
add_table(default.left, default.diff.add)
add_table(default.left, default.diff.change)
add_table(default.left, default.diff.remove)
add_table(default.left, default.diagnostic.error)
add_table(default.left, default.diagnostic.warning)
add_table(default.left, default.diagnostic.hint)
add_table(default.left, default.diagnostic.info)
-- left
add_table(left, main_icon)
add_table(left, file_name)
add_table(left, dir_name)
add_table(left, diff.add)
add_table(left, diff.change)
add_table(left, diff.remove)
add_table(left, diagnostic.error)
add_table(left, diagnostic.warning)
add_table(left, diagnostic.hint)
add_table(left, diagnostic.info)
add_table(default.middle, default.lsp_progress)
add_table(middle, lsp_progress)
-- right
add_table(default.right, default.lsp_icon)
add_table(default.right, default.git_branch)
add_table(default.right, default.empty_space)
add_table(default.right, default.empty_spaceColored)
add_table(default.right, default.mode_icon)
add_table(default.right, default.empty_space2)
add_table(default.right, default.separator_right)
add_table(default.right, default.separator_right2)
add_table(default.right, default.position_icon)
add_table(default.right, default.current_line)
-- right
add_table(right, lsp_icon)
add_table(right, git_branch)
add_table(right, empty_space)
add_table(right, empty_spaceColored)
add_table(right, mode_icon)
add_table(right, empty_space2)
add_table(right, separator_right)
add_table(right, separator_right2)
add_table(right, position_icon)
add_table(right, current_line)
default.components.active[1] = default.left
default.components.active[2] = default.middle
default.components.active[3] = default.right
components.active[1] = left
components.active[2] = middle
components.active[3] = right
feline.setup {
theme = {
bg = default.colors.statusline_bg,
fg = default.colors.fg,
},
components = default.components,
}
end
return M
feline.setup {
theme = {
bg = colors.statusline_bg,
fg = colors.fg,
},
components = components,
}

View file

@ -4,7 +4,7 @@ if not present then
return
end
local default = {
local options = {
defaults = {
vimgrep_arguments = {
"rg",
@ -53,21 +53,15 @@ local default = {
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("telescope", default)
-- check for any override
options = require("core.utils").load_override(options, "nvim-telescope/telescope.nvim")
telescope.setup(options)
-- load extensions
local extensions = { "themes", "terms" }
pcall(function()
for _, ext in ipairs(extensions) do
telescope.load_extension(ext)
end
telescope.setup(default)
local extensions = { "themes", "terms" }
pcall(function()
for _, ext in ipairs(extensions) do
telescope.load_extension(ext)
end
end)
end
return M
end)

View file

@ -1,10 +1,10 @@
local present, ts_config = pcall(require, "nvim-treesitter.configs")
local present, treesitter = pcall(require, "nvim-treesitter.configs")
if not present then
return
end
local default = {
local options = {
ensure_installed = {
"lua",
"vim",
@ -15,12 +15,7 @@ local default = {
},
}
local M = {}
M.setup = function(override_flag)
if override_flag then
default = require("core.utils").tbl_override_req("nvim_treesitter", default)
end
ts_config.setup(default)
end
-- check for any override
options = require("core.utils").load_override(options, "nvim-treesitter/nvim-treesitter")
return M
treesitter.setup(options)