mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
tutor: allow metadata to exist outside of the documents.
this makes 'expect' regions simpler to handle.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user