diff options
author | Felipe Morales <hel.sheep@gmail.com> | 2017-07-13 19:04:15 -0400 |
---|---|---|
committer | Felipe Morales <hel.sheep@gmail.com> | 2017-07-15 11:01:45 -0400 |
commit | ec67d0706524a23768c8a964a7940a34f057edb8 (patch) | |
tree | 1c37de3092496f3212c07a8dd494a2dc64486fcb /runtime/ftplugin | |
parent | 2dc5b141dab679784b6bde3e15baffa135a56019 (diff) | |
download | rneovim-ec67d0706524a23768c8a964a7940a34f057edb8.tar.gz rneovim-ec67d0706524a23768c8a964a7940a34f057edb8.tar.bz2 rneovim-ec67d0706524a23768c8a964a7940a34f057edb8.zip |
tutor: allow metadata to exist outside of the documents.
this makes 'expect' regions simpler to handle.
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/tutor.vim | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim index 1579753170..4cfde4c2df 100644 --- a/runtime/ftplugin/tutor.vim +++ b/runtime/ftplugin/tutor.vim @@ -28,18 +28,29 @@ setlocal nowrap setlocal statusline=%{toupper(expand('%:t:r'))}\ tutorial%= setlocal statusline+=%{tutor#InfoText()} +" Load metadata if it exists: {{{1 +if filereadable(expand('%').'.json') + call tutor#LoadMetadata() +endif + " Mappings: {{{1 call tutor#SetNormalMappings() -call tutor#SetSampleTextMappings() +if exists('b:tutor_metadata') && b:tutor_metadata['settings']['use_maps'] == 1 + call tutor#SetSampleTextMappings() +endif " Checks: {{{1 sign define tutorok text=✓ texthl=tutorOK sign define tutorbad text=✗ texthl=tutorX -if !exists('g:tutor_debug') || g:tutor_debug == 0 - call tutor#PlaceXMarks() - autocmd! TextChanged <buffer> call tutor#OnTextChanged() - autocmd! TextChangedI <buffer> call tutor#OnTextChanged() +if !exists('g:tutor_debug') || g:tutor_debug == 0 + if !(exists('b:tutor_metadata') && b:tutor_metadata['settings']['check_internal_expects'] == '0') + call tutor#PlaceXMarks() + autocmd! TextChanged,TextChangedI <buffer> call tutor#XmarksOnTextChanged() + else + call tutor#ApplyMarks() + autocmd! TextChanged,TextChangedI <buffer> call tutor#ApplyMarksOnChanged() + endif endif |