mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-20 07:31:11 -03:00
Merge pull request #11691
This commit is contained in:
@@ -51,6 +51,7 @@ Interactive improvements
|
||||
- Instead of flashing all the text to the left of the cursor, fish now flashes the matched token during history token search, the completed token during completion (:issue:`11050`), the autosuggestion when deleting it, and the full command line in all other cases.
|
||||
- Pasted commands are now stripped of any ``$`` prefix.
|
||||
- The :kbd:`alt-s` binding will now also use ``run0`` if available.
|
||||
- ``funced`` will now edit copied functions directly, instead of the file where ``function --copy`` was invoked. (:issue:`11614`)
|
||||
|
||||
New or improved bindings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -71,6 +71,11 @@ function funced --description 'Edit function definition'
|
||||
|
||||
if not functions -q -- $funcname
|
||||
echo $init >$tmpname
|
||||
else if not string match --quiet --regex '^(?:n/a|not-autoloaded|autoloaded)$' -- (functions --details --verbose -- $funcname)[2]
|
||||
# Pretend this copied function does not have a definition file. Editing the file which
|
||||
# originally defined it would not update this copy, and the file which copied it
|
||||
# would not have a function body to edit. (issue #11614)
|
||||
functions -- $funcname >$tmpname
|
||||
else if functions --details -- $funcname | string match --invert --quiet --regex '^(?:-|stdin|embedded:.*)$'
|
||||
set writepath (functions --details -- $funcname)
|
||||
# Use cat here rather than cp to avoid copying permissions
|
||||
|
||||
23
tests/checks/funced.fish
Normal file
23
tests/checks/funced.fish
Normal file
@@ -0,0 +1,23 @@
|
||||
#RUN: %fish %s
|
||||
|
||||
function my-src
|
||||
echo hello
|
||||
end
|
||||
|
||||
echo "functions --copy my-src my-dst" >my-copy-function.fish
|
||||
source my-copy-function.fish
|
||||
rm my-copy-function.fish # Cleanup
|
||||
|
||||
functions --details --verbose my-dst
|
||||
# CHECK: my-copy-function.fish
|
||||
# CHECK: {{.*}}tests/checks/funced.fish
|
||||
# CHECK: 3
|
||||
# CHECK: scope-shadowing
|
||||
|
||||
VISUAL=cat EDITOR=cat funced my-dst
|
||||
# CHECK: # Defined in {{.*}}/tests/checks/funced.fish @ line 3, copied in my-copy-function.fish @ line 1
|
||||
# CHECK: function my-dst
|
||||
# CHECK: echo hello
|
||||
# CHECK: end
|
||||
# CHECK: Editor exited but the function was not modified
|
||||
# CHECK: If the editor is still running, check if it waits for completion, maybe a '--wait' option?
|
||||
Reference in New Issue
Block a user