2021-04-11 08:20:41 +00:00
|
|
|
|
-- Copyright (c) 2020-2021 hoob3rt
|
|
|
|
|
-- MIT license, see LICENSE for more details.
|
|
|
|
|
local Mode = {}
|
2021-09-03 18:20:34 +00:00
|
|
|
|
-- stylua: ignore
|
2021-04-11 08:20:41 +00:00
|
|
|
|
Mode.map = {
|
|
|
|
|
['n'] = 'NORMAL',
|
|
|
|
|
['no'] = 'O-PENDING',
|
|
|
|
|
['nov'] = 'O-PENDING',
|
|
|
|
|
['noV'] = 'O-PENDING',
|
|
|
|
|
['no'] = 'O-PENDING',
|
|
|
|
|
['niI'] = 'NORMAL',
|
|
|
|
|
['niR'] = 'NORMAL',
|
|
|
|
|
['niV'] = 'NORMAL',
|
|
|
|
|
['v'] = 'VISUAL',
|
|
|
|
|
['V'] = 'V-LINE',
|
|
|
|
|
[''] = 'V-BLOCK',
|
|
|
|
|
['s'] = 'SELECT',
|
|
|
|
|
['S'] = 'S-LINE',
|
|
|
|
|
[''] = 'S-BLOCK',
|
|
|
|
|
['i'] = 'INSERT',
|
|
|
|
|
['ic'] = 'INSERT',
|
|
|
|
|
['ix'] = 'INSERT',
|
|
|
|
|
['R'] = 'REPLACE',
|
|
|
|
|
['Rc'] = 'REPLACE',
|
|
|
|
|
['Rv'] = 'V-REPLACE',
|
|
|
|
|
['Rx'] = 'REPLACE',
|
|
|
|
|
['c'] = 'COMMAND',
|
|
|
|
|
['cv'] = 'EX',
|
|
|
|
|
['ce'] = 'EX',
|
|
|
|
|
['r'] = 'REPLACE',
|
|
|
|
|
['rm'] = 'MORE',
|
|
|
|
|
['r?'] = 'CONFIRM',
|
|
|
|
|
['!'] = 'SHELL',
|
|
|
|
|
['t'] = 'TERMINAL',
|
|
|
|
|
}
|
2021-09-03 18:20:34 +00:00
|
|
|
|
|
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
|