diff options
Diffstat (limited to 'runtime/lua/core/modes.lua')
| -rw-r--r-- | runtime/lua/core/modes.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/runtime/lua/core/modes.lua b/runtime/lua/core/modes.lua new file mode 100644 index 0000000..c0cb751 --- /dev/null +++ b/runtime/lua/core/modes.lua @@ -0,0 +1,20 @@ +local M = {} + +function M.set_mode(state, mode_name) + if mode_name ~= "normal" and mode_name ~= "insert" then + return false, "unknown mode: " .. tostring(mode_name) + end + + state.mode = mode_name + return true +end + +function M.is_insert(state) + return state.mode == "insert" +end + +function M.is_normal(state) + return state.mode == "normal" +end + +return M |
