blob: 5660cbf649ac28fc42f0f6af6b7387db00d1b075 [file] [log] [blame]
Phạm Bình An3704b5b2025-05-10 21:20:57 +02001" 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 Lakshmanana54816b2024-11-03 10:49:23 +01009
10" Base: {{{1
11call tutor#SetupVim()
12
13" Buffer Settings: {{{1
14setlocal noreadonly
15if !exists('g:tutor_debug') || g:tutor_debug == 0
16 setlocal buftype=nofile
17 setlocal concealcursor+=inv
18 setlocal conceallevel=2
19else
20 setlocal buftype=
21 setlocal concealcursor&
22 setlocal conceallevel=0
23endif
24setlocal noundofile
25
26setlocal keywordprg=:help
27setlocal iskeyword=@,-,_
28
29" The user will have to enable the folds himself, but we provide the foldexpr
30" function.
31setlocal foldmethod=manual
32setlocal foldexpr=tutor#TutorFolds()
33setlocal foldlevel=4
34
35" Load metadata if it exists: {{{1
36if filereadable(expand('%').'.json')
37 call tutor#LoadMetadata()
38endif
39
40" Mappings: {{{1
41
42call tutor#SetNormalMappings()
43
44" Checks: {{{1
45
46sign define tutorok text=✓ texthl=tutorOK
47sign define tutorbad text=✗ texthl=tutorX
48
49if !exists('g:tutor_debug') || g:tutor_debug == 0
50 call tutor#ApplyMarks()
51 autocmd! TextChanged,TextChangedI <buffer> call tutor#ApplyMarksOnChanged()
52endif
Phạm Bình An3704b5b2025-05-10 21:20:57 +020053
54let b:undo_ftplugin = 'unlet! g:tutor_debug |'
55let b:undo_ftplugin ..= 'setl concealcursor< conceallevel< |'
56let b:undo_ftplugin ..= 'setl foldmethod< foldexpr< foldlevel< |'
57let b:undo_ftplugin ..= 'setl buftype< undofile< keywordprg< iskeyword< |'
58
59" vim: fdm=marker