aboutsummaryrefslogtreecommitdiff
path: root/data/core/commands/command.lua
blob: f0b8007738c72cf738bffa7a8a7a7b9083909013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local core = require "core"
local command = require "core.command"
local CommandView = require "core.commandview"

local function has_commandview()
  return core.active_view:is(CommandView)
end


command.add(has_commandview, {
  ["command:submit"] = function()
    core.active_view:submit()
  end,

  ["command:complete"] = function()
    core.active_view:complete()
  end,

  ["command:escape"] = function()
    core.active_view:exit()
  end,

  ["command:select-previous"] = function()
    core.active_view:move_suggestion_idx(1)
  end,

  ["command:select-next"] = function()
    core.active_view:move_suggestion_idx(-1)
  end,
})