Skip to content
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

Tutorial for Helix akin to vimtutor #537

Merged
merged 8 commits into from
Aug 13, 2021
Merged

Conversation

Omnikar
Copy link
Contributor

@Omnikar Omnikar commented Jul 31, 2021

Addresses #506.

Most of what I have so far is practically the same as Vimtutor, but it will eventually diverge once I reach multiple Helix-specific topics such as multiple selections. I will need to implement actually opening the tutorial using hx --tutor and/or :tutor from within the editor.

@archseer archseer requested review from cessen and pickfire July 31, 2021 07:53
@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 1, 2021

Should it create a new file with the tutorial in it and then open it in the editor, or just load the tutorial into a buffer without a filename? It seems that in order to do the latter I'd have to create a method on Editor in helix-view/src/editor.rs that creates a new buffer with some specified text, since open requires a file and new_file only creates an empty buffer.

@archseer
Copy link
Member

archseer commented Aug 1, 2021

What if you put the file in the runtime folder? Then you'd be able to load it via runtime_dir() and it wouldn't need embedding in the binary.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 1, 2021

Ah, yeah, I could do that. But my question still stands, as the user shouldn't directly access the file since the tutorial involves editing it. Should the file be copied somewhere or should its contents just be loaded into a buffer without a filename?

@archseer
Copy link
Member

archseer commented Aug 1, 2021

You could copy it into tmp, but setting file permissions to read-only should be enough too. That should already be solved for us in packaged releases since install paths are usually read only.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 1, 2021

I think you might have misread. I'm not worrying about the user editing the file when they're not supposed to, the tutorial actually instructs the user to edit the buffer in order to help with teaching, meaning that the original file definitely shouldn't be opened.

@archseer
Copy link
Member

archseer commented Aug 1, 2021

Yeah, if the file is chmodded to read-only they'll be able to edit it in helix but unable to change any of the changes to disk. That way the original file stays intact.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 1, 2021

Ah, okay.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 1, 2021

But if someone installs from source, they'd have to chmod it as readonly themself. I'd rather leave the file in the runtime folder, but instead of opening it normally, load it into a buffer without linking it to the filename. Vimtutor copies the file and opens the copy in Vim, but I think creating a new file isn't really necessary.

docs/tutor.txt Outdated Show resolved Hide resolved
@cessen
Copy link
Contributor

cessen commented Aug 9, 2021

So far this looks good to me. The text is really clear, and seems like a good introduction to the basics.

@archseer
Copy link
Member

Should we merge this as is? I think it's a good start and we can add more sections in a follow up.

@Omnikar
Copy link
Contributor Author

Omnikar commented Aug 10, 2021

Should we merge this as is? I think it's a good start and we can add more sections in a follow up.

If we decide to do that I'd probably want to add a note at the end that the tutorial is a WIP.

@archseer
Copy link
Member

I'm okay with that, better to have a partial tutorial in the next release than none at all :) (I'm hoping to cut a new release after a few more fixes land)

@pickfire
Copy link
Contributor

If we decide to do that I'd probably want to add a note at the end that the tutorial is a WIP.

We can add a TODO which is better.

@pickfire pickfire marked this pull request as ready for review August 12, 2021 10:19
Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. A good start and could be improved later on, at least selections part should be there later on.

@archseer archseer merged commit 9a39a10 into helix-editor:master Aug 13, 2021
@Omnikar Omnikar deleted the tutor branch August 28, 2021 00:42
@archseer archseer linked an issue Sep 1, 2021 that may be closed by this pull request
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create something akin to vimtutor for Helix
4 participants