summaryrefslogtreecommitdiff
path: root/runtime/lua/core/modes.lua
blob: c0cb7515568b1e168d45806b479d36ad604a91b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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