summaryrefslogtreecommitdiff
path: root/runtime/lua/core/modes.lua
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-05-11 15:07:55 -0500
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-05-11 15:07:55 -0500
commitcebb280fe546190e55e071b6adbf37cd47950f34 (patch)
tree6e7a7605f8832b1c1bd7e467884a8792a5e1fab4 /runtime/lua/core/modes.lua
initial commit
Diffstat (limited to 'runtime/lua/core/modes.lua')
-rw-r--r--runtime/lua/core/modes.lua20
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