From 155cedc5c839dafcef32310dc53bdc20ec976535 Mon Sep 17 00:00:00 2001 From: Daniel Ebert Date: Thu, 3 Aug 2023 15:24:46 +0200 Subject: [PATCH] Fix broken indentation that causes the indentation tests to fail. For some reason, `cargo fmt` does not change the indentation in these places (maybe it isn't sure about what the correct formatting should be). --- helix-term/src/commands/typed.rs | 1176 +++++++++++++++--------------- helix-term/src/keymap.rs | 28 +- 2 files changed, 602 insertions(+), 602 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 463bce25..1c65fd54 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -2298,594 +2298,594 @@ fn clear_register( } pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ - TypableCommand { - name: "quit", - aliases: &["q"], - doc: "Close the current view.", - fun: quit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "quit!", - aliases: &["q!"], - doc: "Force close the current view, ignoring unsaved changes.", - fun: force_quit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "open", - aliases: &["o"], - doc: "Open a file from disk into the current view.", - fun: open, - signature: CommandSignature::all(completers::filename), - }, - TypableCommand { - name: "buffer-close", - aliases: &["bc", "bclose"], - doc: "Close the current buffer.", - fun: buffer_close, - signature: CommandSignature::all(completers::buffer), - }, - TypableCommand { - name: "buffer-close!", - aliases: &["bc!", "bclose!"], - doc: "Close the current buffer forcefully, ignoring unsaved changes.", - fun: force_buffer_close, - signature: CommandSignature::all(completers::buffer) - }, - TypableCommand { - name: "buffer-close-others", - aliases: &["bco", "bcloseother"], - doc: "Close all buffers but the currently focused one.", - fun: buffer_close_others, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "buffer-close-others!", - aliases: &["bco!", "bcloseother!"], - doc: "Force close all buffers but the currently focused one.", - fun: force_buffer_close_others, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "buffer-close-all", - aliases: &["bca", "bcloseall"], - doc: "Close all buffers without quitting.", - fun: buffer_close_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "buffer-close-all!", - aliases: &["bca!", "bcloseall!"], - doc: "Force close all buffers ignoring unsaved changes without quitting.", - fun: force_buffer_close_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "buffer-next", - aliases: &["bn", "bnext"], - doc: "Goto next buffer.", - fun: buffer_next, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "buffer-previous", - aliases: &["bp", "bprev"], - doc: "Goto previous buffer.", - fun: buffer_previous, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "write", - aliases: &["w"], - doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)", - fun: write, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "write!", - aliases: &["w!"], - doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)", - fun: force_write, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "write-buffer-close", - aliases: &["wbc"], - doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)", - fun: write_buffer_close, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "write-buffer-close!", - aliases: &["wbc!"], - doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)", - fun: force_write_buffer_close, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "new", - aliases: &["n"], - doc: "Create a new scratch buffer.", - fun: new_file, - // TODO: This seems to complete with a filename, but doesn't use that filename to - // set the path of the newly created buffer. - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "format", - aliases: &["fmt"], - doc: "Format the file using the LSP formatter.", - fun: format, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "indent-style", - aliases: &[], - doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)", - fun: set_indent_style, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "line-ending", - aliases: &[], - #[cfg(not(feature = "unicode-lines"))] - doc: "Set the document's default line ending. Options: crlf, lf.", - #[cfg(feature = "unicode-lines")] - doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.", - fun: set_line_ending, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "earlier", - aliases: &["ear"], - doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.", - fun: earlier, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "later", - aliases: &["lat"], - doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.", - fun: later, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "write-quit", - aliases: &["wq", "x"], - doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)", - fun: write_quit, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "write-quit!", - aliases: &["wq!", "x!"], - doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)", - fun: force_write_quit, - signature: CommandSignature::positional(&[completers::filename]), - }, - TypableCommand { - name: "write-all", - aliases: &["wa"], - doc: "Write changes from all buffers to disk.", - fun: write_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "write-all!", - aliases: &["wa!"], - doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.", - fun: force_write_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "write-quit-all", - aliases: &["wqa", "xa"], - doc: "Write changes from all buffers to disk and close all views.", - fun: write_all_quit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "write-quit-all!", - aliases: &["wqa!", "xa!"], - doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).", - fun: force_write_all_quit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "quit-all", - aliases: &["qa"], - doc: "Close all views.", - fun: quit_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "quit-all!", - aliases: &["qa!"], - doc: "Force close all views ignoring unsaved changes.", - fun: force_quit_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "cquit", - aliases: &["cq"], - doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).", - fun: cquit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "cquit!", - aliases: &["cq!"], - doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).", - fun: force_cquit, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "theme", - aliases: &[], - doc: "Change the editor theme (show current theme if no name specified).", - fun: theme, - signature: CommandSignature::positional(&[completers::theme]), - }, - TypableCommand { - name: "yank-join", - aliases: &[], - doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.", - fun: yank_joined, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clipboard-yank", - aliases: &[], - doc: "Yank main selection into system clipboard.", - fun: yank_main_selection_to_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clipboard-yank-join", - aliases: &[], - doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. - fun: yank_joined_to_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "primary-clipboard-yank", - aliases: &[], - doc: "Yank main selection into system primary clipboard.", - fun: yank_main_selection_to_primary_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "primary-clipboard-yank-join", - aliases: &[], - doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. - fun: yank_joined_to_primary_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clipboard-paste-after", - aliases: &[], - doc: "Paste system clipboard after selections.", - fun: paste_clipboard_after, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clipboard-paste-before", - aliases: &[], - doc: "Paste system clipboard before selections.", - fun: paste_clipboard_before, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clipboard-paste-replace", - aliases: &[], - doc: "Replace selections with content of system clipboard.", - fun: replace_selections_with_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "primary-clipboard-paste-after", - aliases: &[], - doc: "Paste primary clipboard after selections.", - fun: paste_primary_clipboard_after, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "primary-clipboard-paste-before", - aliases: &[], - doc: "Paste primary clipboard before selections.", - fun: paste_primary_clipboard_before, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "primary-clipboard-paste-replace", - aliases: &[], - doc: "Replace selections with content of system primary clipboard.", - fun: replace_selections_with_primary_clipboard, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "show-clipboard-provider", - aliases: &[], - doc: "Show clipboard provider name in status bar.", - fun: show_clipboard_provider, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "change-current-directory", - aliases: &["cd"], - doc: "Change the current working directory.", - fun: change_current_directory, - signature: CommandSignature::positional(&[completers::directory]), - }, - TypableCommand { - name: "show-directory", - aliases: &["pwd"], - doc: "Show the current working directory.", - fun: show_current_directory, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "encoding", - aliases: &[], - doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.", - fun: set_encoding, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "character-info", - aliases: &["char"], - doc: "Get info about the character under the primary cursor.", - fun: get_character_info, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "reload", - aliases: &["rl"], - doc: "Discard changes and reload from the source file.", - fun: reload, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "reload-all", - aliases: &["rla"], - doc: "Discard changes and reload all documents from the source files.", - fun: reload_all, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "update", - aliases: &["u"], - doc: "Write changes only if the file has been modified.", - fun: update, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "lsp-workspace-command", - aliases: &[], - doc: "Open workspace command picker", - fun: lsp_workspace_command, - signature: CommandSignature::positional(&[completers::lsp_workspace_command]), - }, - TypableCommand { - name: "lsp-restart", - aliases: &[], - doc: "Restarts the language servers used by the current doc", - fun: lsp_restart, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "lsp-stop", - aliases: &[], - doc: "Stops the language servers that are used by the current doc", - fun: lsp_stop, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "tree-sitter-scopes", - aliases: &[], - doc: "Display tree sitter scopes, primarily for theming and development.", - fun: tree_sitter_scopes, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "debug-start", - aliases: &["dbg"], - doc: "Start a debug session from a given template with given parameters.", - fun: debug_start, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "debug-remote", - aliases: &["dbg-tcp"], - doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.", - fun: debug_remote, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "debug-eval", - aliases: &[], - doc: "Evaluate expression in current debug context.", - fun: debug_eval, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "vsplit", - aliases: &["vs"], - doc: "Open the file in a vertical split.", - fun: vsplit, - signature: CommandSignature::all(completers::filename) - }, - TypableCommand { - name: "vsplit-new", - aliases: &["vnew"], - doc: "Open a scratch buffer in a vertical split.", - fun: vsplit_new, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "hsplit", - aliases: &["hs", "sp"], - doc: "Open the file in a horizontal split.", - fun: hsplit, - signature: CommandSignature::all(completers::filename) - }, - TypableCommand { - name: "hsplit-new", - aliases: &["hnew"], - doc: "Open a scratch buffer in a horizontal split.", - fun: hsplit_new, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "tutor", - aliases: &[], - doc: "Open the tutorial.", - fun: tutor, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "goto", - aliases: &["g"], - doc: "Goto line number.", - fun: goto_line_number, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "set-language", - aliases: &["lang"], - doc: "Set the language of current buffer (show current language if no value specified).", - fun: language, - signature: CommandSignature::positional(&[completers::language]), - }, - TypableCommand { - name: "set-option", - aliases: &["set"], - doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.", - fun: set_option, - // TODO: Add support for completion of the options value(s), when appropriate. - signature: CommandSignature::positional(&[completers::setting]), - }, - TypableCommand { - name: "toggle-option", - aliases: &["toggle"], - doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.", - fun: toggle_option, - signature: CommandSignature::positional(&[completers::setting]), - }, - TypableCommand { - name: "get-option", - aliases: &["get"], - doc: "Get the current value of a config option.", - fun: get_option, - signature: CommandSignature::positional(&[completers::setting]), - }, - TypableCommand { - name: "sort", - aliases: &[], - doc: "Sort ranges in selection.", - fun: sort, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "rsort", - aliases: &[], - doc: "Sort ranges in selection in reverse order.", - fun: sort_reverse, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "reflow", - aliases: &[], - doc: "Hard-wrap the current selection of lines to a given width.", - fun: reflow, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "tree-sitter-subtree", - aliases: &["ts-subtree"], - doc: "Display tree sitter subtree under cursor, primarily for debugging queries.", - fun: tree_sitter_subtree, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "config-reload", - aliases: &[], - doc: "Refresh user config.", - fun: refresh_config, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "config-open", - aliases: &[], - doc: "Open the user config.toml file.", - fun: open_config, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "config-open-workspace", - aliases: &[], - doc: "Open the workspace config.toml file.", - fun: open_workspace_config, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "log-open", - aliases: &[], - doc: "Open the helix log file.", - fun: open_log, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "insert-output", - aliases: &[], - doc: "Run shell command, inserting output before each selection.", - fun: insert_output, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "append-output", - aliases: &[], - doc: "Run shell command, appending output after each selection.", - fun: append_output, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "pipe", - aliases: &[], - doc: "Pipe each selection to the shell command.", - fun: pipe, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "pipe-to", - aliases: &[], - doc: "Pipe each selection to the shell command, ignoring output.", - fun: pipe_to, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "run-shell-command", - aliases: &["sh"], - doc: "Run a shell command", - fun: run_shell_command, - signature: CommandSignature::all(completers::filename) - }, - TypableCommand { - name: "reset-diff-change", - aliases: &["diffget", "diffg"], - doc: "Reset the diff change at the cursor position.", - fun: reset_diff_change, - signature: CommandSignature::none(), - }, - TypableCommand { - name: "clear-register", - aliases: &[], - doc: "Clear given register. If no argument is provided, clear all registers.", - fun: clear_register, - signature: CommandSignature::none(), - }, - ]; + TypableCommand { + name: "quit", + aliases: &["q"], + doc: "Close the current view.", + fun: quit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "quit!", + aliases: &["q!"], + doc: "Force close the current view, ignoring unsaved changes.", + fun: force_quit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "open", + aliases: &["o"], + doc: "Open a file from disk into the current view.", + fun: open, + signature: CommandSignature::all(completers::filename), + }, + TypableCommand { + name: "buffer-close", + aliases: &["bc", "bclose"], + doc: "Close the current buffer.", + fun: buffer_close, + signature: CommandSignature::all(completers::buffer), + }, + TypableCommand { + name: "buffer-close!", + aliases: &["bc!", "bclose!"], + doc: "Close the current buffer forcefully, ignoring unsaved changes.", + fun: force_buffer_close, + signature: CommandSignature::all(completers::buffer) + }, + TypableCommand { + name: "buffer-close-others", + aliases: &["bco", "bcloseother"], + doc: "Close all buffers but the currently focused one.", + fun: buffer_close_others, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "buffer-close-others!", + aliases: &["bco!", "bcloseother!"], + doc: "Force close all buffers but the currently focused one.", + fun: force_buffer_close_others, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "buffer-close-all", + aliases: &["bca", "bcloseall"], + doc: "Close all buffers without quitting.", + fun: buffer_close_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "buffer-close-all!", + aliases: &["bca!", "bcloseall!"], + doc: "Force close all buffers ignoring unsaved changes without quitting.", + fun: force_buffer_close_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "buffer-next", + aliases: &["bn", "bnext"], + doc: "Goto next buffer.", + fun: buffer_next, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "buffer-previous", + aliases: &["bp", "bprev"], + doc: "Goto previous buffer.", + fun: buffer_previous, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "write", + aliases: &["w"], + doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)", + fun: write, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "write!", + aliases: &["w!"], + doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)", + fun: force_write, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "write-buffer-close", + aliases: &["wbc"], + doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)", + fun: write_buffer_close, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "write-buffer-close!", + aliases: &["wbc!"], + doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)", + fun: force_write_buffer_close, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "new", + aliases: &["n"], + doc: "Create a new scratch buffer.", + fun: new_file, + // TODO: This seems to complete with a filename, but doesn't use that filename to + // set the path of the newly created buffer. + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "format", + aliases: &["fmt"], + doc: "Format the file using the LSP formatter.", + fun: format, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "indent-style", + aliases: &[], + doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)", + fun: set_indent_style, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "line-ending", + aliases: &[], + #[cfg(not(feature = "unicode-lines"))] + doc: "Set the document's default line ending. Options: crlf, lf.", + #[cfg(feature = "unicode-lines")] + doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.", + fun: set_line_ending, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "earlier", + aliases: &["ear"], + doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.", + fun: earlier, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "later", + aliases: &["lat"], + doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.", + fun: later, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "write-quit", + aliases: &["wq", "x"], + doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)", + fun: write_quit, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "write-quit!", + aliases: &["wq!", "x!"], + doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)", + fun: force_write_quit, + signature: CommandSignature::positional(&[completers::filename]), + }, + TypableCommand { + name: "write-all", + aliases: &["wa"], + doc: "Write changes from all buffers to disk.", + fun: write_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "write-all!", + aliases: &["wa!"], + doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.", + fun: force_write_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "write-quit-all", + aliases: &["wqa", "xa"], + doc: "Write changes from all buffers to disk and close all views.", + fun: write_all_quit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "write-quit-all!", + aliases: &["wqa!", "xa!"], + doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).", + fun: force_write_all_quit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "quit-all", + aliases: &["qa"], + doc: "Close all views.", + fun: quit_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "quit-all!", + aliases: &["qa!"], + doc: "Force close all views ignoring unsaved changes.", + fun: force_quit_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "cquit", + aliases: &["cq"], + doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).", + fun: cquit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "cquit!", + aliases: &["cq!"], + doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).", + fun: force_cquit, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "theme", + aliases: &[], + doc: "Change the editor theme (show current theme if no name specified).", + fun: theme, + signature: CommandSignature::positional(&[completers::theme]), + }, + TypableCommand { + name: "yank-join", + aliases: &[], + doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.", + fun: yank_joined, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clipboard-yank", + aliases: &[], + doc: "Yank main selection into system clipboard.", + fun: yank_main_selection_to_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clipboard-yank-join", + aliases: &[], + doc: "Yank joined selections into system clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. + fun: yank_joined_to_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "primary-clipboard-yank", + aliases: &[], + doc: "Yank main selection into system primary clipboard.", + fun: yank_main_selection_to_primary_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "primary-clipboard-yank-join", + aliases: &[], + doc: "Yank joined selections into system primary clipboard. A separator can be provided as first argument. Default value is newline.", // FIXME: current UI can't display long doc. + fun: yank_joined_to_primary_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clipboard-paste-after", + aliases: &[], + doc: "Paste system clipboard after selections.", + fun: paste_clipboard_after, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clipboard-paste-before", + aliases: &[], + doc: "Paste system clipboard before selections.", + fun: paste_clipboard_before, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clipboard-paste-replace", + aliases: &[], + doc: "Replace selections with content of system clipboard.", + fun: replace_selections_with_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "primary-clipboard-paste-after", + aliases: &[], + doc: "Paste primary clipboard after selections.", + fun: paste_primary_clipboard_after, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "primary-clipboard-paste-before", + aliases: &[], + doc: "Paste primary clipboard before selections.", + fun: paste_primary_clipboard_before, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "primary-clipboard-paste-replace", + aliases: &[], + doc: "Replace selections with content of system primary clipboard.", + fun: replace_selections_with_primary_clipboard, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "show-clipboard-provider", + aliases: &[], + doc: "Show clipboard provider name in status bar.", + fun: show_clipboard_provider, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "change-current-directory", + aliases: &["cd"], + doc: "Change the current working directory.", + fun: change_current_directory, + signature: CommandSignature::positional(&[completers::directory]), + }, + TypableCommand { + name: "show-directory", + aliases: &["pwd"], + doc: "Show the current working directory.", + fun: show_current_directory, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "encoding", + aliases: &[], + doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.", + fun: set_encoding, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "character-info", + aliases: &["char"], + doc: "Get info about the character under the primary cursor.", + fun: get_character_info, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "reload", + aliases: &["rl"], + doc: "Discard changes and reload from the source file.", + fun: reload, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "reload-all", + aliases: &["rla"], + doc: "Discard changes and reload all documents from the source files.", + fun: reload_all, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "update", + aliases: &["u"], + doc: "Write changes only if the file has been modified.", + fun: update, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "lsp-workspace-command", + aliases: &[], + doc: "Open workspace command picker", + fun: lsp_workspace_command, + signature: CommandSignature::positional(&[completers::lsp_workspace_command]), + }, + TypableCommand { + name: "lsp-restart", + aliases: &[], + doc: "Restarts the language servers used by the current doc", + fun: lsp_restart, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "lsp-stop", + aliases: &[], + doc: "Stops the language servers that are used by the current doc", + fun: lsp_stop, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "tree-sitter-scopes", + aliases: &[], + doc: "Display tree sitter scopes, primarily for theming and development.", + fun: tree_sitter_scopes, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "debug-start", + aliases: &["dbg"], + doc: "Start a debug session from a given template with given parameters.", + fun: debug_start, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "debug-remote", + aliases: &["dbg-tcp"], + doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.", + fun: debug_remote, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "debug-eval", + aliases: &[], + doc: "Evaluate expression in current debug context.", + fun: debug_eval, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "vsplit", + aliases: &["vs"], + doc: "Open the file in a vertical split.", + fun: vsplit, + signature: CommandSignature::all(completers::filename) + }, + TypableCommand { + name: "vsplit-new", + aliases: &["vnew"], + doc: "Open a scratch buffer in a vertical split.", + fun: vsplit_new, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "hsplit", + aliases: &["hs", "sp"], + doc: "Open the file in a horizontal split.", + fun: hsplit, + signature: CommandSignature::all(completers::filename) + }, + TypableCommand { + name: "hsplit-new", + aliases: &["hnew"], + doc: "Open a scratch buffer in a horizontal split.", + fun: hsplit_new, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "tutor", + aliases: &[], + doc: "Open the tutorial.", + fun: tutor, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "goto", + aliases: &["g"], + doc: "Goto line number.", + fun: goto_line_number, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "set-language", + aliases: &["lang"], + doc: "Set the language of current buffer (show current language if no value specified).", + fun: language, + signature: CommandSignature::positional(&[completers::language]), + }, + TypableCommand { + name: "set-option", + aliases: &["set"], + doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.", + fun: set_option, + // TODO: Add support for completion of the options value(s), when appropriate. + signature: CommandSignature::positional(&[completers::setting]), + }, + TypableCommand { + name: "toggle-option", + aliases: &["toggle"], + doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.", + fun: toggle_option, + signature: CommandSignature::positional(&[completers::setting]), + }, + TypableCommand { + name: "get-option", + aliases: &["get"], + doc: "Get the current value of a config option.", + fun: get_option, + signature: CommandSignature::positional(&[completers::setting]), + }, + TypableCommand { + name: "sort", + aliases: &[], + doc: "Sort ranges in selection.", + fun: sort, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "rsort", + aliases: &[], + doc: "Sort ranges in selection in reverse order.", + fun: sort_reverse, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "reflow", + aliases: &[], + doc: "Hard-wrap the current selection of lines to a given width.", + fun: reflow, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "tree-sitter-subtree", + aliases: &["ts-subtree"], + doc: "Display tree sitter subtree under cursor, primarily for debugging queries.", + fun: tree_sitter_subtree, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "config-reload", + aliases: &[], + doc: "Refresh user config.", + fun: refresh_config, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "config-open", + aliases: &[], + doc: "Open the user config.toml file.", + fun: open_config, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "config-open-workspace", + aliases: &[], + doc: "Open the workspace config.toml file.", + fun: open_workspace_config, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "log-open", + aliases: &[], + doc: "Open the helix log file.", + fun: open_log, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "insert-output", + aliases: &[], + doc: "Run shell command, inserting output before each selection.", + fun: insert_output, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "append-output", + aliases: &[], + doc: "Run shell command, appending output after each selection.", + fun: append_output, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "pipe", + aliases: &[], + doc: "Pipe each selection to the shell command.", + fun: pipe, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "pipe-to", + aliases: &[], + doc: "Pipe each selection to the shell command, ignoring output.", + fun: pipe_to, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "run-shell-command", + aliases: &["sh"], + doc: "Run a shell command", + fun: run_shell_command, + signature: CommandSignature::all(completers::filename) + }, + TypableCommand { + name: "reset-diff-change", + aliases: &["diffget", "diffg"], + doc: "Reset the diff change at the cursor position.", + fun: reset_diff_change, + signature: CommandSignature::none(), + }, + TypableCommand { + name: "clear-register", + aliases: &[], + doc: "Clear given register. If no argument is provided, clear all registers.", + fun: clear_register, + signature: CommandSignature::none(), + }, +]; pub static TYPABLE_COMMAND_MAP: Lazy> = Lazy::new(|| { diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 5a72a35a..598be55b 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -401,14 +401,14 @@ mod tests { fn merge_partial_keys() { let keymap = hashmap! { Mode::Normal => keymap!({ "Normal mode" - "i" => normal_mode, - "无" => insert_mode, - "z" => jump_backward, - "g" => { "Merge into goto mode" - "$" => goto_line_end, - "g" => delete_char_forward, - }, - }) + "i" => normal_mode, + "无" => insert_mode, + "z" => jump_backward, + "g" => { "Merge into goto mode" + "$" => goto_line_end, + "g" => delete_char_forward, + }, + }) }; let mut merged_keyamp = default(); merge_keys(&mut merged_keyamp, keymap.clone()); @@ -474,13 +474,13 @@ mod tests { fn order_should_be_set() { let keymap = hashmap! { Mode::Normal => keymap!({ "Normal mode" - "space" => { "" - "s" => { "" - "v" => vsplit, - "c" => hsplit, - }, + "space" => { "" + "s" => { "" + "v" => vsplit, + "c" => hsplit, }, - }) + }, + }) }; let mut merged_keyamp = default(); merge_keys(&mut merged_keyamp, keymap.clone());