-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
:h[elp] command and documentation
#997
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
base: master
Are you sure you want to change the base?
Conversation
|
I was thinking we could use markdown since it would be possible to highlight it with a tree-sitter grammar. We could also render it using the markdown components we use for LSP docs. |
* `copy_selection_on_prev_line` * `extend_char_left` * `extend_char_right` * `extend_line_down` * `extend_line_up` * `move_char_left` * `move_char_right` * `move_line_down` * `move_line_up` * `no_op`
Would that allow for, in the examples, showing the selections without making the text wider by adding |
I had an idea to solve this; from Matrix:
"Aforementioned ambiguity" referring to the fact that using brackets to show selections in examples makes no distinction between selection and cursor, and no distinction between primary and non-primary. One issue I can see with this approach is getting the file to somehow let tree-sitter know what to parse as text that should have a selection displayed on it. Delimiting the example selections with invisible characters won't work since Helix just displays them as 1-column spaces. Thoughts? |
* `move_next_word_start` * `move_prev_word_start` * `move_next_word_end`
|
Late to the party but just out of curiosity (and whether it even makes sense): would it be possible to have the docs as a comments for the rust functions and then extract it from there? It would mean that there's only single source of truth that is close to the implementation and it could be easier to keep it up to date. On the other hand, it could get quite messy and maybe harder to write the docs. |
Hm, interesting idea… but I'm not sure how we'd go about extracting the doc comments into runtime files. Does rustdoc provide an API of some sort that can be used to access the doc comments from build code? |
|
Why is it claiming that |
|
OK… I guess I was able to fix it through Github's GUI |
I wanted to do the same for config options and automatically updating the online docs at https://docs.helix-editor.com/configuration.html as a followup to #1119, but couldn't find a way to do it. |
* `find_till_char` * `find_next_char` * `extend_till_char` * `extend_next_char` * `till_prev_char` * `find_prev_char` * `extend_till_prev_char` * `extend_prev_char`
This comment was marked as off-topic.
This comment was marked as off-topic.
Using `:h` with a key that branches into other bindings, such as `g` or `z` would leave the inputted keys as pending, meaning that any following keypresses would register as if the looked-up keys had been typed first.
|
merge conflicts resolved in shaleh/help-command. |
the-mikedavis
left a comment
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 this looks good and I'd like to get it merged in before the next release. I just have a note about a conflict from merging master and a tiny style nit but otherwise looks good
| MappableCommand::Static { name, .. } => Ok((STATIC_HELP_DIR, name)), | ||
| MappableCommand::Typable { name, .. } => { | ||
| Ok((TYPABLE_HELP_DIR, name)) | ||
| } |
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.
| } | |
| } | |
| MappableCommand::Macro { .. } => { | |
| Err(anyhow!("`:help` for macro keybinds is not yet supported.")) | |
| } |
once this is merged with master this match will need a branch for macros
| let path = helix_loader::runtime_file(&path); | ||
| ensure!(path.is_file(), "No help available for '{args_msg}'"); | ||
| let id = editor.open(&path, Action::HorizontalSplit)?; | ||
| editor.document_mut(id).unwrap().set_path(None); |
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.
| editor.document_mut(id).unwrap().set_path(None); | |
| doc_mut!(editor, &id).set_path(None); |
|
After discussing this with @pascalkuthe more I think we should try to use markdown in the initial version even if the display for selections is a little hacky (i.e. We could reuse the syntax we already have for integration tests ( Introducing that special rendering isn't necessary in this PR though. I think the examples that are already present look good and could just be put into regular code fences to make sure they stay monospaced. |
Addresses #668.
Each command will have its documentation as a file at
runtime/help/command_name.txt. I'm going for an example-driven documentation style (though not all commands need/can have examples).Todos
:h <command>wherecommandis a static command will open documentation for the static command.:h :<command>wherecommandis a typable command will open documentation for the typable command.:h <keybind>wherekeybindis bound to a specific command will open documentation for the command. Keybind keys will be parsed like a macro.:h <keybind>wherekeybindbranches to multiple other keybinds — likegorz— will collect the sub-keys, their associated commands, and said commands' descriptions into a list which is opened in a buffer for the user.:h topicswill open a fuzzy picker with non-command-related help topics.Document static commands
Command list
no_opmove_char_leftmove_char_rightmove_line_upmove_line_downextend_char_leftextend_char_rightextend_line_upextend_line_downcopy_selection_on_next_linecopy_selection_on_prev_linemove_next_word_startmove_prev_word_startmove_next_word_endmove_next_long_word_startmove_prev_long_word_startmove_next_long_word_endextend_next_word_startextend_prev_word_startextend_next_word_endextend_next_long_word_startextend_prev_long_word_startextend_next_long_word_endfind_till_charfind_next_charextend_till_charextend_next_chartill_prev_charfind_prev_charextend_till_prev_charextend_prev_charrepeat_last_motionreplaceswitch_caseswitch_to_uppercaseswitch_to_lowercasepage_uppage_downhalf_page_uphalf_page_downselect_allselect_regexsplit_selectionsplit_selection_on_newlinesearchrsearchsearch_nextsearch_prevextend_search_nextextend_search_prevsearch_selectionglobal_searchextend_lineextend_to_line_boundsdelete_selectionchange_selectioncollapse_selectionflip_selectionsinsert_modeappend_modecommand_modefile_pickercode_actionbuffer_pickersymbol_pickerlast_pickerprepend_to_lineappend_to_lineopen_belowopen_abovenormal_modeselect_modeexit_select_modegoto_definitionadd_newline_aboveadd_newline_belowgoto_type_definitiongoto_implementationgoto_file_startgoto_file_endgoto_referencegoto_window_topgoto_window_middlegoto_window_bottomgoto_last_accessed_filegoto_linegoto_last_linegoto_first_diaggoto_last_diaggoto_next_diaggoto_prev_diaggoto_line_startgoto_line_endgoto_next_buffergoto_previous_buffergoto_line_end_newlinegoto_first_nonwhitespaceextend_to_line_startextend_to_line_endextend_to_line_end_newlinesignature_helpinsert_tabinsert_newlinedelete_char_backwarddelete_char_forwarddelete_word_backwardundoredoyankyank_joined_to_clipboardyank_main_selection_to_clipboardyank_joined_to_primary_clipboardyank_main_selection_to_primary_clipboardreplace_with_yankedreplace_selections_with_clipboardreplace_selections_with_primary_clipboardpaste_afterpaste_beforepaste_clipboard_afterpaste_clipboard_beforepaste_primary_clipboard_afterpaste_primary_clipboard_beforeindentunindentformat_selectionsjoin_selectionskeep_selectionskeep_primary_selectionremove_primary_selectioncompletionhovertoggle_commentsrotate_selections_forwardrotate_selections_backwardrotate_selection_contents_forwardrotate_selection_contents_backwardexpand_selectionjump_forwardjump_backwardjump_view_rightjump_view_leftjump_view_upjump_view_downrotate_viewhsplitvsplitwcloseselect_registeralign_view_middlealign_view_topalign_view_centeralign_view_bottomscroll_upscroll_downmatch_bracketssurround_addsurround_replacesurround_deleteselect_textobject_aroundselect_textobject_innershell_pipeshell_pipe_toshell_insert_outputshell_append_outputshell_keep_pipesuspendrename_symbolincrementdecrementrecord_macroreplay_macroDocument typable commands
Command list
:quit:quit!:open:buffer-close:buffer-close!:write:new:format:indent-style:line-ending:earlier:later:write-quit:write-quit!:write-all:write-quit-all:write-quit-all!:quit-all:quit-all!:cquit:cquit!:theme:clipboard-yank:clipboard-yank-join:primary-clipboard-yank:primary-clipboard-yank-join:clipboard-paste-after:clipboard-paste-before:clipboard-paste-replace:primary-clipboard-paste-after:primary-clipboard-paste-before:primary-clipboard-paste-replace:show-clipboard-provider:change-current-directory:show-directory:encoding:reload:tree-sitter-scopes:vsplit:hsplit:tutor:goto:set-option:sort:rsort:help