Handle undefined mode && fallback to normal mode highlighting (#47)
This commit is contained in:
parent
7460fe5aa2
commit
75a9c5c317
|
@ -13,7 +13,12 @@ local function mode()
|
|||
['t'] = 'TERMINAL',
|
||||
['s'] = 'SELECT',
|
||||
}
|
||||
return mode_map[vim.fn.mode()]
|
||||
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()
|
||||
end
|
||||
|
||||
return mode
|
||||
|
|
|
@ -49,9 +49,9 @@ function M.format_highlight(is_focused, highlight_group)
|
|||
elseif mode == 'V-REPLACE' then
|
||||
highlight_group = highlight_group .. '_replace'
|
||||
elseif mode == 'SELECT' then
|
||||
highlight_group = highlight_group .. '_terminal'
|
||||
highlight_group = highlight_group .. '_visual'
|
||||
else
|
||||
highlight_group = highlight_group .. '_' .. mode:lower()
|
||||
highlight_group = highlight_group .. '_normal'
|
||||
end
|
||||
end
|
||||
highlight_group = highlight_group .. [[#]]
|
||||
|
|
Loading…
Reference in New Issue