Phạm Bình An | 3704b5b | 2025-05-10 21:20:57 +0200 | [diff] [blame] | 1 | " Tutor filetype plugin |
| 2 | " Language: Tutor (the new tutor plugin) |
| 3 | " Maintainer: This runtime file is looking for a new maintainer. |
| 4 | " Last Change: 2025 May 10 |
| 5 | " Contributors: Phạm Bình An <phambinhanctb2004@gmail.com> |
| 6 | " Original Author: Felipe Morales <hel.sheep@gmail.com> |
| 7 | " Last Change: |
| 8 | " 2025 May 10 set b:undo_ftplugin |
Yegappan Lakshmanan | a54816b | 2024-11-03 10:49:23 +0100 | [diff] [blame] | 9 | |
| 10 | " Base: {{{1 |
| 11 | call tutor#SetupVim() |
| 12 | |
| 13 | " Buffer Settings: {{{1 |
| 14 | setlocal noreadonly |
| 15 | if !exists('g:tutor_debug') || g:tutor_debug == 0 |
| 16 | setlocal buftype=nofile |
| 17 | setlocal concealcursor+=inv |
| 18 | setlocal conceallevel=2 |
| 19 | else |
| 20 | setlocal buftype= |
| 21 | setlocal concealcursor& |
| 22 | setlocal conceallevel=0 |
| 23 | endif |
| 24 | setlocal noundofile |
| 25 | |
| 26 | setlocal keywordprg=:help |
| 27 | setlocal iskeyword=@,-,_ |
| 28 | |
| 29 | " The user will have to enable the folds himself, but we provide the foldexpr |
| 30 | " function. |
| 31 | setlocal foldmethod=manual |
| 32 | setlocal foldexpr=tutor#TutorFolds() |
| 33 | setlocal foldlevel=4 |
| 34 | |
| 35 | " Load metadata if it exists: {{{1 |
| 36 | if filereadable(expand('%').'.json') |
| 37 | call tutor#LoadMetadata() |
| 38 | endif |
| 39 | |
| 40 | " Mappings: {{{1 |
| 41 | |
| 42 | call tutor#SetNormalMappings() |
| 43 | |
| 44 | " Checks: {{{1 |
| 45 | |
| 46 | sign define tutorok text=✓ texthl=tutorOK |
| 47 | sign define tutorbad text=✗ texthl=tutorX |
| 48 | |
| 49 | if !exists('g:tutor_debug') || g:tutor_debug == 0 |
| 50 | call tutor#ApplyMarks() |
| 51 | autocmd! TextChanged,TextChangedI <buffer> call tutor#ApplyMarksOnChanged() |
| 52 | endif |
Phạm Bình An | 3704b5b | 2025-05-10 21:20:57 +0200 | [diff] [blame] | 53 | |
| 54 | let b:undo_ftplugin = 'unlet! g:tutor_debug |' |
| 55 | let b:undo_ftplugin ..= 'setl concealcursor< conceallevel< |' |
| 56 | let b:undo_ftplugin ..= 'setl foldmethod< foldexpr< foldlevel< |' |
| 57 | let b:undo_ftplugin ..= 'setl buftype< undofile< keywordprg< iskeyword< |' |
| 58 | |
| 59 | " vim: fdm=marker |