aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/tutor.vim
Commit message (Collapse)AuthorAge
* refactor(tutor): use inline comments instead of json file #39714Nathan Zeng2026-05-13
| | | | | | | | | | Problem: Expected text for interactive marks is in a separate json file from the tutor file. When the tutor file is updated, line numbers (potentially many) have to be updated in the json file. This is a burden for maintenance and automatic testing. Solution: Put the expected text inline in the tutor file, marked with `[[]]`. Parse and remove the comments before opening the tutor file so extmarks can be applied.
* fix(tutor): open a temporary copy instead of original file #38522Matthew Chen2026-03-31
| | | | | | | | | | | | | | | | | | | | | | | Problem: `:Tutor` should open a copy of the tutor file instead of the original. This is because edits modify the original file buffer, and crashes or other misuse could potentially corrupt the original file even if it's WO. Solution: Copy the tutor file to a temp path before opening. Store the original path in `b:tutor_file` so metadata json loading still works. - `tutor#TutorCmd` will now copy the tutor file to a temp path via `tempname()` before opening with `drop`. Store the original path in `b:tutor_file` only after the buffer is created. - `tutor#LoadMetadata` now uses `b:tutor_file` to resolve the JSON path instead of `expand('%')`, which now points to the temp copy buffer - `ftplugin/tutor.vim` does not make the `tutor#LoadMetadata` call anymore. It was guarded by `filereadable(expand('%').'.json')` which fails for the new temp copy path logic . Instead, `tutor#LoadMetadata` is already called directly inside `tutor#TutorCmd` since we are already assumed to enable interactive. Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
* fix(tutor): escape tutor filename #36539Andrey Starodubtsev2025-11-12
| | | | Since NeoVim is installed in `Program Files` directory by default, path to tutor filename must be quoted before passing to `:drop`.
* vim-patch:9.1.1870: :Tutor may not work as expected (#36343)zeertzjq2025-10-27
| | | | | | | | | | | Problem: :Tutor may not work as expected Solution: set buftype=nowrite instead of nofile (Phạm Bình An) closes: vim/vim#18613 https://github.com/vim/vim/commit/9978bb77c68c2afa056b7c1ec0fa9d9648cb1960 Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
* refactor(tutor): reimplement interactive marks as extmark in Luabrianhuster2025-07-18
| | | | | | | | | | | | | | | | | | | Problem: From https://matrix.to/#/!cylwlNXSwagQmZSkzs:matrix.org/$Ofj-TFIsEMbp0O9OhE8xuZSNi-nhRLtZTOgs6JRLNrs?via=matrix.org&via=gitter.im&via=mozilla.org In lesson 2.6, users are asked to remove the second, forth and fifth lines with `dd` command, then they are asked to undo twice to make the text go back to original state. But after that, the mark ✗ appears again, which confuses the user because they think they do something wrong. This is a limitation with the current implementation, which is based on line number only. Solution: Reimplement interactive marks as extmarks in Lua. This also make the feature less fragile, as users can remove, add some arbitrary lines without breaking the interactive marks. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(tutor): cannot find tutors in pack/*/start/* #34689Phạm Bình An2025-06-28
| | | | | | | | Problems: - Unlike in Vim, Neovim does not report pack/*/start/* in the resolved value of 'rtp' (see `:help packages-runtimepath`) - This means that the tutor plugin cannot find the tutors in pack/*/start/* Solution: - Use nvim_list_runtime_paths() instead of &rtp
* vim-patch:9.1.1404: wrong link to Chapter 2 in new-tutorbrianhuster2025-05-23
| | | | | | | | | | | | | | | Problem: wrong link to Chapter 2 in vim-01-beginner.tutor Solution: Fix the link to Chapter 2, add test for links in tutor files (Phạm Bình An) In order to write the test, I exposed the function `s:GlobTutorials` as `tutor#GlobTutorials` and make it also accept a `locale` argument. closes: vim/vim#17356 https://github.com/vim/vim/commit/e8302da74aee55fe8f6496b5b711fed7d92318c5 Co-authored-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
* fix(tutor): l:lang is undefinedbrianhuster2025-05-13
| | | | | | | | | | Problem: The scope `elseif $LC_MESSAGES =~ '\a\a' || $LC_MESSAGES ==# "C"` in function `s:Locale` in file `runtime/autoload/tutor.vim` leaves a case when l:lang is not defined. Solution: Define `l:lang` at function scope instead of `if` scope
* vim-patch:9.1.1384: still some problem with the new tutors filetype pluginbrianhuster2025-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: still some problem with the new tutors filetype plugin Solution: refactor code to enable/disable tutor mode into tutor#EnableInteractive() function, include a test (Phạm Bình An) I find it annoying that Tutor's interactive mode is always on (or debug mode is off) even when I open a tutor file with :edit command. I think it makes more sense to make this "interactive mode": - Always on when it is opened with :Tutor command - Off otherwise For more references, see `:help` feature, it is a much better than :Tutor, since I don't have to run `:let g:help_debug = 1` just to be able to edit and save a help file Therefore, I remove `g:tutor_debug` closes: vim/vim#17299 https://github.com/vim/vim/commit/13bea589a25707c8f9e29b2920410bdcccd79bc5 Co-authored-by: Phạm Bình An <phambinhanctb2004@gmail.com>
* refactor(tutor): cleanupJustin M. Keyes2023-09-26
|
* fix(tutor): Tutor steps don't work on Windows #25251Leonardo Mello2023-09-26
| | | | | | | | | Problem: Some steps in :Tutor don't work on Windows. Solution: Add support for `{unix:...,win:...}` format and transform the Tutor contents depending on the platform. Fix https://github.com/neovim/neovim/issues/24166
* fix(runtime/tutor): don't try to close fold when there is none (#24953)David Moberg2023-08-31
| | | | | | Problem: When double clicking a line starting with a #, the code assumes there is a fold there and tries to close it, resulting in an error if there isn't a fold. Solution: Check foldlevel before performing "zc".
* fix(tutor): failing to get buf name #20933erw72022-11-06
| | | | | | | | | | | | | | | | | | | | Error detected while processing function tutor#TutorCmd[38]..BufReadPost Autocommands for "*": Error executing lua callback: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: Error ex ecuting lua: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: Vim(let):E158: Invalid bu ffer name: . stack traceback: [C]: in function 'nvim_cmd' ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: in function <...llar/neovim/HE AD-cc5b736/share/nvim/runtime/filetype.lua:21> [C]: in function 'nvim_buf_call' ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE AD-cc5b736/share/nvim/runtime/filetype.lua:10> stack traceback: [C]: in function 'nvim_buf_call' ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE AD-cc5b736/share/nvim/runtime/filetype.lua:10> Closes https://github.com/neovim/neovim/issues/20920
* tutor: force one sign per line (#14352)Marco Hinz2021-04-13
| | | | | | | | | | The only thing setting signs in the tutor buffer (buftype=nofile), should be tutor.vim itself. Instead of endlessly piling up new signs per line, just unplace any sign on the line before placing a new one. Closes https://github.com/neovim/neovim/issues/13808 Closes https://github.com/neovim/neovim/pull/13809
* vim-patch:8.1.1089: tutor does not check $LC_MESSAGESJan Edmund Lazo2020-12-12
| | | | | | Problem: Tutor does not check $LC_MESSAGES. Solution: Let $LC_MESSAGES overrule $LANG. (Miklos Vajna, closes vim/vim#4112) https://github.com/vim/vim/commit/b44b7add8ae8e15328b4f68c3caf511bd9aaac8c
* tutor: don't set statusline (#8844)Felipe Morales2018-08-10
| | | | | also, remove unused function tutor#InfoText() fixes #8842
* tutor: don't resize (#7854)Felipe Morales2018-01-15
|
* tutor: reorganizeFelipe Morales2017-07-16
|
* tutor: update syntaxFelipe Morales2017-07-15
| | | | | | | | sampletext regions no longer supported make sure tutorExpect is available don't conceal code region delimiters
* tutor: disable old method for setting "expect" regionsFelipe Morales2017-07-15
| | | | tutor: remove movement mappings
* tutor: allow metadata to exist outside of the documents.Felipe Morales2017-07-15
| | | | this makes 'expect' regions simpler to handle.
* plugin/tutor: Fix locale handlingFelipe Morales2016-01-25
| | | | Fixes issue #4071
* tutor: Fix mistaken option nameFelipe Morales2015-11-28
| | | Closes #3754
* tutor: Update vim-tutor to 0.2.1Felipe Morales2015-11-28
| | | | Also, some tweaks based on input by @fdinoff on gitter.
* tutor: avoid 'wildignore' painJustin M. Keyes2015-08-16
|
* runtime: Include vim-tutor-modeFelipe Morales2015-08-15
vim-tutor-mode provides a mechanism to write and read interactive tutorials in vim. It's aim is to replace the venerable vimtutor with a more modern system. The plugin's development is maintained at https://github.com/fmoralesc /vim-tutor-mode Closes #2351.