2021-04-11 08:20:41 +00:00
|
|
|
-- Copyright (c) 2020-2021 hoob3rt
|
|
|
|
-- MIT license, see LICENSE for more details.
|
|
|
|
local Mode = {}
|
2021-10-12 14:04:47 +00:00
|
|
|
|
2021-09-03 18:20:34 +00:00
|
|
|
-- stylua: ignore
|
2021-04-11 08:20:41 +00:00
|
|
|
Mode.map = {
|
2022-04-24 05:29:53 +00:00
|
|
|
['n'] = 'NORMAL',
|
|
|
|
['no'] = 'O-PENDING',
|
|
|
|
['nov'] = 'O-PENDING',
|
|
|
|
['noV'] = 'O-PENDING',
|
|
|
|
['no\x16'] = 'O-PENDING',
|
|
|
|
['niI'] = 'NORMAL',
|
|
|
|
['niR'] = 'NORMAL',
|
|
|
|
['niV'] = 'NORMAL',
|
|
|
|
['nt'] = 'NORMAL',
|
|
|
|
['v'] = 'VISUAL',
|
|
|
|
['vs'] = 'VISUAL',
|
|
|
|
['V'] = 'V-LINE',
|
|
|
|
['Vs'] = 'V-LINE',
|
|
|
|
['\x16'] = 'V-BLOCK',
|
|
|
|
['\x16s'] = 'V-BLOCK',
|
|
|
|
['s'] = 'SELECT',
|
|
|
|
['S'] = 'S-LINE',
|
|
|
|
['\x13'] = 'S-BLOCK',
|
|
|
|
['i'] = 'INSERT',
|
|
|
|
['ic'] = 'INSERT',
|
|
|
|
['ix'] = 'INSERT',
|
|
|
|
['R'] = 'REPLACE',
|
|
|
|
['Rc'] = 'REPLACE',
|
|
|
|
['Rx'] = 'REPLACE',
|
|
|
|
['Rv'] = 'V-REPLACE',
|
|
|
|
['Rvc'] = 'V-REPLACE',
|
|
|
|
['Rvx'] = 'V-REPLACE',
|
|
|
|
['c'] = 'COMMAND',
|
|
|
|
['cv'] = 'EX',
|
|
|
|
['ce'] = 'EX',
|
|
|
|
['r'] = 'REPLACE',
|
|
|
|
['rm'] = 'MORE',
|
|
|
|
['r?'] = 'CONFIRM',
|
|
|
|
['!'] = 'SHELL',
|
|
|
|
['t'] = 'TERMINAL',
|
2021-04-11 08:20:41 +00:00
|
|
|
}
|
2021-09-03 18:20:34 +00:00
|
|
|
|
2021-10-12 14:04:47 +00:00
|
|
|
---@return string current mode name
|
2021-04-11 08:20:41 +00:00
|
|
|
function Mode.get_mode()
|
|
|
|
local mode_code = vim.api.nvim_get_mode().mode
|
2021-09-03 18:28:20 +00:00
|
|
|
if Mode.map[mode_code] == nil then
|
|
|
|
return mode_code
|
|
|
|
end
|
2021-04-11 08:20:41 +00:00
|
|
|
return Mode.map[mode_code]
|
|
|
|
end
|
|
|
|
|
|
|
|
return Mode
|