lualine.nvim/lua/lualine/components/mode.lua

29 lines
638 B
Lua
Raw Normal View History

local function mode()
2020-12-30 14:48:51 +00:00
local mode_map = {
['__'] = '------',
['n'] = 'NORMAL',
['i'] = 'INSERT',
2021-01-09 17:27:53 +00:00
['ic'] = 'INSERT',
['ix'] = 'INSERT',
2020-12-30 14:48:51 +00:00
['v'] = 'VISUAL',
['V'] = 'V-LINE',
[''] = 'V-BLOCK',
['R'] = 'REPLACE',
['r'] = 'REPLACE',
2021-01-09 17:27:53 +00:00
['rc'] = 'REPLACE',
['rx'] = 'REPLACE',
2020-12-30 14:48:51 +00:00
['Rv'] = 'V-REPLACE',
['c'] = 'COMMAND',
['t'] = 'TERMINAL',
2021-01-06 13:52:05 +00:00
['s'] = 'SELECT',
2020-12-30 14:48:51 +00:00
}
local function get_mode()
local mode_code = vim.api.nvim_get_mode().mode
if mode_map[mode_code] == nil then return mode_code end
return mode_map[mode_code]
end
return get_mode()
2020-12-30 14:48:51 +00:00
end
return mode