New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Tutorial proposal #1144
base: master
Are you sure you want to change the base?
[WIP] Tutorial proposal #1144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
Thanks very much for this proposal, its a very good starting point.
I think the markdown files should be converted to asciidoc (they probably just need renaming, markdown is usually valid asciidoc) to stay consistent with other documentation pages.
Also, they should be in doc/tutorial instead of rc/tutorial.
And it probably requires a few more advanced pages, introducing multiple selections, s/S
<a-k>/<a-K>
, word based movements...
Edit: just saw that its mostly for design validation, I think the design is sound, and it can be worked on in a branch of the main repo until we deem it ready.
rc/tutorial/en/030-selections.md
Outdated
- `i` inserts before the selection | ||
- `A` moves the selection to the last character of the line and append text | ||
|
||
Some move commands perform selecting moves, i.e. the anchor is fixed and only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think expanding
would be a better word than selecting
for these moves.
rc/tutorial/en/000-introduction.md
Outdated
previous page. | ||
|
||
The tutorial pages are editable and contain instructions to change them. At | ||
any time, you cah restore the pages to their original content with `<<esc>,r`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo (cah instead of can)
rc/tutorial/en/030-selections.md
Outdated
8. When comfortable, go to the next lesson | ||
|
||
...> There all words | ||
...> There are missing words here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not clear to me what edit should be done here.
rc/tutorial/en/meta-help.md
Outdated
2. Give direct feedback to the user (with the help box) | ||
3. Incite the user to create and adapt their own tools | ||
|
||
Thus, the main documentation should remain a single web page : https://github.com/mawww/kakoune/blob/master/README.asciidoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about that, we do have the :doc
command thats expected to replace the README.
I moved tutorial.kak into |
rc/base/tutorial.kak
Outdated
def tutorial -params .. -docstring %{ Run the kakoune tutorial } -allow-override %{ | ||
%sh{ | ||
[ $# -gt 0 ] && tutlang="$1" || tutlang="en" | ||
echo "set global tutorial_dir $(dirname ${kak_opt_tutorial_source})/../../doc/tutorial/$tutlang" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use printf
here for POSIX correctness.
rc/base/tutorial.kak
Outdated
def -hidden tutorial-load -params 0..1 -allow-override %{ | ||
%sh{ | ||
bufname="*${kak_opt_tutorial_lesson}*" | ||
if [ $(echo "${kak_buflist}" | grep "${bufname}") ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
rc/base/tutorial.kak
Outdated
%sh{ | ||
bufname="*${kak_opt_tutorial_lesson}*" | ||
if [ $(echo "${kak_buflist}" | grep "${bufname}") ]; then | ||
echo "buffer ${bufname}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
rc/base/tutorial.kak
Outdated
if [ $(echo "${kak_buflist}" | grep "${bufname}") ]; then | ||
echo "buffer ${bufname}" | ||
else | ||
echo "edit -scratch ${bufname}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
rc/base/tutorial.kak
Outdated
echo "buffer ${bufname}" | ||
else | ||
echo "edit -scratch ${bufname}" | ||
echo "tutorial-reload $@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
rc/base/tutorial.kak
Outdated
if [ "$1" = "-no-nav" ]; then | ||
nav=false | ||
fi | ||
echo "exec -draft -client ${kak_client} \%d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
nav=false | ||
fi | ||
echo "exec -draft -client ${kak_client} \%d" | ||
if $nav ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use [ -n "$nav" ]
here
rc/base/tutorial.kak
Outdated
fi | ||
echo "exec -draft -client ${kak_client} \%d" | ||
if $nav ; then | ||
echo "exec -draft -client ${kak_client} |cat<space>${kak_opt_tutorial_dir}/meta-nav.md<ret>\;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
rc/base/tutorial.kak
Outdated
fi | ||
echo "exec -draft -client ${kak_client} ge|cat<space>${kak_opt_tutorial_dir}/${kak_opt_tutorial_lesson}<ret>\;" | ||
echo "exec -client ${kak_client} gg" | ||
# echo "exec -draft -client ${kak_client} ggO\`<lt>esc<gt>,h\`<space>previous<space>page<esc> Qa<space><esc><esc>35q anext<space>page<space>\`<lt>esc<gt>,l\`<esc> o<esc>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
on the last 3 lines
rc/base/tutorial.kak
Outdated
|
||
def tutorial-prev -allow-override %{ | ||
%sh{ | ||
next=$(ls "${kak_opt_tutorial_dir}" | grep -v "meta-" | grep -B 1 "${kak_opt_tutorial_lesson}" | head -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ls -1
would be safer here I think, and the -B
flag for grep
isn't POSIX.
rc/base/tutorial.kak
Outdated
def tutorial-prev -allow-override %{ | ||
%sh{ | ||
next=$(ls "${kak_opt_tutorial_dir}" | grep -v "meta-" | grep -B 1 "${kak_opt_tutorial_lesson}" | head -1) | ||
echo "set global tutorial_lesson $next" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printf
Why are all the functions declared as overridable? |
@lenormf It's a work in progress, I just have to reload the file to test the functions, I remove the |
I hadn't seen that there's also an |
Yes, I saw that, I didn't fix |
Welcome to cross platform shell script compatibility hell! |
:) awk did the trick (I checked, |
Here's a proposal to address #1122. This adds a
:tutorial
command that opens a tutorial where one can navigate page by page.There's a mechanism to chose the tutorial language, a draft of a few lessons, added as simple .md file.
I show it now to validate the design, not the content (there must be a lot of gramar and syntax oddities as, I'm not a native English speaker).
I think, if the design is validated, we should resolve wether the tutorial must remain in the main kakoune repo or live in its own repository to avoid poluting the issues with ToC choices, wording, translations and such.
Thank you for the feedback.