on master help sign in
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).

commit155cedc5c839dafcef32310dc53bdc20ec976535 authorDaniel Ebert <daniel.ebert@protonmail.com> dateThu 3 Aug 2023, 15:24 (3 years ago) parent36a59e4
2 files changed+602−602
helix-term/src/commands/typed.rs+588−588 helix-term/src/keymap.rs+14−14
helix-term/src/commands/typed.rs+588−588
@@ -2298,594 +2298,594 @@ fn clear_register(
22982298}
22992299
23002300pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2301− TypableCommand {
2302− name: "quit",
2303− aliases: &["q"],
2304− doc: "Close the current view.",
2305− fun: quit,
2306− signature: CommandSignature::none(),
2307− },
2308− TypableCommand {
2309− name: "quit!",
2310− aliases: &["q!"],
2311− doc: "Force close the current view, ignoring unsaved changes.",
2312− fun: force_quit,
2313− signature: CommandSignature::none(),
2314− },
2315− TypableCommand {
2316− name: "open",
2317− aliases: &["o"],
2318− doc: "Open a file from disk into the current view.",
2319− fun: open,
2320− signature: CommandSignature::all(completers::filename),
2321− },
2322− TypableCommand {
2323− name: "buffer-close",
2324− aliases: &["bc", "bclose"],
2325− doc: "Close the current buffer.",
2326− fun: buffer_close,
2327− signature: CommandSignature::all(completers::buffer),
2328− },
2329− TypableCommand {
2330− name: "buffer-close!",
2331− aliases: &["bc!", "bclose!"],
2332− doc: "Close the current buffer forcefully, ignoring unsaved changes.",
2333− fun: force_buffer_close,
2334− signature: CommandSignature::all(completers::buffer)
2335− },
2336− TypableCommand {
2337− name: "buffer-close-others",
2338− aliases: &["bco", "bcloseother"],
2339− doc: "Close all buffers but the currently focused one.",
2340− fun: buffer_close_others,
2341− signature: CommandSignature::none(),
2342− },
2343− TypableCommand {
2344− name: "buffer-close-others!",
2345− aliases: &["bco!", "bcloseother!"],
2346− doc: "Force close all buffers but the currently focused one.",
2347− fun: force_buffer_close_others,
2348− signature: CommandSignature::none(),
2349− },
2350− TypableCommand {
2351− name: "buffer-close-all",
2352− aliases: &["bca", "bcloseall"],
2353− doc: "Close all buffers without quitting.",
2354− fun: buffer_close_all,
2355− signature: CommandSignature::none(),
2356− },
2357− TypableCommand {
2358− name: "buffer-close-all!",
2359− aliases: &["bca!", "bcloseall!"],
2360− doc: "Force close all buffers ignoring unsaved changes without quitting.",
2361− fun: force_buffer_close_all,
2362− signature: CommandSignature::none(),
2363− },
2364− TypableCommand {
2365− name: "buffer-next",
2366− aliases: &["bn", "bnext"],
2367− doc: "Goto next buffer.",
2368− fun: buffer_next,
2369− signature: CommandSignature::none(),
2370− },
2371− TypableCommand {
2372− name: "buffer-previous",
2373− aliases: &["bp", "bprev"],
2374− doc: "Goto previous buffer.",
2375− fun: buffer_previous,
2376− signature: CommandSignature::none(),
2377− },
2378− TypableCommand {
2379− name: "write",
2380− aliases: &["w"],
2381− doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2382− fun: write,
2383− signature: CommandSignature::positional(&[completers::filename]),
2384− },
2385− TypableCommand {
2386− name: "write!",
2387− aliases: &["w!"],
2388− doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)",
2389− fun: force_write,
2390− signature: CommandSignature::positional(&[completers::filename]),
2391− },
2392− TypableCommand {
2393− name: "write-buffer-close",
2394− aliases: &["wbc"],
2395− doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)",
2396− fun: write_buffer_close,
2397− signature: CommandSignature::positional(&[completers::filename]),
2398− },
2399− TypableCommand {
2400− name: "write-buffer-close!",
2401− aliases: &["wbc!"],
2402− doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)",
2403− fun: force_write_buffer_close,
2404− signature: CommandSignature::positional(&[completers::filename]),
2405− },
2406− TypableCommand {
2407− name: "new",
2408− aliases: &["n"],
2409− doc: "Create a new scratch buffer.",
2410− fun: new_file,
2411− // TODO: This seems to complete with a filename, but doesn't use that filename to
2412− // set the path of the newly created buffer.
2413− signature: CommandSignature::positional(&[completers::filename]),
2414− },
2415− TypableCommand {
2416− name: "format",
2417− aliases: &["fmt"],
2418− doc: "Format the file using the LSP formatter.",
2419− fun: format,
2420− signature: CommandSignature::none(),
2421− },
2422− TypableCommand {
2423− name: "indent-style",
2424− aliases: &[],
2425− doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
2426− fun: set_indent_style,
2427− signature: CommandSignature::none(),
2428− },
2429− TypableCommand {
2430− name: "line-ending",
2431− aliases: &[],
2432− #[cfg(not(feature = "unicode-lines"))]
2433− doc: "Set the document's default line ending. Options: crlf, lf.",
2434− #[cfg(feature = "unicode-lines")]
2435− doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2436− fun: set_line_ending,
2437− signature: CommandSignature::none(),
2438− },
2439− TypableCommand {
2440− name: "earlier",
2441− aliases: &["ear"],
2442− doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2443− fun: earlier,
2444− signature: CommandSignature::none(),
2445− },
2446− TypableCommand {
2447− name: "later",
2448− aliases: &["lat"],
2449− doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2450− fun: later,
2451− signature: CommandSignature::none(),
2452− },
2453− TypableCommand {
2454− name: "write-quit",
2455− aliases: &["wq", "x"],
2456− doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)",
2457− fun: write_quit,
2458− signature: CommandSignature::positional(&[completers::filename]),
2459− },
2460− TypableCommand {
2461− name: "write-quit!",
2462− aliases: &["wq!", "x!"],
2463− doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2464− fun: force_write_quit,
2465− signature: CommandSignature::positional(&[completers::filename]),
2466− },
2467− TypableCommand {
2468− name: "write-all",
2469− aliases: &["wa"],
2470− doc: "Write changes from all buffers to disk.",
2471− fun: write_all,
2472− signature: CommandSignature::none(),
2473− },
2474− TypableCommand {
2475− name: "write-all!",
2476− aliases: &["wa!"],
2477− doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.",
2478− fun: force_write_all,
2479− signature: CommandSignature::none(),
2480− },
2481− TypableCommand {
2482− name: "write-quit-all",
2483− aliases: &["wqa", "xa"],
2484− doc: "Write changes from all buffers to disk and close all views.",
2485− fun: write_all_quit,
2486− signature: CommandSignature::none(),
2487− },
2488− TypableCommand {
2489− name: "write-quit-all!",
2490− aliases: &["wqa!", "xa!"],
2491− doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).",
2492− fun: force_write_all_quit,
2493− signature: CommandSignature::none(),
2494− },
2495− TypableCommand {
2496− name: "quit-all",
2497− aliases: &["qa"],
2498− doc: "Close all views.",
2499− fun: quit_all,
2500− signature: CommandSignature::none(),
2501− },
2502− TypableCommand {
2503− name: "quit-all!",
2504− aliases: &["qa!"],
2505− doc: "Force close all views ignoring unsaved changes.",
2506− fun: force_quit_all,
2507− signature: CommandSignature::none(),
2508− },
2509− TypableCommand {
2510− name: "cquit",
2511− aliases: &["cq"],
2512− doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2513− fun: cquit,
2514− signature: CommandSignature::none(),
2515− },
2516− TypableCommand {
2517− name: "cquit!",
2518− aliases: &["cq!"],
2519− doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).",
2520− fun: force_cquit,
2521− signature: CommandSignature::none(),
2522− },
2523− TypableCommand {
2524− name: "theme",
2525− aliases: &[],
2526− doc: "Change the editor theme (show current theme if no name specified).",
2527− fun: theme,
2528− signature: CommandSignature::positional(&[completers::theme]),
2529− },
2530− TypableCommand {
2531− name: "yank-join",
2532− aliases: &[],
2533− doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.",
2534− fun: yank_joined,
2535− signature: CommandSignature::none(),
2536− },
2537− TypableCommand {
2538− name: "clipboard-yank",
2539− aliases: &[],
2540− doc: "Yank main selection into system clipboard.",
2541− fun: yank_main_selection_to_clipboard,
2542− signature: CommandSignature::none(),
2543− },
2544− TypableCommand {
2545− name: "clipboard-yank-join",
2546− aliases: &[],
2547− 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.
2548− fun: yank_joined_to_clipboard,
2549− signature: CommandSignature::none(),
2550− },
2551− TypableCommand {
2552− name: "primary-clipboard-yank",
2553− aliases: &[],
2554− doc: "Yank main selection into system primary clipboard.",
2555− fun: yank_main_selection_to_primary_clipboard,
2556− signature: CommandSignature::none(),
2557− },
2558− TypableCommand {
2559− name: "primary-clipboard-yank-join",
2560− aliases: &[],
2561− 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.
2562− fun: yank_joined_to_primary_clipboard,
2563− signature: CommandSignature::none(),
2564− },
2565− TypableCommand {
2566− name: "clipboard-paste-after",
2567− aliases: &[],
2568− doc: "Paste system clipboard after selections.",
2569− fun: paste_clipboard_after,
2570− signature: CommandSignature::none(),
2571− },
2572− TypableCommand {
2573− name: "clipboard-paste-before",
2574− aliases: &[],
2575− doc: "Paste system clipboard before selections.",
2576− fun: paste_clipboard_before,
2577− signature: CommandSignature::none(),
2578− },
2579− TypableCommand {
2580− name: "clipboard-paste-replace",
2581− aliases: &[],
2582− doc: "Replace selections with content of system clipboard.",
2583− fun: replace_selections_with_clipboard,
2584− signature: CommandSignature::none(),
2585− },
2586− TypableCommand {
2587− name: "primary-clipboard-paste-after",
2588− aliases: &[],
2589− doc: "Paste primary clipboard after selections.",
2590− fun: paste_primary_clipboard_after,
2591− signature: CommandSignature::none(),
2592− },
2593− TypableCommand {
2594− name: "primary-clipboard-paste-before",
2595− aliases: &[],
2596− doc: "Paste primary clipboard before selections.",
2597− fun: paste_primary_clipboard_before,
2598− signature: CommandSignature::none(),
2599− },
2600− TypableCommand {
2601− name: "primary-clipboard-paste-replace",
2602− aliases: &[],
2603− doc: "Replace selections with content of system primary clipboard.",
2604− fun: replace_selections_with_primary_clipboard,
2605− signature: CommandSignature::none(),
2606− },
2607− TypableCommand {
2608− name: "show-clipboard-provider",
2609− aliases: &[],
2610− doc: "Show clipboard provider name in status bar.",
2611− fun: show_clipboard_provider,
2612− signature: CommandSignature::none(),
2613− },
2614− TypableCommand {
2615− name: "change-current-directory",
2616− aliases: &["cd"],
2617− doc: "Change the current working directory.",
2618− fun: change_current_directory,
2619− signature: CommandSignature::positional(&[completers::directory]),
2620− },
2621− TypableCommand {
2622− name: "show-directory",
2623− aliases: &["pwd"],
2624− doc: "Show the current working directory.",
2625− fun: show_current_directory,
2626− signature: CommandSignature::none(),
2627− },
2628− TypableCommand {
2629− name: "encoding",
2630− aliases: &[],
2631− doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.",
2632− fun: set_encoding,
2633− signature: CommandSignature::none(),
2634− },
2635− TypableCommand {
2636− name: "character-info",
2637− aliases: &["char"],
2638− doc: "Get info about the character under the primary cursor.",
2639− fun: get_character_info,
2640− signature: CommandSignature::none(),
2641− },
2642− TypableCommand {
2643− name: "reload",
2644− aliases: &["rl"],
2645− doc: "Discard changes and reload from the source file.",
2646− fun: reload,
2647− signature: CommandSignature::none(),
2648− },
2649− TypableCommand {
2650− name: "reload-all",
2651− aliases: &["rla"],
2652− doc: "Discard changes and reload all documents from the source files.",
2653− fun: reload_all,
2654− signature: CommandSignature::none(),
2655− },
2656− TypableCommand {
2657− name: "update",
2658− aliases: &["u"],
2659− doc: "Write changes only if the file has been modified.",
2660− fun: update,
2661− signature: CommandSignature::none(),
2662− },
2663− TypableCommand {
2664− name: "lsp-workspace-command",
2665− aliases: &[],
2666− doc: "Open workspace command picker",
2667− fun: lsp_workspace_command,
2668− signature: CommandSignature::positional(&[completers::lsp_workspace_command]),
2669− },
2670− TypableCommand {
2671− name: "lsp-restart",
2672− aliases: &[],
2673− doc: "Restarts the language servers used by the current doc",
2674− fun: lsp_restart,
2675− signature: CommandSignature::none(),
2676− },
2677− TypableCommand {
2678− name: "lsp-stop",
2679− aliases: &[],
2680− doc: "Stops the language servers that are used by the current doc",
2681− fun: lsp_stop,
2682− signature: CommandSignature::none(),
2683− },
2684− TypableCommand {
2685− name: "tree-sitter-scopes",
2686− aliases: &[],
2687− doc: "Display tree sitter scopes, primarily for theming and development.",
2688− fun: tree_sitter_scopes,
2689− signature: CommandSignature::none(),
2690− },
2691− TypableCommand {
2692− name: "debug-start",
2693− aliases: &["dbg"],
2694− doc: "Start a debug session from a given template with given parameters.",
2695− fun: debug_start,
2696− signature: CommandSignature::none(),
2697− },
2698− TypableCommand {
2699− name: "debug-remote",
2700− aliases: &["dbg-tcp"],
2701− doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2702− fun: debug_remote,
2703− signature: CommandSignature::none(),
2704− },
2705− TypableCommand {
2706− name: "debug-eval",
2707− aliases: &[],
2708− doc: "Evaluate expression in current debug context.",
2709− fun: debug_eval,
2710− signature: CommandSignature::none(),
2711− },
2712− TypableCommand {
2713− name: "vsplit",
2714− aliases: &["vs"],
2715− doc: "Open the file in a vertical split.",
2716− fun: vsplit,
2717− signature: CommandSignature::all(completers::filename)
2718− },
2719− TypableCommand {
2720− name: "vsplit-new",
2721− aliases: &["vnew"],
2722− doc: "Open a scratch buffer in a vertical split.",
2723− fun: vsplit_new,
2724− signature: CommandSignature::none(),
2725− },
2726− TypableCommand {
2727− name: "hsplit",
2728− aliases: &["hs", "sp"],
2729− doc: "Open the file in a horizontal split.",
2730− fun: hsplit,
2731− signature: CommandSignature::all(completers::filename)
2732− },
2733− TypableCommand {
2734− name: "hsplit-new",
2735− aliases: &["hnew"],
2736− doc: "Open a scratch buffer in a horizontal split.",
2737− fun: hsplit_new,
2738− signature: CommandSignature::none(),
2739− },
2740− TypableCommand {
2741− name: "tutor",
2742− aliases: &[],
2743− doc: "Open the tutorial.",
2744− fun: tutor,
2745− signature: CommandSignature::none(),
2746− },
2747− TypableCommand {
2748− name: "goto",
2749− aliases: &["g"],
2750− doc: "Goto line number.",
2751− fun: goto_line_number,
2752− signature: CommandSignature::none(),
2753− },
2754− TypableCommand {
2755− name: "set-language",
2756− aliases: &["lang"],
2757− doc: "Set the language of current buffer (show current language if no value specified).",
2758− fun: language,
2759− signature: CommandSignature::positional(&[completers::language]),
2760− },
2761− TypableCommand {
2762− name: "set-option",
2763− aliases: &["set"],
2764− doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.",
2765− fun: set_option,
2766− // TODO: Add support for completion of the options value(s), when appropriate.
2767− signature: CommandSignature::positional(&[completers::setting]),
2768− },
2769− TypableCommand {
2770− name: "toggle-option",
2771− aliases: &["toggle"],
2772− doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.",
2773− fun: toggle_option,
2774− signature: CommandSignature::positional(&[completers::setting]),
2775− },
2776− TypableCommand {
2777− name: "get-option",
2778− aliases: &["get"],
2779− doc: "Get the current value of a config option.",
2780− fun: get_option,
2781− signature: CommandSignature::positional(&[completers::setting]),
2782− },
2783− TypableCommand {
2784− name: "sort",
2785− aliases: &[],
2786− doc: "Sort ranges in selection.",
2787− fun: sort,
2788− signature: CommandSignature::none(),
2789− },
2790− TypableCommand {
2791− name: "rsort",
2792− aliases: &[],
2793− doc: "Sort ranges in selection in reverse order.",
2794− fun: sort_reverse,
2795− signature: CommandSignature::none(),
2796− },
2797− TypableCommand {
2798− name: "reflow",
2799− aliases: &[],
2800− doc: "Hard-wrap the current selection of lines to a given width.",
2801− fun: reflow,
2802− signature: CommandSignature::none(),
2803− },
2804− TypableCommand {
2805− name: "tree-sitter-subtree",
2806− aliases: &["ts-subtree"],
2807− doc: "Display tree sitter subtree under cursor, primarily for debugging queries.",
2808− fun: tree_sitter_subtree,
2809− signature: CommandSignature::none(),
2810− },
2811− TypableCommand {
2812− name: "config-reload",
2813− aliases: &[],
2814− doc: "Refresh user config.",
2815− fun: refresh_config,
2816− signature: CommandSignature::none(),
2817− },
2818− TypableCommand {
2819− name: "config-open",
2820− aliases: &[],
2821− doc: "Open the user config.toml file.",
2822− fun: open_config,
2823− signature: CommandSignature::none(),
2824− },
2825− TypableCommand {
2826− name: "config-open-workspace",
2827− aliases: &[],
2828− doc: "Open the workspace config.toml file.",
2829− fun: open_workspace_config,
2830− signature: CommandSignature::none(),
2831− },
2832− TypableCommand {
2833− name: "log-open",
2834− aliases: &[],
2835− doc: "Open the helix log file.",
2836− fun: open_log,
2837− signature: CommandSignature::none(),
2838− },
2839− TypableCommand {
2840− name: "insert-output",
2841− aliases: &[],
2842− doc: "Run shell command, inserting output before each selection.",
2843− fun: insert_output,
2844− signature: CommandSignature::none(),
2845− },
2846− TypableCommand {
2847− name: "append-output",
2848− aliases: &[],
2849− doc: "Run shell command, appending output after each selection.",
2850− fun: append_output,
2851− signature: CommandSignature::none(),
2852− },
2853− TypableCommand {
2854− name: "pipe",
2855− aliases: &[],
2856− doc: "Pipe each selection to the shell command.",
2857− fun: pipe,
2858− signature: CommandSignature::none(),
2859− },
2860− TypableCommand {
2861− name: "pipe-to",
2862− aliases: &[],
2863− doc: "Pipe each selection to the shell command, ignoring output.",
2864− fun: pipe_to,
2865− signature: CommandSignature::none(),
2866− },
2867− TypableCommand {
2868− name: "run-shell-command",
2869− aliases: &["sh"],
2870− doc: "Run a shell command",
2871− fun: run_shell_command,
2872− signature: CommandSignature::all(completers::filename)
2873− },
2874− TypableCommand {
2875− name: "reset-diff-change",
2876− aliases: &["diffget", "diffg"],
2877− doc: "Reset the diff change at the cursor position.",
2878− fun: reset_diff_change,
2879− signature: CommandSignature::none(),
2880− },
2881− TypableCommand {
2882− name: "clear-register",
2883− aliases: &[],
2884− doc: "Clear given register. If no argument is provided, clear all registers.",
2885− fun: clear_register,
2886− signature: CommandSignature::none(),
2887− },
2888− ];
2301+ TypableCommand {
2302+ name: "quit",
2303+ aliases: &["q"],
2304+ doc: "Close the current view.",
2305+ fun: quit,
2306+ signature: CommandSignature::none(),
2307+ },
2308+ TypableCommand {
2309+ name: "quit!",
2310+ aliases: &["q!"],
2311+ doc: "Force close the current view, ignoring unsaved changes.",
2312+ fun: force_quit,
2313+ signature: CommandSignature::none(),
2314+ },
2315+ TypableCommand {
2316+ name: "open",
2317+ aliases: &["o"],
2318+ doc: "Open a file from disk into the current view.",
2319+ fun: open,
2320+ signature: CommandSignature::all(completers::filename),
2321+ },
2322+ TypableCommand {
2323+ name: "buffer-close",
2324+ aliases: &["bc", "bclose"],
2325+ doc: "Close the current buffer.",
2326+ fun: buffer_close,
2327+ signature: CommandSignature::all(completers::buffer),
2328+ },
2329+ TypableCommand {
2330+ name: "buffer-close!",
2331+ aliases: &["bc!", "bclose!"],
2332+ doc: "Close the current buffer forcefully, ignoring unsaved changes.",
2333+ fun: force_buffer_close,
2334+ signature: CommandSignature::all(completers::buffer)
2335+ },
2336+ TypableCommand {
2337+ name: "buffer-close-others",
2338+ aliases: &["bco", "bcloseother"],
2339+ doc: "Close all buffers but the currently focused one.",
2340+ fun: buffer_close_others,
2341+ signature: CommandSignature::none(),
2342+ },
2343+ TypableCommand {
2344+ name: "buffer-close-others!",
2345+ aliases: &["bco!", "bcloseother!"],
2346+ doc: "Force close all buffers but the currently focused one.",
2347+ fun: force_buffer_close_others,
2348+ signature: CommandSignature::none(),
2349+ },
2350+ TypableCommand {
2351+ name: "buffer-close-all",
2352+ aliases: &["bca", "bcloseall"],
2353+ doc: "Close all buffers without quitting.",
2354+ fun: buffer_close_all,
2355+ signature: CommandSignature::none(),
2356+ },
2357+ TypableCommand {
2358+ name: "buffer-close-all!",
2359+ aliases: &["bca!", "bcloseall!"],
2360+ doc: "Force close all buffers ignoring unsaved changes without quitting.",
2361+ fun: force_buffer_close_all,
2362+ signature: CommandSignature::none(),
2363+ },
2364+ TypableCommand {
2365+ name: "buffer-next",
2366+ aliases: &["bn", "bnext"],
2367+ doc: "Goto next buffer.",
2368+ fun: buffer_next,
2369+ signature: CommandSignature::none(),
2370+ },
2371+ TypableCommand {
2372+ name: "buffer-previous",
2373+ aliases: &["bp", "bprev"],
2374+ doc: "Goto previous buffer.",
2375+ fun: buffer_previous,
2376+ signature: CommandSignature::none(),
2377+ },
2378+ TypableCommand {
2379+ name: "write",
2380+ aliases: &["w"],
2381+ doc: "Write changes to disk. Accepts an optional path (:write some/path.txt)",
2382+ fun: write,
2383+ signature: CommandSignature::positional(&[completers::filename]),
2384+ },
2385+ TypableCommand {
2386+ name: "write!",
2387+ aliases: &["w!"],
2388+ doc: "Force write changes to disk creating necessary subdirectories. Accepts an optional path (:write! some/path.txt)",
2389+ fun: force_write,
2390+ signature: CommandSignature::positional(&[completers::filename]),
2391+ },
2392+ TypableCommand {
2393+ name: "write-buffer-close",
2394+ aliases: &["wbc"],
2395+ doc: "Write changes to disk and closes the buffer. Accepts an optional path (:write-buffer-close some/path.txt)",
2396+ fun: write_buffer_close,
2397+ signature: CommandSignature::positional(&[completers::filename]),
2398+ },
2399+ TypableCommand {
2400+ name: "write-buffer-close!",
2401+ aliases: &["wbc!"],
2402+ doc: "Force write changes to disk creating necessary subdirectories and closes the buffer. Accepts an optional path (:write-buffer-close! some/path.txt)",
2403+ fun: force_write_buffer_close,
2404+ signature: CommandSignature::positional(&[completers::filename]),
2405+ },
2406+ TypableCommand {
2407+ name: "new",
2408+ aliases: &["n"],
2409+ doc: "Create a new scratch buffer.",
2410+ fun: new_file,
2411+ // TODO: This seems to complete with a filename, but doesn't use that filename to
2412+ // set the path of the newly created buffer.
2413+ signature: CommandSignature::positional(&[completers::filename]),
2414+ },
2415+ TypableCommand {
2416+ name: "format",
2417+ aliases: &["fmt"],
2418+ doc: "Format the file using the LSP formatter.",
2419+ fun: format,
2420+ signature: CommandSignature::none(),
2421+ },
2422+ TypableCommand {
2423+ name: "indent-style",
2424+ aliases: &[],
2425+ doc: "Set the indentation style for editing. ('t' for tabs or 1-8 for number of spaces.)",
2426+ fun: set_indent_style,
2427+ signature: CommandSignature::none(),
2428+ },
2429+ TypableCommand {
2430+ name: "line-ending",
2431+ aliases: &[],
2432+ #[cfg(not(feature = "unicode-lines"))]
2433+ doc: "Set the document's default line ending. Options: crlf, lf.",
2434+ #[cfg(feature = "unicode-lines")]
2435+ doc: "Set the document's default line ending. Options: crlf, lf, cr, ff, nel.",
2436+ fun: set_line_ending,
2437+ signature: CommandSignature::none(),
2438+ },
2439+ TypableCommand {
2440+ name: "earlier",
2441+ aliases: &["ear"],
2442+ doc: "Jump back to an earlier point in edit history. Accepts a number of steps or a time span.",
2443+ fun: earlier,
2444+ signature: CommandSignature::none(),
2445+ },
2446+ TypableCommand {
2447+ name: "later",
2448+ aliases: &["lat"],
2449+ doc: "Jump to a later point in edit history. Accepts a number of steps or a time span.",
2450+ fun: later,
2451+ signature: CommandSignature::none(),
2452+ },
2453+ TypableCommand {
2454+ name: "write-quit",
2455+ aliases: &["wq", "x"],
2456+ doc: "Write changes to disk and close the current view. Accepts an optional path (:wq some/path.txt)",
2457+ fun: write_quit,
2458+ signature: CommandSignature::positional(&[completers::filename]),
2459+ },
2460+ TypableCommand {
2461+ name: "write-quit!",
2462+ aliases: &["wq!", "x!"],
2463+ doc: "Write changes to disk and close the current view forcefully. Accepts an optional path (:wq! some/path.txt)",
2464+ fun: force_write_quit,
2465+ signature: CommandSignature::positional(&[completers::filename]),
2466+ },
2467+ TypableCommand {
2468+ name: "write-all",
2469+ aliases: &["wa"],
2470+ doc: "Write changes from all buffers to disk.",
2471+ fun: write_all,
2472+ signature: CommandSignature::none(),
2473+ },
2474+ TypableCommand {
2475+ name: "write-all!",
2476+ aliases: &["wa!"],
2477+ doc: "Forcefully write changes from all buffers to disk creating necessary subdirectories.",
2478+ fun: force_write_all,
2479+ signature: CommandSignature::none(),
2480+ },
2481+ TypableCommand {
2482+ name: "write-quit-all",
2483+ aliases: &["wqa", "xa"],
2484+ doc: "Write changes from all buffers to disk and close all views.",
2485+ fun: write_all_quit,
2486+ signature: CommandSignature::none(),
2487+ },
2488+ TypableCommand {
2489+ name: "write-quit-all!",
2490+ aliases: &["wqa!", "xa!"],
2491+ doc: "Write changes from all buffers to disk and close all views forcefully (ignoring unsaved changes).",
2492+ fun: force_write_all_quit,
2493+ signature: CommandSignature::none(),
2494+ },
2495+ TypableCommand {
2496+ name: "quit-all",
2497+ aliases: &["qa"],
2498+ doc: "Close all views.",
2499+ fun: quit_all,
2500+ signature: CommandSignature::none(),
2501+ },
2502+ TypableCommand {
2503+ name: "quit-all!",
2504+ aliases: &["qa!"],
2505+ doc: "Force close all views ignoring unsaved changes.",
2506+ fun: force_quit_all,
2507+ signature: CommandSignature::none(),
2508+ },
2509+ TypableCommand {
2510+ name: "cquit",
2511+ aliases: &["cq"],
2512+ doc: "Quit with exit code (default 1). Accepts an optional integer exit code (:cq 2).",
2513+ fun: cquit,
2514+ signature: CommandSignature::none(),
2515+ },
2516+ TypableCommand {
2517+ name: "cquit!",
2518+ aliases: &["cq!"],
2519+ doc: "Force quit with exit code (default 1) ignoring unsaved changes. Accepts an optional integer exit code (:cq! 2).",
2520+ fun: force_cquit,
2521+ signature: CommandSignature::none(),
2522+ },
2523+ TypableCommand {
2524+ name: "theme",
2525+ aliases: &[],
2526+ doc: "Change the editor theme (show current theme if no name specified).",
2527+ fun: theme,
2528+ signature: CommandSignature::positional(&[completers::theme]),
2529+ },
2530+ TypableCommand {
2531+ name: "yank-join",
2532+ aliases: &[],
2533+ doc: "Yank joined selections. A separator can be provided as first argument. Default value is newline.",
2534+ fun: yank_joined,
2535+ signature: CommandSignature::none(),
2536+ },
2537+ TypableCommand {
2538+ name: "clipboard-yank",
2539+ aliases: &[],
2540+ doc: "Yank main selection into system clipboard.",
2541+ fun: yank_main_selection_to_clipboard,
2542+ signature: CommandSignature::none(),
2543+ },
2544+ TypableCommand {
2545+ name: "clipboard-yank-join",
2546+ aliases: &[],
2547+ 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.
2548+ fun: yank_joined_to_clipboard,
2549+ signature: CommandSignature::none(),
2550+ },
2551+ TypableCommand {
2552+ name: "primary-clipboard-yank",
2553+ aliases: &[],
2554+ doc: "Yank main selection into system primary clipboard.",
2555+ fun: yank_main_selection_to_primary_clipboard,
2556+ signature: CommandSignature::none(),
2557+ },
2558+ TypableCommand {
2559+ name: "primary-clipboard-yank-join",
2560+ aliases: &[],
2561+ 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.
2562+ fun: yank_joined_to_primary_clipboard,
2563+ signature: CommandSignature::none(),
2564+ },
2565+ TypableCommand {
2566+ name: "clipboard-paste-after",
2567+ aliases: &[],
2568+ doc: "Paste system clipboard after selections.",
2569+ fun: paste_clipboard_after,
2570+ signature: CommandSignature::none(),
2571+ },
2572+ TypableCommand {
2573+ name: "clipboard-paste-before",
2574+ aliases: &[],
2575+ doc: "Paste system clipboard before selections.",
2576+ fun: paste_clipboard_before,
2577+ signature: CommandSignature::none(),
2578+ },
2579+ TypableCommand {
2580+ name: "clipboard-paste-replace",
2581+ aliases: &[],
2582+ doc: "Replace selections with content of system clipboard.",
2583+ fun: replace_selections_with_clipboard,
2584+ signature: CommandSignature::none(),
2585+ },
2586+ TypableCommand {
2587+ name: "primary-clipboard-paste-after",
2588+ aliases: &[],
2589+ doc: "Paste primary clipboard after selections.",
2590+ fun: paste_primary_clipboard_after,
2591+ signature: CommandSignature::none(),
2592+ },
2593+ TypableCommand {
2594+ name: "primary-clipboard-paste-before",
2595+ aliases: &[],
2596+ doc: "Paste primary clipboard before selections.",
2597+ fun: paste_primary_clipboard_before,
2598+ signature: CommandSignature::none(),
2599+ },
2600+ TypableCommand {
2601+ name: "primary-clipboard-paste-replace",
2602+ aliases: &[],
2603+ doc: "Replace selections with content of system primary clipboard.",
2604+ fun: replace_selections_with_primary_clipboard,
2605+ signature: CommandSignature::none(),
2606+ },
2607+ TypableCommand {
2608+ name: "show-clipboard-provider",
2609+ aliases: &[],
2610+ doc: "Show clipboard provider name in status bar.",
2611+ fun: show_clipboard_provider,
2612+ signature: CommandSignature::none(),
2613+ },
2614+ TypableCommand {
2615+ name: "change-current-directory",
2616+ aliases: &["cd"],
2617+ doc: "Change the current working directory.",
2618+ fun: change_current_directory,
2619+ signature: CommandSignature::positional(&[completers::directory]),
2620+ },
2621+ TypableCommand {
2622+ name: "show-directory",
2623+ aliases: &["pwd"],
2624+ doc: "Show the current working directory.",
2625+ fun: show_current_directory,
2626+ signature: CommandSignature::none(),
2627+ },
2628+ TypableCommand {
2629+ name: "encoding",
2630+ aliases: &[],
2631+ doc: "Set encoding. Based on `https://encoding.spec.whatwg.org`.",
2632+ fun: set_encoding,
2633+ signature: CommandSignature::none(),
2634+ },
2635+ TypableCommand {
2636+ name: "character-info",
2637+ aliases: &["char"],
2638+ doc: "Get info about the character under the primary cursor.",
2639+ fun: get_character_info,
2640+ signature: CommandSignature::none(),
2641+ },
2642+ TypableCommand {
2643+ name: "reload",
2644+ aliases: &["rl"],
2645+ doc: "Discard changes and reload from the source file.",
2646+ fun: reload,
2647+ signature: CommandSignature::none(),
2648+ },
2649+ TypableCommand {
2650+ name: "reload-all",
2651+ aliases: &["rla"],
2652+ doc: "Discard changes and reload all documents from the source files.",
2653+ fun: reload_all,
2654+ signature: CommandSignature::none(),
2655+ },
2656+ TypableCommand {
2657+ name: "update",
2658+ aliases: &["u"],
2659+ doc: "Write changes only if the file has been modified.",
2660+ fun: update,
2661+ signature: CommandSignature::none(),
2662+ },
2663+ TypableCommand {
2664+ name: "lsp-workspace-command",
2665+ aliases: &[],
2666+ doc: "Open workspace command picker",
2667+ fun: lsp_workspace_command,
2668+ signature: CommandSignature::positional(&[completers::lsp_workspace_command]),
2669+ },
2670+ TypableCommand {
2671+ name: "lsp-restart",
2672+ aliases: &[],
2673+ doc: "Restarts the language servers used by the current doc",
2674+ fun: lsp_restart,
2675+ signature: CommandSignature::none(),
2676+ },
2677+ TypableCommand {
2678+ name: "lsp-stop",
2679+ aliases: &[],
2680+ doc: "Stops the language servers that are used by the current doc",
2681+ fun: lsp_stop,
2682+ signature: CommandSignature::none(),
2683+ },
2684+ TypableCommand {
2685+ name: "tree-sitter-scopes",
2686+ aliases: &[],
2687+ doc: "Display tree sitter scopes, primarily for theming and development.",
2688+ fun: tree_sitter_scopes,
2689+ signature: CommandSignature::none(),
2690+ },
2691+ TypableCommand {
2692+ name: "debug-start",
2693+ aliases: &["dbg"],
2694+ doc: "Start a debug session from a given template with given parameters.",
2695+ fun: debug_start,
2696+ signature: CommandSignature::none(),
2697+ },
2698+ TypableCommand {
2699+ name: "debug-remote",
2700+ aliases: &["dbg-tcp"],
2701+ doc: "Connect to a debug adapter by TCP address and start a debugging session from a given template with given parameters.",
2702+ fun: debug_remote,
2703+ signature: CommandSignature::none(),
2704+ },
2705+ TypableCommand {
2706+ name: "debug-eval",
2707+ aliases: &[],
2708+ doc: "Evaluate expression in current debug context.",
2709+ fun: debug_eval,
2710+ signature: CommandSignature::none(),
2711+ },
2712+ TypableCommand {
2713+ name: "vsplit",
2714+ aliases: &["vs"],
2715+ doc: "Open the file in a vertical split.",
2716+ fun: vsplit,
2717+ signature: CommandSignature::all(completers::filename)
2718+ },
2719+ TypableCommand {
2720+ name: "vsplit-new",
2721+ aliases: &["vnew"],
2722+ doc: "Open a scratch buffer in a vertical split.",
2723+ fun: vsplit_new,
2724+ signature: CommandSignature::none(),
2725+ },
2726+ TypableCommand {
2727+ name: "hsplit",
2728+ aliases: &["hs", "sp"],
2729+ doc: "Open the file in a horizontal split.",
2730+ fun: hsplit,
2731+ signature: CommandSignature::all(completers::filename)
2732+ },
2733+ TypableCommand {
2734+ name: "hsplit-new",
2735+ aliases: &["hnew"],
2736+ doc: "Open a scratch buffer in a horizontal split.",
2737+ fun: hsplit_new,
2738+ signature: CommandSignature::none(),
2739+ },
2740+ TypableCommand {
2741+ name: "tutor",
2742+ aliases: &[],
2743+ doc: "Open the tutorial.",
2744+ fun: tutor,
2745+ signature: CommandSignature::none(),
2746+ },
2747+ TypableCommand {
2748+ name: "goto",
2749+ aliases: &["g"],
2750+ doc: "Goto line number.",
2751+ fun: goto_line_number,
2752+ signature: CommandSignature::none(),
2753+ },
2754+ TypableCommand {
2755+ name: "set-language",
2756+ aliases: &["lang"],
2757+ doc: "Set the language of current buffer (show current language if no value specified).",
2758+ fun: language,
2759+ signature: CommandSignature::positional(&[completers::language]),
2760+ },
2761+ TypableCommand {
2762+ name: "set-option",
2763+ aliases: &["set"],
2764+ doc: "Set a config option at runtime.\nFor example to disable smart case search, use `:set search.smart-case false`.",
2765+ fun: set_option,
2766+ // TODO: Add support for completion of the options value(s), when appropriate.
2767+ signature: CommandSignature::positional(&[completers::setting]),
2768+ },
2769+ TypableCommand {
2770+ name: "toggle-option",
2771+ aliases: &["toggle"],
2772+ doc: "Toggle a boolean config option at runtime.\nFor example to toggle smart case search, use `:toggle search.smart-case`.",
2773+ fun: toggle_option,
2774+ signature: CommandSignature::positional(&[completers::setting]),
2775+ },
2776+ TypableCommand {
2777+ name: "get-option",
2778+ aliases: &["get"],
2779+ doc: "Get the current value of a config option.",
2780+ fun: get_option,
2781+ signature: CommandSignature::positional(&[completers::setting]),
2782+ },
2783+ TypableCommand {
2784+ name: "sort",
2785+ aliases: &[],
2786+ doc: "Sort ranges in selection.",
2787+ fun: sort,
2788+ signature: CommandSignature::none(),
2789+ },
2790+ TypableCommand {
2791+ name: "rsort",
2792+ aliases: &[],
2793+ doc: "Sort ranges in selection in reverse order.",
2794+ fun: sort_reverse,
2795+ signature: CommandSignature::none(),
2796+ },
2797+ TypableCommand {
2798+ name: "reflow",
2799+ aliases: &[],
2800+ doc: "Hard-wrap the current selection of lines to a given width.",
2801+ fun: reflow,
2802+ signature: CommandSignature::none(),
2803+ },
2804+ TypableCommand {
2805+ name: "tree-sitter-subtree",
2806+ aliases: &["ts-subtree"],
2807+ doc: "Display tree sitter subtree under cursor, primarily for debugging queries.",
2808+ fun: tree_sitter_subtree,
2809+ signature: CommandSignature::none(),
2810+ },
2811+ TypableCommand {
2812+ name: "config-reload",
2813+ aliases: &[],
2814+ doc: "Refresh user config.",
2815+ fun: refresh_config,
2816+ signature: CommandSignature::none(),
2817+ },
2818+ TypableCommand {
2819+ name: "config-open",
2820+ aliases: &[],
2821+ doc: "Open the user config.toml file.",
2822+ fun: open_config,
2823+ signature: CommandSignature::none(),
2824+ },
2825+ TypableCommand {
2826+ name: "config-open-workspace",
2827+ aliases: &[],
2828+ doc: "Open the workspace config.toml file.",
2829+ fun: open_workspace_config,
2830+ signature: CommandSignature::none(),
2831+ },
2832+ TypableCommand {
2833+ name: "log-open",
2834+ aliases: &[],
2835+ doc: "Open the helix log file.",
2836+ fun: open_log,
2837+ signature: CommandSignature::none(),
2838+ },
2839+ TypableCommand {
2840+ name: "insert-output",
2841+ aliases: &[],
2842+ doc: "Run shell command, inserting output before each selection.",
2843+ fun: insert_output,
2844+ signature: CommandSignature::none(),
2845+ },
2846+ TypableCommand {
2847+ name: "append-output",
2848+ aliases: &[],
2849+ doc: "Run shell command, appending output after each selection.",
2850+ fun: append_output,
2851+ signature: CommandSignature::none(),
2852+ },
2853+ TypableCommand {
2854+ name: "pipe",
2855+ aliases: &[],
2856+ doc: "Pipe each selection to the shell command.",
2857+ fun: pipe,
2858+ signature: CommandSignature::none(),
2859+ },
2860+ TypableCommand {
2861+ name: "pipe-to",
2862+ aliases: &[],
2863+ doc: "Pipe each selection to the shell command, ignoring output.",
2864+ fun: pipe_to,
2865+ signature: CommandSignature::none(),
2866+ },
2867+ TypableCommand {
2868+ name: "run-shell-command",
2869+ aliases: &["sh"],
2870+ doc: "Run a shell command",
2871+ fun: run_shell_command,
2872+ signature: CommandSignature::all(completers::filename)
2873+ },
2874+ TypableCommand {
2875+ name: "reset-diff-change",
2876+ aliases: &["diffget", "diffg"],
2877+ doc: "Reset the diff change at the cursor position.",
2878+ fun: reset_diff_change,
2879+ signature: CommandSignature::none(),
2880+ },
2881+ TypableCommand {
2882+ name: "clear-register",
2883+ aliases: &[],
2884+ doc: "Clear given register. If no argument is provided, clear all registers.",
2885+ fun: clear_register,
2886+ signature: CommandSignature::none(),
2887+ },
2888+];
28892889
28902890pub static TYPABLE_COMMAND_MAP: Lazy<HashMap<&'static str, &'static TypableCommand>> =
28912891 Lazy::new(|| {
helix-term/src/keymap.rs+14−14
@@ -401,14 +401,14 @@ mod tests {
401401 fn merge_partial_keys() {
402402 let keymap = hashmap! {
403403 Mode::Normal => keymap!({ "Normal mode"
404− "i" => normal_mode,
405− "无" => insert_mode,
406− "z" => jump_backward,
407− "g" => { "Merge into goto mode"
408− "$" => goto_line_end,
409− "g" => delete_char_forward,
410− },
411− })
404+ "i" => normal_mode,
405+ "无" => insert_mode,
406+ "z" => jump_backward,
407+ "g" => { "Merge into goto mode"
408+ "$" => goto_line_end,
409+ "g" => delete_char_forward,
410+ },
411+ })
412412 };
413413 let mut merged_keyamp = default();
414414 merge_keys(&mut merged_keyamp, keymap.clone());
@@ -474,13 +474,13 @@ mod tests {
474474 fn order_should_be_set() {
475475 let keymap = hashmap! {
476476 Mode::Normal => keymap!({ "Normal mode"
477− "space" => { ""
478− "s" => { ""
479− "v" => vsplit,
480− "c" => hsplit,
481− },
477+ "space" => { ""
478+ "s" => { ""
479+ "v" => vsplit,
480+ "c" => hsplit,
482481 },
483− })
482+ },
483+ })
484484 };
485485 let mut merged_keyamp = default();
486486 merge_keys(&mut merged_keyamp, keymap.clone());