Add more examples
parent
26164953b6
commit
f6813a55c1
@ -0,0 +1,19 @@
|
||||
" Create a new layer.
|
||||
let s:layer = {
|
||||
\ 'n': {
|
||||
\ 'gg': {
|
||||
\ 'rhs': 'G',
|
||||
\ 'noremap': v:true,
|
||||
\ },
|
||||
\ 'G': {
|
||||
\ 'rhs': 'gg',
|
||||
\ 'noremap': v:true
|
||||
\ }
|
||||
\ }
|
||||
\}
|
||||
|
||||
" Capture the exit function
|
||||
let s:exitFunc = luaeval("require('libmodal').layer.enter(_A)", s:layer)
|
||||
|
||||
" Call the exit function in 5 seconds.
|
||||
call timer_start(5000, s:exitFunc)
|
@ -0,0 +1,14 @@
|
||||
let s:commandList = ['new', 'close', 'last']
|
||||
|
||||
function! s:fooMode() abort
|
||||
let l:userInput = g:fooModeInput
|
||||
if userInput == 'new'
|
||||
tabnew
|
||||
elseif userInput == 'close'
|
||||
tabclose
|
||||
elseif userInput == 'last'
|
||||
tablast
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call luaeval("require('libmodal').prompt.enter('FOO', 's:fooMode', _A)", s:commandList)
|
@ -0,0 +1,17 @@
|
||||
let s:fooModeRecurse = 1
|
||||
|
||||
function! s:fooMode() abort
|
||||
let l:userInput = nr2char(g:foo{s:fooModeRecurse}ModeInput)
|
||||
|
||||
if l:userInput == 'z'
|
||||
let s:fooModeRecurse += 1
|
||||
call s:enter()
|
||||
let s:fooModeRecurse -= 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:enter() abort
|
||||
call luaeval("require('libmodal').mode.enter('FOO'.._A, 's:fooMode')", s:fooModeRecurse)
|
||||
endfunction
|
||||
|
||||
call s:enter()
|
Loading…
Reference in New Issue