Adjust documentation

pull/6/head
Iron-E 4 years ago
parent 0c3b58540e
commit 26164953b6
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -14,8 +14,8 @@ See [vim-libmodal][libmodal] and the [docs](./doc) for more information. Alterna
# Requirements
* Neovim 0.4+
* Eventually 0.5 will be required.
* Neovim 0.4+.
* For compatability with `vim-libmodal`, Neovim 0.5+.
* `vim-libmodal` is _not_ installed.
[libmodal]: https://github.com/Iron-E/vim-libmodal

@ -144,11 +144,9 @@ FUNCTIONS *libmodal-usage-functions*
that |getchar()| completes. The user input is received through
`g:{name}ModeInput` (see above).
*Error you cannot pass a function to Lua from Vimscript!
       - If you try to use a |funcref()| for {instruction}, it
       will fail, GUARANTEED. This is because of |E5004|.
       - If you want to use a |funcref()| for {instruction}, you
       must use a |Lua| `function` instead.
*Error you cannot pass a funcref to Lua from Vimscript!
       - If you want to use a |funcref()| for {instruction}, it
       must be the name of the function as a `string`.
Note: Some QoL features are available by default when
specifying a `dict`/`table` value for {instruction} that
@ -249,11 +247,9 @@ FUNCTIONS *libmodal-usage-functions*
every time that |input()| completes. The user input
is received through `g:{name}ModeInput` (see above).
*Error you cannot pass a function to Lua from Vimscript!
       - If you try to use a |funcref()| for {instruction}, it
       will fail, GUARANTEED. This is because of |E5004|.
       - If you want to use a |funcref()| for {instruction}, you
       must use a |Lua| `function` instead.
*Error you cannot pass a funcref to Lua from Vimscript!
       - If you want to use a |funcref()| for {instruction}, it
       must be the name of the function as a `string`.
Note: If you want to create commands with arguments, you will
need to use a `function`.
@ -715,6 +711,17 @@ When submitting an issue, please describe the following:
==============================================================================
8. Changelog *libmodal-changelog*
0.7.0 ~
Additions: ~
* Ability to pass `function`s into |libmodal-mode| from Vimscript.
* Ability to pass `function`s into |libmodal-prompt| from Vimscript.
0.6.2 ~
Fixes: ~
* Remove unused variables
0.6.1 ~
Fixes: ~

@ -0,0 +1,30 @@
let s:inputHistory = []
function! s:clear(indexToCheck) abort
if len(s:inputHistory) > a:indexToCheck
for i in range(len(s:inputHistory))
let s:inputHistory[i] = v:null
endfor
endif
endfunction
function! s:fooMode() abort
let s:inputHistory = add(s:inputHistory, nr2char(g:fooModeInput))
let l:index = 0
if s:inputHistory[0] == 'z'
if get(s:inputHistory, 1, v:null) == 'f'
if get(s:inputHistory, 2, v:null) == 'o'
echom 'It works!'
else
let l:index = 2
endif
else
let l:index = 1
endif
endif
call s:clear(l:index)
endfunction
lua require('libmodal').mode.enter('FOO', 's:fooMode')
Loading…
Cancel
Save