Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catppuccin mocha #5

Merged
merged 36 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rice statusline
  • Loading branch information
wochap committed Sep 7, 2023
commit 68b34e3298111346e4eaf088a4ddf51cbad7b687
7 changes: 7 additions & 0 deletions lua/custom/highlights/integrations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ local M = {
bg = theme.base_30.statusline_bg,
fg = gitColors.delete,
},
St_gitIcons = {
bold = false,
},
StText = {
fg = theme.base_30.white,
bg = theme.base_30.statusline_bg,
},

-- rainbow-delimiters
rainbow1 = { fg = C.red },
Expand Down
88 changes: 87 additions & 1 deletion lua/custom/plugins/overrides/statusline.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
local M = {}
M.modes = {
["n"] = { "NORMAL", "St_NormalMode" },
["no"] = { "NORMAL (no)", "St_NormalMode" },
["nov"] = { "NORMAL (nov)", "St_NormalMode" },
["noV"] = { "NORMAL (noV)", "St_NormalMode" },
["noCTRL-V"] = { "NORMAL", "St_NormalMode" },
["niI"] = { "NORMAL i", "St_NormalMode" },
["niR"] = { "NORMAL r", "St_NormalMode" },
["niV"] = { "NORMAL v", "St_NormalMode" },
["nt"] = { "NTERMINAL", "St_NTerminalMode" },
["ntT"] = { "NTERMINAL (ntT)", "St_NTerminalMode" },

["v"] = { "VISUAL", "St_VisualMode" },
["vs"] = { "V-CHAR (Ctrl O)", "St_VisualMode" },
["V"] = { "V-LINE", "St_VisualMode" },
["Vs"] = { "V-LINE", "St_VisualMode" },
[""] = { "V-BLOCK", "St_VisualMode" },

["i"] = { "INSERT", "St_InsertMode" },
["ic"] = { "INSERT (completion)", "St_InsertMode" },
["ix"] = { "INSERT completion", "St_InsertMode" },

["t"] = { "TERMINAL", "St_TerminalMode" },

["R"] = { "REPLACE", "St_ReplaceMode" },
["Rc"] = { "REPLACE (Rc)", "St_ReplaceMode" },
["Rx"] = { "REPLACEa (Rx)", "St_ReplaceMode" },
["Rv"] = { "V-REPLACE", "St_ReplaceMode" },
["Rvc"] = { "V-REPLACE (Rvc)", "St_ReplaceMode" },
["Rvx"] = { "V-REPLACE (Rvx)", "St_ReplaceMode" },

["s"] = { "SELECT", "St_SelectMode" },
["S"] = { "S-LINE", "St_SelectMode" },
[""] = { "S-BLOCK", "St_SelectMode" },
["c"] = { "COMMAND", "St_CommandMode" },
["cv"] = { "COMMAND", "St_CommandMode" },
["ce"] = { "COMMAND", "St_CommandMode" },
["r"] = { "PROMPT", "St_ConfirmMode" },
["rm"] = { "MORE", "St_ConfirmMode" },
["r?"] = { "CONFIRM", "St_ConfirmMode" },
["x"] = { "CONFIRM", "St_ConfirmMode" },
["!"] = { "SHELL", "St_TerminalMode" },
}

local function get_relative_path()
local filename_str = vim.fn.expand "%:t"

Expand All @@ -16,7 +61,15 @@ end
return {
overriden_modules = function(modules)
local fn = vim.fn
local sep_r = " "
local sep_r = " "
local sep_l = ""

local function mode()
local m = vim.api.nvim_get_mode().mode
local current_mode = "%#" .. M.modes[m][2] .. "#" .. "  " .. M.modes[m][1] .. " "

return current_mode .. "%#ST_EmptySpace# "
end

local function fileInfo()
local icon = "  "
Expand Down Expand Up @@ -45,6 +98,39 @@ return {
.. sep_r
end

local function git()
if not vim.b.gitsigns_head or vim.b.gitsigns_git_status then
return ""
end

local git_status = vim.b.gitsigns_status_dict

local added = (git_status.added and git_status.added ~= 0) and ("  " .. git_status.added) or ""
local changed = (git_status.changed and git_status.changed ~= 0) and ("  " .. git_status.changed) or ""
local removed = (git_status.removed and git_status.removed ~= 0) and ("  " .. git_status.removed) or ""
local branch_name = " " .. git_status.head

return "%#St_gitIcons#" .. branch_name .. added .. changed .. removed
end

local function cursor_position()
local left_sep = "%#St_pos_sep#" .. sep_l .. "%#St_pos_icon#" .. " "

local current_line = fn.line "."
local total_line = fn.line "$"
local text = math.modf((current_line / total_line) * 100) .. tostring "%%"
text = string.format("%4s", text)

text = (current_line == 1 and "Top") or text
text = (current_line == total_line and "Bot") or text
text = text .. (vim.o.columns > 140 and "%#StText# [%l:%c]" or "")

return left_sep .. "%#St_pos_text#" .. " " .. text .. " "
end

modules[1] = mode()
modules[2] = fileInfo()
modules[3] = git()
modules[10] = cursor_position()
end,
}