Add comments to examples
parent
8df9f63b9e
commit
5fca6440aa
@ -1,14 +1,18 @@
|
||||
" Recurse counter.
|
||||
let s:barModeRecurse = 0
|
||||
|
||||
" Register 'z' as the map for recursing further (by calling the BarMode function again).
|
||||
let s:barModeCombos = {
|
||||
\ 'z': 'BarModeEnter',
|
||||
\}
|
||||
|
||||
" define the BarMode() function which is called whenever the user presses 'z'
|
||||
function! s:BarMode()
|
||||
let s:barModeRecurse += 1
|
||||
call libmodal#Enter('BAR' . s:barModeRecurse, s:barModeCombos)
|
||||
let s:barModeRecurse -= 1
|
||||
endfunction
|
||||
|
||||
" Call BarMode() initially to begin the demo.
|
||||
command! BarModeEnter call s:BarMode()
|
||||
execute 'BarModeEnter'
|
||||
|
@ -1,7 +1,9 @@
|
||||
" Register key combos for splitting windows and then closing windows
|
||||
let s:barModeCombos = {
|
||||
\ 'zf': 'split',
|
||||
\ 'zfo': 'vsplit',
|
||||
\ 'zfc': 'q'
|
||||
\}
|
||||
|
||||
" Enter the mode using the key combos.
|
||||
call libmodal#Enter('BAR', s:barModeCombos)
|
||||
|
@ -1,14 +1,19 @@
|
||||
-- Imports
|
||||
local libmodal = require('libmodal')
|
||||
|
||||
-- Recurse counter.
|
||||
local fooModeRecurse = 0
|
||||
-- Register 'z' as the map for recursing further (by calling the FooMode function again).
|
||||
local fooModeCombos = {
|
||||
['z'] = 'lua FooMode()'
|
||||
}
|
||||
|
||||
-- define the FooMode() function which is called whenever the user presses 'z'
|
||||
function FooMode()
|
||||
fooModeRecurse = fooModeRecurse + 1
|
||||
libmodal.mode.enter('FOO' .. fooModeRecurse, fooModeCombos)
|
||||
fooModeRecurse = fooModeRecurse - 1
|
||||
end
|
||||
|
||||
-- Call FooMode() initially to begin the demo.
|
||||
FooMode()
|
||||
|
@ -1,8 +1,12 @@
|
||||
-- Imports
|
||||
local libmodal = require('libmodal')
|
||||
|
||||
-- Register key combos for splitting windows and then closing windows
|
||||
local fooModeCombos = {
|
||||
['zf'] = 'split',
|
||||
['zfo'] = 'vsplit',
|
||||
['zfc'] = 'q'
|
||||
}
|
||||
|
||||
-- Enter the mode using the key combos.
|
||||
libmodal.mode.enter('FOO', fooModeCombos)
|
||||
|
@ -1,8 +1,12 @@
|
||||
-- Import
|
||||
local libmodal = require('libmodal')
|
||||
|
||||
-- Define commands through a dictionary.
|
||||
local commands = {
|
||||
['new'] = 'tabnew',
|
||||
['close'] = 'tabclose',
|
||||
['last'] = 'tablast'
|
||||
}
|
||||
|
||||
-- Begin the prompt.
|
||||
libmodal.prompt.enter('FOO', commands)
|
||||
|
Loading…
Reference in New Issue