datacarpentry / shell-genomics

Introduction to the Command Line for Genomics
https://datacarpentry.org/shell-genomics
Other
64 stars 188 forks source link

Add a Tip for command line navigation as part of "Naviational Shortcuts" in episode 2 #334

Open jlchang opened 1 year ago

jlchang commented 1 year ago

Proposing in an issue in case the maintainers feel episode 2 has too many concepts to add another... If there's room, I'd suggest adding a Tip section to Naviational Shortcuts that, similar to the Ctrl+L shortcut for clear introduced in episode 1, shows how to quickly move to the beginning or end of a line in the terminal.

Here's what the tip might look like:

Tip

Try hot-key combinations to navigate the command line itself. This allows editing of previously typed commands or effective re-use of your command history. (In most systems, pressing the up arrow will recall the last command you ran in your terminal) The hot-key combination to move your cursor to the beginning of the line is Ctrl+A, while Ctrl+E will take you to the end of the line. {: .callout}

Other tips in this vein include Ctrl+U and Ctrl+K for "delete everything before the cursor" or "after the cursor", respectively.

Happy to contribute as a PR if the maintainers feel it is appropriate to add. In my experience, most people appreciate any hints that will cut down on the number of keystrokes needed to complete a task!

p-j-smith commented 1 year ago

Hi @jlchang thanks for the suggestions! I think these are useful tips to make users aware of. However, the tip about using the up arrow is already mentioned in episode 3, and we should probably avoid repeating too much information.

Perhaps the tip about Ctrl+A and Ctrl+E could be added after the section on tab completion in episode 1? Something like:

Tip

You may have typed a long command that you would like to edit before executing. Hot-key combinations can be useful for quickly moving your cursor to the beginning or end of a command for editing.

The hot-key combination Ctrl+A will move your cursor to the beginning of the line is, while Ctrl+E will take you to the end of the line. {: .callout}

Happy to contribute as a PR if the maintainers feel it is appropriate to add. In my experience, most people appreciate any hints that will cut down on the number of keystrokes needed to complete a task!

That would be excellent!

jlchang commented 1 year ago

Thanks for the feedback, @p-j-smith . I'll submit a PR with a new tip for Ctrl+A and Ctrl+E. Thanks for the example. I see how providing some context (with minimal jargon) for the utility of the shortcut will help a new user understand why it might be useful. Do you think it would be useful to include Ctrl+U and Ctrl+K or too much?

p-j-smith commented 1 year ago

I'll submit a PR with a new tip for Ctrl+A and Ctrl+E.

great, thank you

Do you think it would be useful to include Ctrl+U and Ctrl+K or too much?

I think they're useful commands to know but it may be a bit too much information for a short tip?