From ec67d0706524a23768c8a964a7940a34f057edb8 Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Thu, 13 Jul 2017 19:04:15 -0400 Subject: tutor: allow metadata to exist outside of the documents. this makes 'expect' regions simpler to handle. --- runtime/ftplugin/tutor.vim | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'runtime/ftplugin') 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 call tutor#OnTextChanged() - autocmd! TextChangedI 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 call tutor#XmarksOnTextChanged() + else + call tutor#ApplyMarks() + autocmd! TextChanged,TextChangedI call tutor#ApplyMarksOnChanged() + endif endif -- cgit From c235ee3f059d43a6099d7983b68b433abdd7e395 Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Thu, 14 Jul 2016 23:38:47 +0200 Subject: tutor: don't enable folds by default --- runtime/ftplugin/tutor.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/ftplugin') diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim index 4cfde4c2df..660c1afaf5 100644 --- a/runtime/ftplugin/tutor.vim +++ b/runtime/ftplugin/tutor.vim @@ -19,11 +19,11 @@ setlocal noundofile setlocal keywordprg=:help setlocal iskeyword=@,-,_ -setlocal foldmethod=expr +" The user will have to enable the folds himself, but we provide the foldexpr +" function. +setlocal foldmethod=manual setlocal foldexpr=tutor#TutorFolds() -setlocal foldcolumn=1 setlocal foldlevel=4 -setlocal nowrap setlocal statusline=%{toupper(expand('%:t:r'))}\ tutorial%= setlocal statusline+=%{tutor#InfoText()} -- cgit From 8e48d7c19e0a01d17fbda1c21a8fa69c039cec7a Mon Sep 17 00:00:00 2001 From: Felipe Morales Date: Thu, 13 Jul 2017 19:02:53 -0400 Subject: tutor: disable old method for setting "expect" regions tutor: remove movement mappings --- runtime/ftplugin/tutor.vim | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'runtime/ftplugin') diff --git a/runtime/ftplugin/tutor.vim b/runtime/ftplugin/tutor.vim index 660c1afaf5..ec55472b78 100644 --- a/runtime/ftplugin/tutor.vim +++ b/runtime/ftplugin/tutor.vim @@ -36,9 +36,6 @@ endif " Mappings: {{{1 call tutor#SetNormalMappings() -if exists('b:tutor_metadata') && b:tutor_metadata['settings']['use_maps'] == 1 - call tutor#SetSampleTextMappings() -endif " Checks: {{{1 @@ -46,11 +43,6 @@ sign define tutorok text=✓ texthl=tutorOK sign define tutorbad text=✗ texthl=tutorX 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 call tutor#XmarksOnTextChanged() - else - call tutor#ApplyMarks() - autocmd! TextChanged,TextChangedI call tutor#ApplyMarksOnChanged() - endif + call tutor#ApplyMarks() + autocmd! TextChanged,TextChangedI call tutor#ApplyMarksOnChanged() endif -- cgit