diff options
Diffstat (limited to 'lua/plugins/feline.lua')
| -rw-r--r-- | lua/plugins/feline.lua | 726 |
1 files changed, 726 insertions, 0 deletions
diff --git a/lua/plugins/feline.lua b/lua/plugins/feline.lua new file mode 100644 index 0000000..f259108 --- /dev/null +++ b/lua/plugins/feline.lua @@ -0,0 +1,726 @@ +require('feline').setup() +--local lsp = require("feline.providers.lsp") +--local vi_mode_utils = require("feline.providers.vi_mode") +--local navic = require("nvim-navic") +-- +--local force_inactive = { +-- filetypes = {}, +-- buftypes = {}, +-- bufnames = {}, +--} +-- +--local winbar_components = { +-- active = { {}, {}, {} }, +-- inactive = { {}, {}, {} }, +--} +-- +--local components = { +-- active = { {}, {}, {} }, +-- inactive = { {}, {}, {} }, +--} +-- +--local colors = { +-- bg = "#282828", +-- black = "#282828", +-- yellow = "#d8a657", +-- cyan = "#89b482", +-- oceanblue = "#45707a", +-- green = "#a9b665", +-- orange = "#e78a4e", +-- violet = "#d3869b", +-- magenta = "#c14a4a", +-- white = "#a89984", +-- fg = "#a89984", +-- skyblue = "#7daea3", +-- red = "#ea6962", +--} +-- +--local vi_mode_colors = { +-- NORMAL = "green", +-- OP = "green", +-- INSERT = "red", +-- CONFIRM = "red", +-- VISUAL = "skyblue", +-- LINES = "skyblue", +-- BLOCK = "skyblue", +-- REPLACE = "violet", +-- ["V-REPLACE"] = "violet", +-- ENTER = "cyan", +-- MORE = "cyan", +-- SELECT = "orange", +-- COMMAND = "green", +-- SHELL = "green", +-- TERM = "green", +-- NONE = "yellow", +--} +-- +--local vi_mode_text = { +-- NORMAL = "<|", +-- OP = "<|", +-- INSERT = "|>", +-- VISUAL = "<>", +-- LINES = "<>", +-- BLOCK = "<>", +-- REPLACE = "<>", +-- ["V-REPLACE"] = "<>", +-- ENTER = "<>", +-- MORE = "<>", +-- SELECT = "<>", +-- COMMAND = "<|", +-- SHELL = "<|", +-- TERM = "<|", +-- NONE = "<>", +-- CONFIRM = "|>", +--} +-- +--local buffer_not_empty = function() +-- if vim.fn.empty(vim.fn.expand("%:t")) ~= 1 then +-- return true +-- end +-- return false +--end +-- +--local checkwidth = function() +-- local squeeze_width = vim.fn.winwidth(0) / 2 +-- if squeeze_width > 40 then +-- return true +-- end +-- return false +--end +-- +--force_inactive.filetypes = { +-- "NvimTree", +-- "dbui", +-- "packer", +-- "startify", +-- "fugitive", +-- "fugitiveblame", +--} +-- +--force_inactive.buftypes = { +-- "terminal", +--} +-- +---- STATUSLINE +---- LEFT +-- +---- vi-mode +--components.active[1][1] = { +-- provider = " NV-IDE ", +-- hl = function() +-- local val = {} +-- +-- val.bg = vi_mode_utils.get_mode_color() +-- val.fg = "black" +-- val.style = "bold" +-- +-- return val +-- end, +-- right_sep = " ", +--} +---- vi-symbol +--components.active[1][2] = { +-- provider = function() +-- return vi_mode_text[vi_mode_utils.get_vim_mode()] +-- end, +-- hl = function() +-- local val = {} +-- val.fg = vi_mode_utils.get_mode_color() +-- val.bg = "bg" +-- val.style = "bold" +-- return val +-- end, +-- right_sep = " ", +--} +---- filename +--components.active[1][3] = { +-- provider = function() +-- return vim.fn.expand("%:F") +-- end, +-- hl = { +-- fg = "white", +-- bg = "bg", +-- style = "bold", +-- }, +--} +---- MID +-- +---- gitBranch +--components.active[2][1] = { +-- provider = "git_branch", +-- hl = { +-- fg = "yellow", +-- bg = "bg", +-- style = "bold", +-- }, +--} +---- diffAdd +--components.active[2][2] = { +-- provider = "git_diff_added", +-- hl = { +-- fg = "green", +-- bg = "bg", +-- style = "bold", +-- }, +--} +---- diffModfified +--components.active[2][3] = { +-- provider = "git_diff_changed", +-- hl = { +-- fg = "orange", +-- bg = "bg", +-- style = "bold", +-- }, +--} +---- diffRemove +--components.active[2][4] = { +-- provider = "git_diff_removed", +-- hl = { +-- fg = "red", +-- bg = "bg", +-- style = "bold", +-- }, +--} +-- +---- RIGHT +-- +---- fileIcon +--components.active[3][1] = { +-- provider = function() +-- local filename = vim.fn.expand("%:t") +-- local extension = vim.fn.expand("%:e") +-- local icon = require("nvim-web-devicons").get_icon(filename, extension) +-- if icon == nil then +-- icon = "" +-- end +-- return icon +-- end, +-- hl = function() +-- local val = {} +-- local filename = vim.fn.expand("%:t") +-- local extension = vim.fn.expand("%:e") +-- local icon, name = require("nvim-web-devicons").get_icon(filename, extension) +-- if icon ~= nil then +-- val.fg = vim.fn.synIDattr(vim.fn.hlID(name), "fg") +-- else +-- val.fg = "white" +-- end +-- val.bg = "bg" +-- val.style = "bold" +-- return val +-- end, +-- right_sep = " ", +--} +---- fileType +--components.active[3][2] = { +-- provider = "file_type", +-- hl = function() +-- local val = {} +-- local filename = vim.fn.expand("%:t") +-- local extension = vim.fn.expand("%:e") +-- local icon, name = require("nvim-web-devicons").get_icon(filename, extension) +-- if icon ~= nil then +-- val.fg = vim.fn.synIDattr(vim.fn.hlID(name), "fg") +-- else +-- val.fg = "white" +-- end +-- val.bg = "bg" +-- val.style = "bold" +-- return val +-- end, +-- right_sep = " ", +--} +---- fileSize +--components.active[3][3] = { +-- provider = "file_size", +-- enabled = function() +-- return vim.fn.getfsize(vim.fn.expand("%:t")) > 0 +-- end, +-- hl = { +-- fg = "skyblue", +-- bg = "bg", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +---- fileFormat +--components.active[3][4] = { +-- provider = function() +-- return "" .. vim.bo.fileformat:upper() .. "" +-- end, +-- hl = { +-- fg = "white", +-- bg = "bg", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +---- fileEncode +--components.active[3][5] = { +-- provider = "file_encoding", +-- hl = { +-- fg = "white", +-- bg = "bg", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +--components.active[3][6] = { +-- provider = "position", +-- hl = { +-- fg = "white", +-- bg = "bg", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +---- linePercent +--components.active[3][7] = { +-- provider = "line_percentage", +-- hl = { +-- fg = "white", +-- bg = "bg", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +---- scrollBar +--components.active[3][8] = { +-- provider = "scroll_bar", +-- hl = { +-- fg = "yellow", +-- bg = "bg", +-- }, +--} +-- +---- INACTIVE +-- +---- fileType +--components.inactive[1][1] = { +-- provider = "file_type", +-- hl = { +-- fg = "black", +-- bg = "cyan", +-- style = "bold", +-- }, +-- left_sep = { +-- str = " ", +-- hl = { +-- fg = "NONE", +-- bg = "cyan", +-- }, +-- }, +-- right_sep = { +-- { +-- str = " ", +-- hl = { +-- fg = "NONE", +-- bg = "cyan", +-- }, +-- }, +-- " ", +-- }, +--} +-- +---- WINBAR +---- LEFT +-- +---- nvimGps +--winbar_components.active[1][1] = { +-- provider = function() +-- return navic.get_location() +-- end, +-- enabled = function() +-- return navic.is_available() +-- end, +-- hl = { +-- fg = "orange", +-- style = "bold", +-- }, +--} +-- +---- MID +-- +---- RIGHT +-- +---- LspName +--winbar_components.active[3][1] = { +-- provider = "lsp_client_names", +-- hl = { +-- fg = "yellow", +-- style = "bold", +-- }, +-- right_sep = " ", +--} +---- diagnosticErrors +--winbar_components.active[3][2] = { +-- provider = "diagnostic_errors", +-- enabled = function() +-- return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) +-- end, +-- hl = { +-- fg = "red", +-- style = "bold", +-- }, +--} +---- diagnosticWarn +--winbar_components.active[3][3] = { +-- provider = "diagnostic_warnings", +-- enabled = function() +-- return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) +-- end, +-- hl = { +-- fg = "yellow", +-- style = "bold", +-- }, +--} +---- diagnosticHint +--winbar_components.active[3][4] = { +-- provider = "diagnostic_hints", +-- enabled = function() +-- return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) +-- end, +-- hl = { +-- fg = "cyan", +-- style = "bold", +-- }, +--} +---- diagnosticInfo +--winbar_components.active[3][5] = { +-- provider = "diagnostic_info", +-- enabled = function() +-- return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) +-- end, +-- hl = { +-- fg = "skyblue", +-- style = "bold", +-- }, +--} +-- +---- INACTIVE +-- +---- fileType +--winbar_components.inactive[1][1] = { +-- provider = "file_type", +-- hl = { +-- fg = "black", +-- bg = "cyan", +-- style = "bold", +-- }, +-- left_sep = { +-- str = " ", +-- hl = { +-- fg = "NONE", +-- bg = "cyan", +-- }, +-- }, +-- right_sep = { +-- { +-- str = " ", +-- hl = { +-- fg = "NONE", +-- bg = "cyan", +-- }, +-- }, +-- " ", +-- }, +--} +-- +--require("feline").setup({ +-- theme = colors, +-- default_bg = bg, +-- default_fg = fg, +-- vi_mode_colors = vi_mode_colors, +-- components = components, +-- force_inactive = force_inactive, +--}) +-- +--require("feline").winbar.setup({ +-- components = winbar_components, +-- force_inactive = force_inactive, +--}) +----local M = { vi = {} } +---- +---- +----M.vi.text = { +---- n = "NORMAL", +---- no = "NORMAL", +---- i = "INSERT", +---- v = "VISUAL", +---- V = "V-LINE", +---- [""] = "V-BLOCK", +---- c = "COMMAND", +---- cv = "COMMAND", +---- ce = "COMMAND", +---- R = "REPLACE", +---- Rv = "REPLACE", +---- s = "SELECT", +---- S = "SELECT", +---- [""] = "SELECT", +---- t = "TERMINAL", +----} +---- +----M.vi.colors = { +---- n = "FlnViCyan", +---- no = "FlnViCyan", +---- i = "FlnStatus", +---- v = "FlnViMagenta", +---- V = "FlnViMagenta", +---- [""] = "FlnViMagenta", +---- R = "FlnViRed", +---- Rv = "FlnViRed", +---- r = "FlnViBlue", +---- rm = "FlnViBlue", +---- s = "FlnViMagenta", +---- S = "FlnViMagenta", +---- [""] = "FelnMagenta", +---- c = "FlnViYellow", +---- ["!"] = "FlnViBlue", +---- t = "FlnViBlue", +----} +---- +----M.vi.sep = { +---- n = "FlnCyan", +---- no = "FlnCyan", +---- i = "FlnStatusBg", +---- v = "FlnMagenta", +---- V = "FlnMagenta", +---- [""] = "FlnMagenta", +---- R = "FlnRed", +---- Rv = "FlnRed", +---- r = "FlnBlue", +---- rm = "FlnBlue", +---- s = "FlnMagenta", +---- S = "FlnMagenta", +---- [""] = "FelnMagenta", +---- c = "FlnYellow", +---- ["!"] = "FlnBlue", +---- t = "FlnBlue", +----} +---- +----M.icons = { +---- locker = "", -- #f023 +---- page = "☰", -- 2630 +---- line_number = "", -- e0a1 +---- connected = "", -- f817 +---- dos = "", -- e70f +---- unix = "", -- f17c +---- mac = "", -- f179 +---- mathematical_L = "𝑳", +---- vertical_bar = "┃", +---- vertical_bar_thin = "│", +---- left = "", +---- right = "", +---- block = "█", +---- left_filled = "", +---- right_filled = "", +---- slant_left = "", +---- slant_left_thin = "", +---- slant_right = "", +---- slant_right_thin = "", +---- slant_left_2 = "", +---- slant_left_2_thin = "", +---- slant_right_2 = "", +---- slant_right_2_thin = "", +---- left_rounded = "", +---- left_rounded_thin = "", +---- right_rounded = "", +---- right_rounded_thin = "", +---- circle = "●", +----} +---- +----return M +------ Feline statusline definition. +------ +------ Note: This statusline does not define any colors. Instead the statusline is +------ built on custom highlight groups that I define. The colors for these +------ highlight groups are pulled from the current colorscheme applied. Check the +------ file: `lua/eden/modules/ui/colors.lua` to see how they are defined. +---- +----local u = require("eden.modules.ui.feline.util") +----local fmt = string.format +---- +------ "┃", "█", "", "", "", "", "", "", "●" +---- +----local get_diag = function(str) +---- local count = vim.lsp.diagnostic.get_count(0, str) +---- return (count > 0) and " " .. count .. " " or "" +----end +---- +----local function vi_mode_hl() +---- return u.vi.colors[vim.fn.mode()] or "FlnViBlack" +----end +---- +----local function vi_sep_hl() +---- return u.vi.sep[vim.fn.mode()] or "FlnBlack" +----end +---- +----local c = { +---- vimode = { +---- provider = function() +---- return string.format(" %s ", u.vi.text[vim.fn.mode()]) +---- end, +---- hl = vi_mode_hl, +---- right_sep = { str = " ", hl = vi_sep_hl }, +---- }, +---- gitbranch = { +---- provider = "git_branch", +---- icon = " ", +---- hl = "FlnGitBranch", +---- right_sep = { str = " ", hl = "FlnGitBranch" }, +---- enabled = function() +---- return vim.b.gitsigns_status_dict ~= nil +---- end, +---- }, +---- file_type = { +---- provider = function() +---- return fmt(" %s ", vim.bo.filetype:upper()) +---- end, +---- hl = "FlnAlt", +---- }, +---- fileinfo = { +---- provider = { name = "file_info", opts = { type = "relative" } }, +---- hl = "FlnAlt", +---- left_sep = { str = " ", hl = "FlnAltSep" }, +---- right_sep = { str = "", hl = "FlnAltSep" }, +---- }, +---- file_enc = { +---- provider = function() +---- local os = u.icons[vim.bo.fileformat] or "" +---- return fmt(" %s %s ", os, vim.bo.fileencoding) +---- end, +---- hl = "StatusLine", +---- left_sep = { str = u.icons.left_filled, hl = "FlnAltSep" }, +---- }, +---- cur_position = { +---- provider = function() +---- -- TODO: What about 4+ diget line numbers? +---- return fmt(" %3d:%-2d ", unpack(vim.api.nvim_win_get_cursor(0))) +---- end, +---- hl = vi_mode_hl, +---- left_sep = { str = u.icons.left_filled, hl = vi_sep_hl }, +---- }, +---- cur_percent = { +---- provider = function() +---- return " " .. require("feline.providers.cursor").line_percentage() .. " " +---- end, +---- hl = vi_mode_hl, +---- left_sep = { str = u.icons.left, hl = vi_mode_hl }, +---- }, +---- default = { -- needed to pass the parent StatusLine hl group to right hand side +---- provider = "", +---- hl = "StatusLine", +---- }, +---- lsp_status = { +---- provider = function() +---- return require("lsp-status").status() +---- end, +---- hl = "FlnStatus", +---- left_sep = { str = "", hl = "FlnStatusBg", always_visible = true }, +---- right_sep = { str = "", hl = "FlnErrorStatus", always_visible = true }, +---- }, +---- lsp_error = { +---- provider = function() +---- return get_diag("Error") +---- end, +---- hl = "FlnError", +---- right_sep = { str = "", hl = "FlnWarnError", always_visible = true }, +---- }, +---- lsp_warn = { +---- provider = function() +---- return get_diag("Warning") +---- end, +---- hl = "FlnWarn", +---- right_sep = { str = "", hl = "FlnInfoWarn", always_visible = true }, +---- }, +---- lsp_info = { +---- provider = function() +---- return get_diag("Information") +---- end, +---- hl = "FlnInfo", +---- right_sep = { str = "", hl = "FlnHintInfo", always_visible = true }, +---- }, +---- lsp_hint = { +---- provider = function() +---- return get_diag("Hint") +---- end, +---- hl = "FlnHint", +---- right_sep = { str = "", hl = "FlnBgHint", always_visible = true }, +---- }, +---- +---- in_fileinfo = { +---- provider = "file_info", +---- hl = "StatusLine", +---- }, +---- in_position = { +---- provider = "position", +---- hl = "StatusLine", +---- }, +----} +---- +----local active = { +---- { -- left +---- c.vimode, +---- c.gitbranch, +---- c.fileinfo, +---- c.default, -- must be last +---- }, +---- { -- right +---- c.lsp_status, +---- c.lsp_error, +---- c.lsp_warn, +---- c.lsp_info, +---- c.lsp_hint, +---- c.file_type, +---- c.file_enc, +---- c.cur_position, +---- c.cur_percent, +---- }, +----} +---- +----local inactive = { +---- { c.in_fileinfo }, -- left +---- { c.in_position }, -- right +----} +---- +------ -- Define autocmd that generates the highlight groups from the new colorscheme +------ -- Then reset the highlights for feline +------ edn.aug.FelineColorschemeReload = { +------ { +------ { "SessionLoadPost", "ColorScheme" }, +------ function() +------ require("eden.modules.ui.feline.colors").gen_highlights() +------ -- This does not look like it is required. If this is called I see the ^^^^^^ that +------ -- seperates the two sides of the bar. Since the entire config uses highlight groups +------ -- all that is required is to redefine them. +------ -- require("feline").reset_highlights() +------ end, +------ }, +------ } +---- +----require("feline").setup({ +---- components = { active = active, inactive = inactive }, +---- highlight_reset_triggers = {}, +---- force_inactive = { +---- filetypes = { +---- "NvimTree", +---- "packer", +---- "dap-repl", +---- "dapui_scopes", +---- "dapui_stacks", +---- "dapui_watches", +---- "dapui_repl", +---- "LspTrouble", +---- "qf", +---- "help", +---- }, +---- buftypes = { "terminal" }, +---- bufnames = {}, +---- }, +---- disable = { +---- filetypes = { +---- "dashboard", +---- "startify", +---- }, +---- }, +----}) |
