command.lua 634 B

12345678910111213141516171819202122232425262728293031
  1. local core = require "core"
  2. local command = require "core.command"
  3. local CommandView = require "core.commandview"
  4. local function has_commandview()
  5. return core.active_view:is(CommandView)
  6. end
  7. command.add(has_commandview, {
  8. ["command:submit"] = function()
  9. core.active_view:submit()
  10. end,
  11. ["command:complete"] = function()
  12. core.active_view:complete()
  13. end,
  14. ["command:escape"] = function()
  15. core.active_view:exit()
  16. end,
  17. ["command:select-previous"] = function()
  18. core.active_view:move_suggestion_idx(1)
  19. end,
  20. ["command:select-next"] = function()
  21. core.active_view:move_suggestion_idx(-1)
  22. end,
  23. })