nicer feline default config

This commit is contained in:
Felix Kratz 2022-05-09 20:47:28 +02:00
parent 08a16b9201
commit 465b0af032
2 changed files with 73 additions and 143 deletions

View File

@ -21,6 +21,8 @@ opt.smartindent = true
-- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758 -- disable tilde on end of buffer: https://github.com/neovim/neovim/pull/8546#issuecomment-643643758
opt.fillchars = { eob = " " } opt.fillchars = { eob = " " }
opt.showmode = false
opt.hidden = true opt.hidden = true
opt.ignorecase = true opt.ignorecase = true
opt.smartcase = true opt.smartcase = true

View File

@ -14,48 +14,73 @@ options.icon_styles = {
default = { default = {
left = "", left = "",
right = "", right = "",
main_icon = " ", main_icon = " ",
vi_mode_icon = " ", vi_mode_icon = " ",
position_icon = "", position_icon = "",
}, },
arrow = { arrow = {
left = "", left = "",
right = "", right = "",
main_icon = " ", main_icon = " ",
vi_mode_icon = "", vi_mode_icon = "",
position_icon = "", position_icon = "",
}, },
block = { block = {
left = " ", left = " ",
right = " ", right = " ",
main_icon = " ", main_icon = " ",
vi_mode_icon = "", vi_mode_icon = "",
position_icon = "", position_icon = "",
}, },
round = { round = {
left = "", left = "",
right = "", right = "",
main_icon = " ", main_icon = " ",
vi_mode_icon = " ", vi_mode_icon = " ",
position_icon = "", position_icon = "",
}, },
slant = { slant = {
left = "", left = "",
right = "", right = "",
main_icon = " ", main_icon = " ",
vi_mode_icon = " ", vi_mode_icon = " ",
position_icon = "", position_icon = "",
}, },
} }
options.mode_colors = {
["n"] = { "NORMAL", options.colors.red },
["no"] = { "N-PENDING", options.colors.red },
["i"] = { "INSERT", options.colors.dark_purple },
["ic"] = { "INSERT", options.colors.dark_purple },
["t"] = { "TERMINAL", options.colors.green },
["v"] = { "VISUAL", options.colors.cyan },
["V"] = { "V-LINE", options.colors.cyan },
[""] = { "V-BLOCK", options.colors.cyan },
["R"] = { "REPLACE", options.colors.orange },
["Rv"] = { "V-REPLACE", options.colors.orange },
["s"] = { "SELECT", options.colors.nord_blue },
["S"] = { "S-LINE", options.colors.nord_blue },
[""] = { "S-BLOCK", options.colors.nord_blue },
["c"] = { "COMMAND", options.colors.pink },
["cv"] = { "COMMAND", options.colors.pink },
["ce"] = { "COMMAND", options.colors.pink },
["r"] = { "PROMPT", options.colors.teal },
["rm"] = { "MORE", options.colors.teal },
["r?"] = { "CONFIRM", options.colors.teal },
["!"] = { "SHELL", options.colors.green },
}
options.separator_style = options.separator_style =
options.icon_styles[require("core.utils").load_config().plugins.options.statusline.separator_style] options.icon_styles[require("core.utils").load_config().plugins.options.statusline.separator_style]
options.main_icon = { options.main_icon = {
provider = options.separator_style.main_icon, provider = function()
return "" .. options.mode_colors[vim.fn.mode()][1] .. " "
end,
hl = { hl = {
fg = options.colors.statusline_bg, fg = options.colors.statusline_bg,
@ -71,17 +96,18 @@ options.main_icon = {
}, },
} }
options.file_name = { options.dir_name = {
provider = function() provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
local filename = vim.fn.expand "%:t" local filename = vim.fn.expand "%:t"
local extension = vim.fn.expand "%:e" local extension = vim.fn.expand "%:e"
local icon = require("nvim-web-devicons").get_icon(filename, extension) local icon = require("nvim-web-devicons").get_icon(filename, extension)
if icon == nil then if icon == nil then
icon = "" icon = ""
return icon
end end
return " " .. icon .. " " .. filename .. " " return " " .. icon .. " " .. dir_name .. " "
end, end,
hl = { hl = {
fg = options.colors.white, fg = options.colors.white,
bg = options.colors.lightbg, bg = options.colors.lightbg,
@ -93,25 +119,6 @@ options.file_name = {
}, },
} }
options.dir_name = {
provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
return "" .. dir_name .. " "
end,
hl = {
fg = options.colors.grey_fg2,
bg = options.colors.lightbg2,
},
right_sep = {
str = options.separator_style.right,
hi = {
fg = options.colors.lightbg2,
bg = options.colors.statusline_bg,
},
},
}
options.diff = { options.diff = {
add = { add = {
provider = "git_diff_added", provider = "git_diff_added",
@ -119,7 +126,7 @@ options.diff = {
fg = options.colors.grey_fg2, fg = options.colors.grey_fg2,
bg = options.colors.statusline_bg, bg = options.colors.statusline_bg,
}, },
icon = "", icon = " ",
}, },
change = { change = {
@ -227,121 +234,49 @@ options.lsp_progress = {
options.lsp_icon = { options.lsp_icon = {
provider = function() provider = function()
if next(vim.lsp.buf_get_clients()) ~= nil then if next(vim.lsp.buf_get_clients()) ~= nil then
return "  LSP" return "  LSP "
else else
return "" return " "
end end
end, end,
hl = { fg = options.colors.grey_fg2, bg = options.colors.statusline_bg }, hl = { fg = options.colors.grey_fg2, bg = options.colors.statusline_bg },
} }
options.mode_colors = {
["n"] = { "NORMAL", options.colors.red },
["no"] = { "N-PENDING", options.colors.red },
["i"] = { "INSERT", options.colors.dark_purple },
["ic"] = { "INSERT", options.colors.dark_purple },
["t"] = { "TERMINAL", options.colors.green },
["v"] = { "VISUAL", options.colors.cyan },
["V"] = { "V-LINE", options.colors.cyan },
[""] = { "V-BLOCK", options.colors.cyan },
["R"] = { "REPLACE", options.colors.orange },
["Rv"] = { "V-REPLACE", options.colors.orange },
["s"] = { "SELECT", options.colors.nord_blue },
["S"] = { "S-LINE", options.colors.nord_blue },
[""] = { "S-BLOCK", options.colors.nord_blue },
["c"] = { "COMMAND", options.colors.pink },
["cv"] = { "COMMAND", options.colors.pink },
["ce"] = { "COMMAND", options.colors.pink },
["r"] = { "PROMPT", options.colors.teal },
["rm"] = { "MORE", options.colors.teal },
["r?"] = { "CONFIRM", options.colors.teal },
["!"] = { "SHELL", options.colors.green },
}
options.chad_mode_hl = function()
return {
fg = options.mode_colors[vim.fn.mode()][2],
bg = options.colors.one_bg,
}
end
options.empty_space = {
provider = " " .. options.separator_style.left,
hl = {
fg = options.colors.one_bg2,
bg = options.colors.statusline_bg,
},
}
-- this matches the vi mode color
options.empty_spaceColored = {
provider = options.separator_style.left,
hl = function()
return {
fg = options.mode_colors[vim.fn.mode()][2],
bg = options.colors.one_bg2,
}
end,
}
options.mode_icon = {
provider = options.separator_style.vi_mode_icon,
hl = function()
return {
fg = options.colors.statusline_bg,
bg = options.mode_colors[vim.fn.mode()][2],
}
end,
}
options.empty_space2 = {
provider = function()
return " " .. options.mode_colors[vim.fn.mode()][1] .. " "
end,
hl = options.chad_mode_hl,
}
options.separator_right = {
provider = options.separator_style.left,
hl = {
fg = options.colors.grey,
bg = options.colors.one_bg,
},
}
options.separator_right2 = {
provider = options.separator_style.left,
hl = {
fg = options.colors.green,
bg = options.colors.grey,
},
}
options.position_icon = {
provider = options.separator_style.position_icon,
hl = {
fg = options.colors.black,
bg = options.colors.green,
},
}
options.current_line = { options.current_line = {
provider = function() provider = function()
local current_line = vim.fn.line "." local current_line = vim.fn.line "."
local current_col = vim.fn.col "."
local total_line = vim.fn.line "$" local total_line = vim.fn.line "$"
if current_col < 10 then
current_col = " " .. current_col
end
if current_line == 1 then if current_line == 1 then
return " Top " return "" .. current_line .. ":" .. current_col .. "/" .. "Top "
elseif current_line == vim.fn.line "$" then elseif current_line == vim.fn.line "$" then
return " Bot " return "" .. current_line .. ":" .. current_col .. "/" .. "Bot "
end end
local result, _ = math.modf((current_line / total_line) * 100) local result, _ = math.modf((current_line / total_line) * 100)
return " " .. result .. "%% "
if result < 10 then
result = " " .. result
end
return "" .. current_line .. ":" .. current_col .. "/" .. result .. "%% "
end, end,
hl = { hl = {
fg = options.colors.green, fg = options.colors.statusline_bg,
bg = options.colors.one_bg, bg = options.colors.green,
},
left_sep = {
str = options.separator_style.left,
hl = {
fg = options.colors.green,
bg = options.colors.statusline_bg,
},
}, },
} }
@ -360,27 +295,20 @@ options.right = {}
-- left -- left
add_table(options.left, options.main_icon) add_table(options.left, options.main_icon)
add_table(options.left, options.file_name)
add_table(options.left, options.dir_name) add_table(options.left, options.dir_name)
add_table(options.left, options.git_branch)
add_table(options.left, options.diff.add) add_table(options.left, options.diff.add)
add_table(options.left, options.diff.change) add_table(options.left, options.diff.change)
add_table(options.left, options.diff.remove) add_table(options.left, options.diff.remove)
add_table(options.left, options.diagnostic.error)
add_table(options.left, options.diagnostic.warning)
add_table(options.left, options.diagnostic.hint)
add_table(options.left, options.diagnostic.info)
add_table(options.middle, options.lsp_progress) add_table(options.middle, options.lsp_progress)
-- right -- right
add_table(options.right, options.diagnostic.error)
add_table(options.right, options.diagnostic.warning)
add_table(options.right, options.diagnostic.hint)
add_table(options.right, options.diagnostic.info)
add_table(options.right, options.lsp_icon) add_table(options.right, options.lsp_icon)
add_table(options.right, options.git_branch)
add_table(options.right, options.empty_space)
add_table(options.right, options.empty_spaceColored)
add_table(options.right, options.mode_icon)
add_table(options.right, options.empty_space2)
add_table(options.right, options.separator_right)
add_table(options.right, options.separator_right2)
add_table(options.right, options.position_icon) add_table(options.right, options.position_icon)
add_table(options.right, options.current_line) add_table(options.right, options.current_line)