Back to Spacevim

prompt API

docs/api/prompt.md

2.4.01.5 KB
Original Source

Available APIs >> prompt

<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc -->

Intro

This api provides some basic Functions for generating cmdline prompt and handle input.

Example:

lua
local pmt = require('spacevim.api.prompt')
local nt = require('spacevim.api.notify')

pmt._handle_fly = function(str)
  nt.notify(str)
end

pmt.open()

Functions

function namedescription
_handle_fly(string)function to handle input, default is ''
_onclose()exit function, default is ''
_oninputpro()function before _handle_fly, default is ''
_function_keya dict of keys and handle functions

Key bindings

Key BindingsDescriptions
Ctrl-rread from register, need insert register name
Left / Rightmove cursor to left or right
BackSpaceremove last character
Ctrl-wremove the Word before the cursor
Ctrl-uremove the Line before the cursor
Ctrl-kremove the Line after the cursor
Ctrl-a / HomeGo to the beginning of the line
Ctrl-e / EndGo to the end of the line