vim: make mode in statusline always same width
This commit is contained in:
parent
4321433d73
commit
a4cbc15d0c
1 changed files with 48 additions and 15 deletions
|
@ -48,6 +48,44 @@ local theme = (function()
|
||||||
}
|
}
|
||||||
end)()
|
end)()
|
||||||
|
|
||||||
|
local MODE_MAP = {
|
||||||
|
['n'] = 'Normal ',
|
||||||
|
['no'] = 'O-Pend ',
|
||||||
|
['nov'] = 'O-Pend ',
|
||||||
|
['noV'] = 'O-Pend ',
|
||||||
|
['no'] = 'O-Pend ',
|
||||||
|
['niI'] = 'Normal ',
|
||||||
|
['niR'] = 'Normal ',
|
||||||
|
['niV'] = 'Normal ',
|
||||||
|
['nt'] = 'Normal ',
|
||||||
|
['v'] = 'Visual ',
|
||||||
|
['vs'] = 'Visual ',
|
||||||
|
['V'] = 'V-Line ',
|
||||||
|
['Vs'] = 'V-Line ',
|
||||||
|
[''] = 'V-Block',
|
||||||
|
['s'] = 'V-Block',
|
||||||
|
['s'] = 'Select ',
|
||||||
|
['S'] = 'S-Line ',
|
||||||
|
[''] = 'S-Block',
|
||||||
|
['i'] = 'Insert ',
|
||||||
|
['ic'] = 'Insert ',
|
||||||
|
['ix'] = 'Insert ',
|
||||||
|
['R'] = 'Replace',
|
||||||
|
['Rc'] = 'Replace',
|
||||||
|
['Rx'] = 'Replace',
|
||||||
|
['Rv'] = 'V-Repl ',
|
||||||
|
['Rvc'] = 'V-Repl ',
|
||||||
|
['Rvx'] = 'V-Repl ',
|
||||||
|
['c'] = 'Command',
|
||||||
|
['cv'] = ' Ex ',
|
||||||
|
['ce'] = ' Ex ',
|
||||||
|
['r'] = 'Replace',
|
||||||
|
['rm'] = ' More ',
|
||||||
|
['r?'] = 'Confirm',
|
||||||
|
['!'] = ' Shell ',
|
||||||
|
['t'] = ' Term ',
|
||||||
|
}
|
||||||
|
|
||||||
local update_status = function(self, is_focused)
|
local update_status = function(self, is_focused)
|
||||||
self.options.colored = is_focused
|
self.options.colored = is_focused
|
||||||
return self.super.update_status(self, is_focused)
|
return self.super.update_status(self, is_focused)
|
||||||
|
@ -59,14 +97,13 @@ diff.update_status = update_status
|
||||||
local filetype = require'lualine.components.filetype':extend()
|
local filetype = require'lualine.components.filetype':extend()
|
||||||
filetype.update_status = update_status
|
filetype.update_status = update_status
|
||||||
|
|
||||||
local path = function()
|
|
||||||
return vim.fn.pathshorten(vim.fn.fnamemodify(vim.fn.expand('%'), ':p'))
|
|
||||||
end
|
|
||||||
|
|
||||||
local parts = {
|
local parts = {
|
||||||
split = function() return '%=' end,
|
split = function() return '%=' end,
|
||||||
|
|
||||||
mode = 'mode',
|
mode = function()
|
||||||
|
local code = vim.api.nvim_get_mode().mode
|
||||||
|
return MODE_MAP[code] or code
|
||||||
|
end,
|
||||||
|
|
||||||
paste = {
|
paste = {
|
||||||
function() return '' end,
|
function() return '' end,
|
||||||
|
@ -76,10 +113,7 @@ local parts = {
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
branch = {
|
branch = { 'branch', icon = '' },
|
||||||
'branch',
|
|
||||||
icon = '',
|
|
||||||
},
|
|
||||||
|
|
||||||
diff = {
|
diff = {
|
||||||
diff,
|
diff,
|
||||||
|
@ -91,14 +125,13 @@ local parts = {
|
||||||
padding = 0,
|
padding = 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
path = path,
|
path = function()
|
||||||
|
return vim.fn.pathshorten(vim.fn.fnamemodify(vim.fn.expand('%'), ':p'))
|
||||||
|
end,
|
||||||
|
|
||||||
filetype = filetype,
|
filetype = filetype,
|
||||||
|
|
||||||
fileformat = {
|
fileformat = { 'fileformat', padding = { left = 0, right = 1 } },
|
||||||
'fileformat',
|
|
||||||
padding = { left = 0, right = 1 },
|
|
||||||
},
|
|
||||||
|
|
||||||
progress = {
|
progress = {
|
||||||
function()
|
function()
|
||||||
|
|
Loading…
Add table
Reference in a new issue