mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
fish_clipboard_copy: indent multiline commands
See also the earlier commits. Closes #10437
This commit is contained in:
parent
611a0572b1
commit
a37629f869
2 changed files with 3 additions and 2 deletions
|
@ -107,6 +107,7 @@ Interactive improvements
|
|||
- Command abbreviations (those with ``--position command`` or without a ``--position``) now also expand after decorators like ``command`` (:issue:`10396`).
|
||||
- Abbreviations now expand after process separators like ``;`` and ``|``. This fixes a regression in version 3.6 (:issue:`9730`).
|
||||
- When exporting interactively defined functions (using ``type``, ``functions`` or ``funcsave``) the function body is now indented, same as in the interactive command line editor (:issue:`8603`).
|
||||
- ``fish_clipboard_copy`` now copies indentation for multiline commands (:issue:`10437`).
|
||||
|
||||
New or improved bindings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -3,8 +3,8 @@ function fish_clipboard_copy
|
|||
if isatty stdin
|
||||
# Copy the current selection, or the entire commandline if that is empty.
|
||||
# Don't use `string collect -N` here - `commandline` adds a newline.
|
||||
set cmdline (commandline --current-selection | string collect)
|
||||
test -n "$cmdline"; or set cmdline (commandline | string collect)
|
||||
set cmdline (commandline --current-selection | fish_indent --only-indent | string collect)
|
||||
test -n "$cmdline"; or set cmdline (commandline | fish_indent --only-indent | string collect)
|
||||
else
|
||||
# Read from stdin
|
||||
while read -lz line
|
||||
|
|
Loading…
Reference in a new issue