modify mini statusline to use all-caps mode names.
This commit is contained in:
@@ -85,16 +85,43 @@ MiniDeps.later(function()
|
|||||||
end)
|
end)
|
||||||
-- TODO: show history
|
-- TODO: show history
|
||||||
require('mini.notify').setup() -- has more noticeable / utilitarian / aesthetically pleasing notifications
|
require('mini.notify').setup() -- has more noticeable / utilitarian / aesthetically pleasing notifications
|
||||||
|
|
||||||
|
-- Custom `^V` and `^S` symbols to make this file appropriate for copy-paste
|
||||||
|
-- (otherwise those symbols are not displayed).
|
||||||
|
local CTRL_S = vim.api.nvim_replace_termcodes('<C-S>', true, true, true)
|
||||||
|
local CTRL_V = vim.api.nvim_replace_termcodes('<C-V>', true, true, true)
|
||||||
|
local modes = setmetatable({
|
||||||
|
['n'] = { long = 'NORMAL', short = 'N', hl = 'MiniStatuslineModeNormal' },
|
||||||
|
['v'] = { long = 'VISUAL', short = 'V', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
['V'] = { long = 'V-LINE', short = 'V-L', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
[CTRL_V] = { long = 'V-BLOCK', short = 'V-B', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
['s'] = { long = 'SELECT', short = 'S', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
['S'] = { long = 'S-LINE', short = 'S-L', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
[CTRL_S] = { long = 'S-BLOCK', short = 'S-B', hl = 'MiniStatuslineModeVisual' },
|
||||||
|
['i'] = { long = 'INSERT', short = 'I', hl = 'MiniStatuslineModeInsert' },
|
||||||
|
['R'] = { long = 'REPLACE', short = 'R', hl = 'MiniStatuslineModeReplace' },
|
||||||
|
['c'] = { long = 'COMMAND', short = 'C', hl = 'MiniStatuslineModeCommand' },
|
||||||
|
['r'] = { long = 'PROMPT', short = 'P', hl = 'MiniStatuslineModeOther' },
|
||||||
|
['!'] = { long = 'SHELL', short = 'Sh', hl = 'MiniStatuslineModeOther' },
|
||||||
|
['t'] = { long = 'TERMINAL', short = 'T', hl = 'MiniStatuslineModeOther' },
|
||||||
|
}, {
|
||||||
|
-- By default return 'Unknown' but this shouldn't be needed
|
||||||
|
__index = function()
|
||||||
|
return { long = 'Unknown', short = 'U', hl = '%#MiniStatuslineModeOther#' }
|
||||||
|
end,
|
||||||
|
})
|
||||||
require('mini.statusline').setup({
|
require('mini.statusline').setup({
|
||||||
content = {
|
content = {
|
||||||
active = function()
|
active = function()
|
||||||
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
|
local mode_info = modes[vim.fn.mode()]
|
||||||
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
local mode = MiniStatusline.is_truncated(120) and mode_info.short or mode_info.long
|
||||||
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
|
local mode_hl = mode_info.hl
|
||||||
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
|
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
||||||
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
|
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
|
||||||
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
|
||||||
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
|
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
|
||||||
|
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
||||||
|
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
|
||||||
|
|
||||||
return MiniStatusline.combine_groups({
|
return MiniStatusline.combine_groups({
|
||||||
{ hl = mode_hl, strings = { mode } },
|
{ hl = mode_hl, strings = { mode } },
|
||||||
|
|||||||
Reference in New Issue
Block a user