mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Doc is updated
btw. funced completion is updated
This commit is contained in:
parent
ab62fe6496
commit
fe26284376
2 changed files with 9 additions and 10 deletions
|
@ -1,13 +1,14 @@
|
||||||
\section funced funced - edit a function interactively
|
\section funced funced - edit a function interactively
|
||||||
|
|
||||||
\subsection funced-synopsis Synopsis
|
\subsection funced-synopsis Synopsis
|
||||||
<code>funced [-e editor] NAME</code>
|
<code>funced [OPTIONS] NAME</code>
|
||||||
|
|
||||||
\subsection funced-description Description
|
\subsection funced-description Description
|
||||||
|
|
||||||
Use the funced command to interactively edit the definition of a
|
Use the funced command to edit the definition of a
|
||||||
function. If there is no function with the name specified, a skeleton function is inserted, if a function exist, the definion will be shown in your editor or on the command line.
|
function. If there is no function with the name specified, a skeleton function is inserted, if a function exist, the definition will be shown in your editor or on the command line.
|
||||||
|
|
||||||
By default, funced edits functions using the text editor in your $EDITOR variable, if set; otherwise it uses the built-in editor.
|
By default, funced edits functions using the text editor in your $EDITOR variable, if set; otherwise it uses the built-in editor.
|
||||||
|
|
||||||
- <code>-e command</code> or <code>--editor command</code> Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
- <code>-e command</code> or <code>--editor command</code> Open the function body inside the text editor given by the command (for example, "vi"). The command 'fish' will use the built-in editor.
|
||||||
|
- <code>-i</code> or <code>--interactive</code> Open function body in built-in editor.
|
||||||
|
|
|
@ -47,7 +47,11 @@ function funced --description 'Edit function definition'
|
||||||
set init function $funcname\n\nend
|
set init function $funcname\n\nend
|
||||||
end
|
end
|
||||||
|
|
||||||
if begin; test "$editor" = fish; or set -q interactive[1]; end
|
if not type -f "$editor" >/dev/null
|
||||||
|
set interactive 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if begin; set -q interactive[1]; or test "$editor" = fish; end
|
||||||
set -l IFS
|
set -l IFS
|
||||||
if functions -q -- $funcname
|
if functions -q -- $funcname
|
||||||
# Shadow IFS here to avoid array splitting in command substitution
|
# Shadow IFS here to avoid array splitting in command substitution
|
||||||
|
@ -65,12 +69,6 @@ function funced --description 'Edit function definition'
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if not type -f "$editor" >/dev/null
|
|
||||||
set_color red
|
|
||||||
printf (_ "%s: Editor %s is not found\n") funced $editor
|
|
||||||
set_color normal
|
|
||||||
end
|
|
||||||
|
|
||||||
set -q TMPDIR; or set -l TMPDIR /tmp
|
set -q TMPDIR; or set -l TMPDIR /tmp
|
||||||
set -l tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random))
|
set -l tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random))
|
||||||
while test -f $tmpname
|
while test -f $tmpname
|
||||||
|
|
Loading…
Reference in a new issue