-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
:h[elp]
command and documentation
#997
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. |
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>
wherecommand
is a static command will open documentation for the static command.:h :<command>
wherecommand
is a typable command will open documentation for the typable command.:h <keybind>
wherekeybind
is bound to a specific command will open documentation for the command. Keybind keys will be parsed like a macro.:h <keybind>
wherekeybind
branches to multiple other keybinds — likeg
orz
— 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 topics
will open a fuzzy picker with non-command-related help topics.Document static commands
Command list
no_op
move_char_left
move_char_right
move_line_up
move_line_down
extend_char_left
extend_char_right
extend_line_up
extend_line_down
copy_selection_on_next_line
copy_selection_on_prev_line
move_next_word_start
move_prev_word_start
move_next_word_end
move_next_long_word_start
move_prev_long_word_start
move_next_long_word_end
extend_next_word_start
extend_prev_word_start
extend_next_word_end
extend_next_long_word_start
extend_prev_long_word_start
extend_next_long_word_end
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
repeat_last_motion
replace
switch_case
switch_to_uppercase
switch_to_lowercase
page_up
page_down
half_page_up
half_page_down
select_all
select_regex
split_selection
split_selection_on_newline
search
rsearch
search_next
search_prev
extend_search_next
extend_search_prev
search_selection
global_search
extend_line
extend_to_line_bounds
delete_selection
change_selection
collapse_selection
flip_selections
insert_mode
append_mode
command_mode
file_picker
code_action
buffer_picker
symbol_picker
last_picker
prepend_to_line
append_to_line
open_below
open_above
normal_mode
select_mode
exit_select_mode
goto_definition
add_newline_above
add_newline_below
goto_type_definition
goto_implementation
goto_file_start
goto_file_end
goto_reference
goto_window_top
goto_window_middle
goto_window_bottom
goto_last_accessed_file
goto_line
goto_last_line
goto_first_diag
goto_last_diag
goto_next_diag
goto_prev_diag
goto_line_start
goto_line_end
goto_next_buffer
goto_previous_buffer
goto_line_end_newline
goto_first_nonwhitespace
extend_to_line_start
extend_to_line_end
extend_to_line_end_newline
signature_help
insert_tab
insert_newline
delete_char_backward
delete_char_forward
delete_word_backward
undo
redo
yank
yank_joined_to_clipboard
yank_main_selection_to_clipboard
yank_joined_to_primary_clipboard
yank_main_selection_to_primary_clipboard
replace_with_yanked
replace_selections_with_clipboard
replace_selections_with_primary_clipboard
paste_after
paste_before
paste_clipboard_after
paste_clipboard_before
paste_primary_clipboard_after
paste_primary_clipboard_before
indent
unindent
format_selections
join_selections
keep_selections
keep_primary_selection
remove_primary_selection
completion
hover
toggle_comments
rotate_selections_forward
rotate_selections_backward
rotate_selection_contents_forward
rotate_selection_contents_backward
expand_selection
jump_forward
jump_backward
jump_view_right
jump_view_left
jump_view_up
jump_view_down
rotate_view
hsplit
vsplit
wclose
select_register
align_view_middle
align_view_top
align_view_center
align_view_bottom
scroll_up
scroll_down
match_brackets
surround_add
surround_replace
surround_delete
select_textobject_around
select_textobject_inner
shell_pipe
shell_pipe_to
shell_insert_output
shell_append_output
shell_keep_pipe
suspend
rename_symbol
increment
decrement
record_macro
replay_macro
Document 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