Skip to content

Instantly share code, notes, and snippets.

@TeddyDD

TeddyDD/prof Secret

Created February 5, 2019 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TeddyDD/86595284e13657155b898f0d9d9fc680 to your computer and use it in GitHub Desktop.
Save TeddyDD/86595284e13657155b898f0d9d9fc680 to your computer and use it in GitHub Desktop.
profile for z.lua issue #29
Czas Suma Komenda
1516 3681 > builtin source /usr/share/fish/config.fish
40 40 -> set -g IFS \n\ \t
18 18 -> set -qg __fish_added_user_paths
12 12 -> set -g __fish_added_user_paths
16 16 -> function __fish_default_command_not_found_handler
printf "fish: Unknown command '%s'\n" (string escape -- $argv) >&2
...
19 409 -> if status --is-interactive
# The user has seemingly explicitly launched an old fish with too-new scripts installed.
if not contains -- "string" (builtin -n)
set -g __is_launched_without_string 1
# XXX nostring - fix old fish binaries with no `string' builtin.
# When executed on fish 2.2.0, the `else' block after this would
# force on 24-bit mode due to changes to in test behavior.
# These "XXX nostring" hacks were added for 2.3.1
set_color --bold
echo "You appear to be trying to launch an old fish binary with newer scripts "
echo "installed into" (set_color --underline)"$__fish_data_dir"
set_color normal
echo -e "\nThis is an unsupported configuration.\n"
set_color yellow
echo "You may need to uninstall and reinstall fish!"
set_color normal
# Remove this code when we've made it safer to upgrade fish.
else
# Enable truecolor/24-bit support for select terminals
# Ignore Screen and emacs' ansi-term as they swallow the sequences, rendering the text white.
if not set -q STY
and not string match -q -- 'eterm*' $TERM
and begin
set -q KONSOLE_PROFILE_NAME # KDE's konsole
or string match -q -- "*:*" $ITERM_SESSION_ID # Supporting versions of iTerm2 will include a colon here
or string match -q -- "st-*" $TERM # suckless' st
or test -n "$VTE_VERSION" -a "$VTE_VERSION" -ge 3600 # Should be all gtk3-vte-based terms after version 3.6.0.0
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
end
# Only set it if it isn't to allow override by setting to 0
set -q fish_term24bit
or set -g fish_term24bit 1
end
end
else
# Hook up the default as the principal command_not_found handler
# in case we are not interactive
function __fish_command_not_found_handler --on-event fish_command_not_found
__fish_default_command_not_found_handler $argv
end
...
11 11 --> status --is-interactive
6 379 --> if not contains -- "string" (builtin -n)
set -g __is_launched_without_string 1
# XXX nostring - fix old fish binaries with no `string' builtin.
# When executed on fish 2.2.0, the `else' block after this would
# force on 24-bit mode due to changes to in test behavior.
# These "XXX nostring" hacks were added for 2.3.1
set_color --bold
echo "You appear to be trying to launch an old fish binary with newer scripts "
echo "installed into" (set_color --underline)"$__fish_data_dir"
set_color normal
echo -e "\nThis is an unsupported configuration.\n"
set_color yellow
echo "You may need to uninstall and reinstall fish!"
set_color normal
# Remove this code when we've made it safer to upgrade fish.
else
# Enable truecolor/24-bit support for select terminals
# Ignore Screen and emacs' ansi-term as they swallow the sequences, rendering the text white.
if not set -q STY
and not string match -q -- 'eterm*' $TERM
and begin
set -q KONSOLE_PROFILE_NAME # KDE's konsole
or string match -q -- "*:*" $ITERM_SESSION_ID # Supporting versions of iTerm2 will include a colon here
or string match -q -- "st-*" $TERM # suckless' st
or test -n "$VTE_VERSION" -a "$VTE_VERSION" -ge 3600 # Should be all gtk3-vte-based terms after version 3.6.0.0
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
end
# Only set it if it isn't to allow override by setting to 0
set -q fish_term24bit
or set -g fish_term24bit 1
end
...
141 187 ---> not contains -- "string" (builtin -n)
46 46 ----> builtin -n
14 186 ---> if not set -q STY
and not string match -q -- 'eterm*' $TERM
and begin
set -q KONSOLE_PROFILE_NAME # KDE's konsole
or string match -q -- "*:*" $ITERM_SESSION_ID # Supporting versions of iTerm2 will include a colon here
or string match -q -- "st-*" $TERM # suckless' st
or test -n "$VTE_VERSION" -a "$VTE_VERSION" -ge 3600 # Should be all gtk3-vte-based terms after version 3.6.0.0
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
end
# Only set it if it isn't to allow override by setting to 0
set -q fish_term24bit
or set -g fish_term24bit 1
...
10 10 ----> not set -q STY
23 23 ----> not string match -q -- 'eterm*' $TERM
15 112 ----> begin
set -q KONSOLE_PROFILE_NAME # KDE's konsole
or string match -q -- "*:*" $ITERM_SESSION_ID # Supporting versions of iTerm2 will include a colon here
or string match -q -- "st-*" $TERM # suckless' st
or test -n "$VTE_VERSION" -a "$VTE_VERSION" -ge 3600 # Should be all gtk3-vte-based terms after version 3.6.0.0
or test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit # slang expects this
...
9 9 -----> set -q KONSOLE_PROFILE_NAME
17 17 -----> string match -q -- "*:*" $ITERM_SESSION_ID
17 17 -----> string match -q -- "st-*" $TERM
32 32 -----> test -n "$VTE_VERSION" -a "$VTE_VERSION" -ge 3600
22 22 -----> test "$COLORTERM" = truecolor -o "$COLORTERM" = 24bit
9 9 ----> set -q fish_term24bit
18 18 ----> set -g fish_term24bit 1
22 22 -> set -g __fish_config_dir ~/.config/fish
3 12 -> if set -q XDG_CONFIG_HOME
set __fish_config_dir $XDG_CONFIG_HOME/fish
...
9 9 --> set -q XDG_CONFIG_HOME
16 16 -> set -l userdatadir ~/.local/share
3 11 -> if set -q XDG_DATA_HOME
set userdatadir $XDG_DATA_HOME
...
8 8 --> set -q XDG_DATA_HOME
11 11 -> set -l __extra_completionsdir
18 18 -> set -l __extra_functionsdir
20 20 -> set -l __extra_confdir
13 200 -> if test -f $__fish_data_dir/__fish_build_paths.fish
source $__fish_data_dir/__fish_build_paths.fish
...
38 38 --> test -f $__fish_data_dir/__fish_build_paths.fish
112 149 --> source $__fish_data_dir/__fish_build_paths.fish
15 15 ---> set __extra_completionsdir /usr/share/fish/vendor_completions.d
11 11 ---> set __extra_functionsdir /usr/share/fish/vendor_functions.d
11 11 ---> set __extra_confdir /usr/share/fish/vendor_conf.d
6 46 -> if not set -q fish_function_path
set fish_function_path $__fish_config_dir/functions $__fish_sysconf_dir/functions $__extra_functionsdir $__fish_data_dir/functions
...
10 10 --> not set -q fish_function_path
30 30 --> set fish_function_path $__fish_config_dir/functions $__fish_sysconf_dir/functions $__extra_functionsdir $__fish_data_dir/functions
3 56 -> if not contains -- $__fish_data_dir/functions $fish_function_path
set fish_function_path $fish_function_path $__fish_data_dir/functions
...
53 53 --> not contains -- $__fish_data_dir/functions $fish_function_path
7 48 -> if not set -q fish_complete_path
set fish_complete_path $__fish_config_dir/completions $__fish_sysconf_dir/completions $__extra_completionsdir $__fish_data_dir/completions $userdatadir/fish/generated_completions
...
9 9 --> not set -q fish_complete_path
32 32 --> set fish_complete_path $__fish_config_dir/completions $__fish_sysconf_dir/completions $__extra_completionsdir $__fish_data_dir/completions $userdatadir/fish/generated_completions
4 27 -> if not contains -- $__fish_data_dir/completions $fish_complete_path
set fish_complete_path $fish_complete_path $__fish_data_dir/completions
...
23 23 --> not contains -- $__fish_data_dir/completions $fish_complete_path
9 9 -> function :
# no-op function for compatibility with sh, bash, and others.
# Often used to insert a comment into a chain of commands without having
# it eat up the remainder of the line, handy in Makefiles.
...
3 20 -> if test -d /usr/xpg4/bin
if not contains -- /usr/xpg4/bin $PATH
set PATH /usr/xpg4/bin $PATH
end
...
17 17 --> test -d /usr/xpg4/bin
20 20 -> function __fish_reconstruct_path -d "Update PATH when fish_user_paths changes" --on-variable fish_user_paths
set -l local_path $PATH
for x in $__fish_added_user_paths
set -l idx (contains --index -- $x $local_path)
and set -e local_path[$idx]
end
set -g __fish_added_user_paths
if set -q fish_user_paths
for x in $fish_user_paths[-1..1]
if set -l idx (contains --index -- $x $local_path)
set -e local_path[$idx]
else
set -g __fish_added_user_paths $__fish_added_user_paths $x
end
set local_path $x $local_path
end
end
set -xg PATH $local_path
...
19 19 -> function fish_sigtrap_handler --on-signal TRAP --no-scope-shadowing --description "Signal handler for the TRAP signal. Launches a debug prompt."
breakpoint
...
8 8 -> function __fish_on_interactive --on-event fish_prompt
__fish_config_interactive
functions -e __fish_on_interactive
...
100 649 -> __fish_set_locale
422 429 --> source /usr/share/fish/functions/__fish_set_locale.fish
7 7 ---> function __fish_set_locale
set -l LOCALE_VARS
set -a LOCALE_VARS LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
set -a LOCALE_VARS LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
set -a LOCALE_VARS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
# We check LC_ALL to figure out if we have a locale but we don't set it later. That is because
# locale.conf doesn't allow it so we should not set it.
for locale_var in $LOCALE_VARS LC_ALL
if set -q $locale_var
return 0
end
end
# Try to extract the locale from the kernel boot commandline. The splitting here is a bit weird,
# but we operate under the assumption that the locale can't include whitespace. Other whitespace
# shouldn't concern us, but a quoted "locale.LANG=SOMETHING" as a value to something else might.
# Here the last definition of a variable takes precedence.
if test -r /proc/cmdline
for var in (string match -ra 'locale.[^=]+=\S+' < /proc/cmdline)
set -l kv (string replace 'locale.' '' -- $var | string split '=')
# Only set locale variables, not other stuff contained in these files - this also
# automatically ignores comments.
if contains -- $kv[1] $LOCALE_VARS
and set -q kv[2]
set -gx $kv[1] (string trim -c '\'"' -- $kv[2])
end
end
end
# Now read the config files we know are used by various OS distros.
#
# /etc/sysconfig/i18n is for old Red Hat derivatives (and possibly of no use anymore).
#
# /etc/env.d/02locale is from OpenRC.
#
# The rest are systemd inventions but also used elsewhere (e.g. Void Linux). systemd's
# documentation is a bit unclear on this. We merge all the config files (and the commandline),
# which seems to be what systemd itself does. (I.e. the value for a variable will be taken from
# the highest-precedence source) We read the systemd files first since they are a newer
# invention and therefore the rest are likely to be accumulated cruft.
#
# NOTE: Slackware puts the locale in /etc/profile.d/lang.sh, which we can't use because it's a
# full POSIX-shell script.
set -l user_cfg_dir (set -q XDG_CONFIG_HOME; and echo $XDG_CONFIG_HOME; or echo ~/.config)
for f in $user_cfg_dir/locale.conf /etc/locale.conf /etc/env.d/02locale /etc/sysconfig/i18n
if test -r $f
while read -l kv
set kv (string split '=' -- $kv)
if contains -- $kv[1] $LOCALE_VARS
and set -q kv[2]
# Do not set already set variables again - this makes the merging happen.
if not set -q $kv[1]
set -gx $kv[1] (string trim -c '\'"' -- $kv[2])
end
end
end <$f
end
end
# If we really cannot get anything, at least set character encoding to UTF-8.
for locale_var in $LOCALE_VARS LC_ALL
if set -q $locale_var
return 0
end
end
set -gx LC_CTYPE en_US.UTF-8
...
14 14 --> set -l LOCALE_VARS
15 15 --> set -a LOCALE_VARS LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
17 17 --> set -a LOCALE_VARS LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
15 15 --> set -a LOCALE_VARS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION
28 59 --> for locale_var in $LOCALE_VARS LC_ALL
if set -q $locale_var
return 0
end
...
9 31 ---> if set -q $locale_var
return 0
...
13 13 ----> set -q $locale_var
9 9 ----> return 0
12 12 -> function . --description 'Evaluate contents of file (deprecated, see "source")' --no-scope-shadowing
if test (count $argv) -eq 0
# Uses tty directly, as isatty depends on "."
and tty 0>&0 >/dev/null
echo "source: '.' command is deprecated, and doesn't work with STDIN anymore. Did you mean 'source' or './'?" >&2
return 1
else
source $argv
end
...
9 56 -> if not set -q __fish_init_2_3_0
if set -q fish_user_abbreviations
set -l fab
for abbr in $fish_user_abbreviations
set fab $fab (string replace -r '^([^ =]+)=(.*)$' '$1 $2' -- $abbr)
end
set fish_user_abbreviations $fab
end
set -U __fish_init_2_3_0
...
10 10 --> not set -q __fish_init_2_3_0
3 11 --> if set -q fish_user_abbreviations
set -l fab
for abbr in $fish_user_abbreviations
set fab $fab (string replace -r '^([^ =]+)=(.*)$' '$1 $2' -- $abbr)
end
set fish_user_abbreviations $fab
...
8 8 ---> set -q fish_user_abbreviations
26 26 --> set -U __fish_init_2_3_0
4 23 -> if command -sq /usr/libexec/path_helper
# Adapt construct_path from the macOS /usr/libexec/path_helper
# executable for fish; see
# https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html .
function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)"
set -l result
for path_file in $argv[2] $argv[3]/*
if test -f $path_file
while read -la entry
if not contains $entry $result
set result $result $entry
end
end <$path_file
end
end
for entry in $$argv[1]
if not contains $entry $result
set result $result $entry
end
end
set -xg $argv[1] $result
end
__fish_macos_set_env 'PATH' '/etc/paths' '/etc/paths.d'
if [ -n "$MANPATH" ]
__fish_macos_set_env 'MANPATH' '/etc/manpaths' '/etc/manpaths.d'
end
functions -e __fish_macos_set_env
...
19 19 --> command -sq /usr/libexec/path_helper
2 12 -> if status --is-login
#
# Put linux consoles in unicode mode.
#
if test "$TERM" = linux
if string match -qir '\.UTF' -- $LANG
if command -sq unicode_start
unicode_start
end
end
end
...
10 10 --> status --is-login
35 197 -> __fish_reconstruct_path
43 43 --> set -l local_path $PATH
22 22 --> for x in $__fish_added_user_paths
set -l idx (contains --index -- $x $local_path)
and set -e local_path[$idx]
...
12 12 --> set -g __fish_added_user_paths
3 11 --> if set -q fish_user_paths
for x in $fish_user_paths[-1..1]
if set -l idx (contains --index -- $x $local_path)
set -e local_path[$idx]
else
set -g __fish_added_user_paths $__fish_added_user_paths $x
end
set local_path $x $local_path
end
...
8 8 ---> set -q fish_user_paths
74 74 --> set -xg PATH $local_path
6 6 -> function __fish_expand_pid_args
for arg in $argv
if string match -qr '^%\d+$' -- $arg
# set newargv $newargv (jobs -p $arg)
jobs -p $arg
if not test $status -eq 0
return 1
end
else
printf "%s\n" $arg
end
end
...
7 7 -> function bg --wraps bg
builtin bg (__fish_expand_pid_args $argv)
...
4 4 -> function fg --wraps fg
builtin fg (__fish_expand_pid_args $argv)
...
6 6 -> function kill --wraps kill
command kill (__fish_expand_pid_args $argv)
...
5 5 -> function wait --wraps wait
builtin wait (__fish_expand_pid_args $argv)
...
5 5 -> function disown --wraps disown
builtin disown (__fish_expand_pid_args $argv)
...
13 13 -> set -l sourcelist
112 112 -> for file in $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $__extra_confdir/*.fish
set -l basename (string replace -r '^.*/' '' -- $file)
contains -- $basename $sourcelist
and continue
set sourcelist $sourcelist $basename
# Also skip non-files or unreadable files.
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd).
[ -f $file -a -r $file ]
and source $file
...
75 81 > source /usr/share/fish/functions/fish_title.fish
6 6 -> function fish_title
echo (status current-command) " " (__fish_pwd)
...
23 2408 > fish_title
102 2385 -> echo (status current-command) " " (__fish_pwd)
16 16 --> status current-command
85 2267 --> __fish_pwd
93 2135 ---> source /usr/share/fish/functions/__fish_pwd.fish
99 2042 ----> switch (uname)
case 'CYGWIN_*'
function __fish_pwd --description "Show current path"
pwd | sed -e 's-^/cygdrive/\(.\)/\?-\u\1:/-'
end
case '*'
function __fish_pwd --description "Show current path"
pwd
end
...
1928 1928 -----> uname
15 15 -----> function __fish_pwd --description "Show current path"
pwd
...
47 47 ---> pwd
42 21600 > __fish_on_interactive
244 21544 -> __fish_config_interactive
1541 1555 --> source /usr/share/fish/functions/__fish_config_interactive.fish
14 14 ---> function __fish_config_interactive -d "Initializations that should be performed when entering interactive mode"
if not set -q __fish_init_3_x
# Perform transitions relevant to going from fish 2.x to 3.x.
# Migrate old universal abbreviations to the new scheme.
__fish_abbr_old | source
set -U __fish_init_3_x
end
# Make sure this function is only run once.
if set -q __fish_config_interactive_done
return
end
set -g __fish_config_interactive_done
set -g __fish_active_key_bindings
# Set the correct user data directory
set -l userdatadir ~/.local/share
if set -q XDG_DATA_HOME
set userdatadir $XDG_DATA_HOME
end
if not set -q fish_greeting
set -l line1 (_ 'Welcome to fish, the friendly interactive shell')
set -l line2 ''
if not set -q __fish_init_2_3_0
set line2 \n(_ 'Type `help` for instructions on how to use fish')
end
set -U fish_greeting "$line1$line2"
end
if set -q fish_private_mode
set -l line (_ "fish is running in private mode, history will not be persisted.")
set -g fish_greeting $fish_greeting.\n$line
end
#
# If we are starting up for the first time, set various defaults.
#
# bump this to 2_4_0 when rolling release if anything changes after 9/10/2016
if not set -q __fish_init_2_39_8
# Regular syntax highlighting colors
set -q fish_color_normal
or set -U fish_color_normal normal
set -q fish_color_command
or set -U fish_color_command 005fd7
set -q fish_color_param
or set -U fish_color_param 00afff
set -q fish_color_redirection
or set -U fish_color_redirection 00afff
set -q fish_color_comment
or set -U fish_color_comment 990000
set -q fish_color_error
or set -U fish_color_error ff0000
set -q fish_color_escape
or set -U fish_color_escape 00a6b2
set -q fish_color_operator
or set -U fish_color_operator 00a6b2
set -q fish_color_end
or set -U fish_color_end 009900
set -q fish_color_quote
or set -U fish_color_quote 999900
set -q fish_color_autosuggestion
or set -U fish_color_autosuggestion 555 brblack
set -q fish_color_user
or set -U fish_color_user brgreen
set -q fish_color_host
or set -U fish_color_host normal
set -q fish_color_valid_path
or set -U fish_color_valid_path --underline
set -q fish_color_cwd
or set -U fish_color_cwd green
set -q fish_color_cwd_root
or set -U fish_color_cwd_root red
# Background color for matching quotes and parenthesis
set -q fish_color_match
or set -U fish_color_match --background=brblue
# Background color for search matches
set -q fish_color_search_match
or set -U fish_color_search_match bryellow --background=brblack
# Background color for selections
set -q fish_color_selection
or set -U fish_color_selection white --bold --background=brblack
set -q fish_color_cancel
or set -U fish_color_cancel -r
# Pager colors
set -q fish_pager_color_prefix
or set -U fish_pager_color_prefix white --bold --underline
set -q fish_pager_color_completion
or set -U fish_pager_color_completion
set -q fish_pager_color_description
or set -U fish_pager_color_description B3A06D yellow
set -q fish_pager_color_progress
or set -U fish_pager_color_progress brwhite --background=cyan
#
# Directory history colors
#
set -q fish_color_history_current
or set -U fish_color_history_current --bold
set -U __fish_init_2_39_8
end
#
# Generate man page completions if not present.
#
# Don't do this if we're being invoked as part of running unit tests.
if not set -q FISH_UNIT_TESTS_RUNNING
if not test -d $userdatadir/fish/generated_completions
# Generating completions from man pages needs python (see issue #3588).
# We cannot simply do `fish_update_completions &` because it is a function.
# We cannot do `eval` since it is a function.
# We don't want to call `fish -c` since that is unnecessary and sources config.fish again.
# Hence we'll call python directly.
# c_m_p.py should work with any python version.
set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
for py in python{3,2,}
if command -sq $py
$py $update_args >/dev/null 2>&1 &
break
end
end
end
end
#
# Print a greeting.
# fish_greeting can be a function (preferred) or a variable.
#
if status --is-interactive
if functions -q fish_greeting
fish_greeting
else
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
end
end
#
# This event handler makes sure the prompt is repainted when
# fish_color_cwd changes value. Like all event handlers, it can't be
# autoloaded.
#
function __fish_repaint --on-variable fish_color_cwd --description "Event handler, repaints the prompt when fish_color_cwd changes"
if status --is-interactive
set -e __fish_prompt_cwd
commandline -f repaint 2>/dev/null
end
end
function __fish_repaint_root --on-variable fish_color_cwd_root --description "Event handler, repaints the prompt when fish_color_cwd_root changes"
if status --is-interactive
set -e __fish_prompt_cwd
commandline -f repaint 2>/dev/null
end
end
#
# Completions for SysV startup scripts. These aren't bound to any
# specific command, so they can't be autoloaded.
#
if test -d /etc/init.d
complete -x -p "/etc/init.d/*" -a start --description 'Start service'
complete -x -p "/etc/init.d/*" -a stop --description 'Stop service'
complete -x -p "/etc/init.d/*" -a status --description 'Print service status'
complete -x -p "/etc/init.d/*" -a restart --description 'Stop and then start service'
complete -x -p "/etc/init.d/*" -a reload --description 'Reload service configuration'
end
#
# We want to show our completions for the [ (test) builtin, but
# we don't want to create a [.fish. test.fish will not be loaded until
# the user tries [ interactively.
#
complete -c [ --wraps test
# Reload key bindings when binding variable change
function __fish_reload_key_bindings -d "Reload key bindings when binding variable change" --on-variable fish_key_bindings
# Make sure some key bindings are set
if not set -q fish_key_bindings
set -U fish_key_bindings fish_default_key_bindings
end
# Do nothing if the key bindings didn't actually change.
# This could be because the variable was set to the existing value
# or because it was a local variable.
# If fish_key_bindings is empty on the first run, we still need to set the defaults.
if test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
return
end
# Check if fish_key_bindings is a valid function.
# If not, either keep the previous bindings (if any) or revert to default.
# Also print an error so the user knows.
if not functions -q "$fish_key_bindings"
echo "There is no fish_key_bindings function called: '$fish_key_bindings'" >&2
# We need to see if this is a defined function, otherwise we'd be in an endless loop.
if functions -q $__fish_active_key_bindings
echo "Keeping $__fish_active_key_bindings" >&2
# Set the variable to the old value so this error doesn't happen again.
set fish_key_bindings $__fish_active_key_bindings
return 1
else if functions -q fish_default_key_bindings
echo "Reverting to default bindings" >&2
set fish_key_bindings fish_default_key_bindings
# Return because we are called again
return 0
else
# If we can't even find the default bindings, something is broken.
# Without it, we would eventually run into the stack size limit, but that'd print hundreds of duplicate lines
# so we should give up earlier.
echo "Cannot find fish_default_key_bindings, falling back to very simple bindings." >&2
echo "Most likely something is wrong with your installation." >&2
return 0
end
end
set -g __fish_active_key_bindings "$fish_key_bindings"
set -g fish_bind_mode default
if test "$fish_key_bindings" = fish_default_key_bindings
# Redirect stderr per #1155
fish_default_key_bindings 2>/dev/null
else
$fish_key_bindings 2>/dev/null
end
# Load user key bindings if they are defined
if functions --query fish_user_key_bindings >/dev/null
fish_user_key_bindings 2>/dev/null
end
end
# Load key bindings
__fish_reload_key_bindings
if not set -q FISH_UNIT_TESTS_RUNNING
# Enable bracketed paste before every prompt (see __fish_shared_bindings for the bindings).
# Disable it for unit tests so we don't have to add the sequences to bind.expect
function __fish_enable_bracketed_paste --on-event fish_prompt
printf "\e[?2004h"
end
# Disable BP before every command because that might not support it.
function __fish_disable_bracketed_paste --on-event fish_preexec --on-event fish_exit
printf "\e[?2004l"
end
# Tell the terminal we support BP. Since we are in __f_c_i, the first fish_prompt
# has already fired.
__fish_enable_bracketed_paste
end
function __fish_winch_handler --on-signal WINCH -d "Repaint screen when window changes size"
commandline -f repaint >/dev/null 2>/dev/null
end
# Notify terminals when $PWD changes (issue #906).
# VTE based terminals, Terminal.app, and iTerm.app support this.
set -q VTE_VERSION
or set -l VTE_VERSION 0
set -q TERM_PROGRAM
or set -l TERM_PROGRAM
if test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
if status --is-command-substitution
or set -q INSIDE_EMACS
return
end
printf \e\]7\;file://\%s\%s\a $hostname (string escape --style=url $PWD)
end
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
end
### Command-not-found handlers
# This can be overridden by defining a new __fish_command_not_found_handler function
if not type -q __fish_command_not_found_handler
# Read the OS/Distro from /etc/os-release.
# This has a "ID=" line that defines the exact distribution,
# and an "ID_LIKE=" line that defines what it is derived from or otherwise like.
# For our purposes, we use both.
set -l os
if test -r /etc/os-release
set os (string match -r '^ID(?:_LIKE)?\s*=.*' < /etc/os-release | \
string replace -r '^ID(?:_LIKE)?\s*=(.*)' '$1' | string trim -c '\'"' | string split " ")
end
# First check if we are on OpenSUSE since SUSE's handler has no options
# but the same name and path as Ubuntu's.
if contains -- suse $os
or contains -- sles $os
and type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/bin/command-not-found $argv[1]
end
# Check for Fedora's handler
else if test -f /usr/libexec/pk-command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/libexec/pk-command-not-found $argv[1]
end
# Check in /usr/lib, this is where modern Ubuntus place this command
else if test -f /usr/lib/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found -- $argv[1]
end
# Check for NixOS handler
else if test -f /run/current-system/sw/bin/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/run/current-system/sw/bin/command-not-found $argv
end
# Ubuntu Feisty places this command in the regular path instead
else if type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
command-not-found -- $argv[1]
end
# pkgfile is an optional, but official, package on Arch Linux
# it ships with example handlers for bash and zsh, so we'll follow that format
else if type -p -q pkgfile
function __fish_command_not_found_handler --on-event fish_command_not_found
set -l __packages (pkgfile --binaries --verbose -- $argv[1] 2>/dev/null)
if test $status -eq 0
printf "%s may be found in the following packages:\n" "$argv[1]"
printf " %s\n" $__packages
else
__fish_default_command_not_found_handler $argv[1]
end
end
# Use standard fish command not found handler otherwise
else
function __fish_command_not_found_handler --on-event fish_command_not_found
__fish_default_command_not_found_handler $argv[1]
end
end
end
...
18 1554 --> if not set -q __fish_init_3_x
# Perform transitions relevant to going from fish 2.x to 3.x.
# Migrate old universal abbreviations to the new scheme.
__fish_abbr_old | source
set -U __fish_init_3_x
...
14 14 ---> not set -q __fish_init_3_x
178 1476 ---> __fish_abbr_old | source
915 935 ----> source /usr/share/fish/functions/__fish_abbr_old.fish
14 14 -----> function __fish_abbr_old --description "Manage abbreviations using old fish 2.x scheme."
# parse arguments
set -l mode
set -l mode_flag # the flag that was specified, for better errors
set -l mode_arg
set -l needs_arg no
while set -q argv[1]
set -l new_mode
switch $argv[1]
case '-h' '--help'
__fish_print_help abbr
return 0
case '-a' '--add'
set new_mode add
set needs_arg multi
case '-r' '--rename'
set new_mode rename
set needs_arg double
case '-e' '--erase'
set new_mode erase
set needs_arg single
case '-l' '--list'
set new_mode list
case '-s' '--show'
set new_mode show
case '--'
set -e argv[1]
break
case '-*'
printf ( _ "%s: invalid option -- %s\n" ) abbr $argv[1] >&2
return 1
case '*'
break
end
if test -n "$mode" -a -n "$new_mode"
# we're trying to set two different modes
printf ( _ "%s: %s cannot be specified along with %s\n" ) abbr $argv[1] $mode_flag >&2
return 1
end
set mode $new_mode
set mode_flag $argv[1]
set -e argv[1]
end
# If run with no options, treat it like --add if we have an argument, or
# --show if we do not have an argument
if not set -q mode[1]
if set -q argv[1]
set mode add
set needs_arg multi
else
set mode show
end
end
if test $needs_arg = single
set mode_arg $argv[1]
set needs_arg no
set -e argv[1]
else if test $needs_arg = double
# Pull the two parameters from argv.
# * leave argv non-empty, if there are more than two arguments
# * leave needs_arg set to double if there is not enough arguments
if set -q argv[1]
set param1 $argv[1]
set -e argv[1]
if set -q argv[1]
set param2 $argv[1]
set needs_arg no
set -e argv[1]
end
end
else if test $needs_arg = multi
set mode_arg $argv
set needs_arg no
set -e argv
end
if test $needs_arg != no
printf ( _ "%s: option requires an argument -- %s\n" ) abbr $mode_flag >&2
return 1
end
# none of our modes want any excess arguments
if set -q argv[1]
printf ( _ "%s: Unexpected argument -- %s\n" ) abbr $argv[1] >&2
return 1
end
switch $mode
case 'add'
# Convert from old "key=value" syntax
# TODO: This should be removed later
if not set -q mode_arg[2]
and string match -qr '^[^ ]+=' -- $mode_arg
set mode_arg (string split "=" -- $mode_arg)
end
# Bail out early if the exact abbr is already in
set -q fish_user_abbreviations
and contains -- "$mode_arg" $fish_user_abbreviations
and return 0
set -l key $mode_arg[1]
set -e mode_arg[1]
set -l value "$mode_arg"
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $key
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
if test -z "$value"
printf ( _ "%s: abbreviation must have a value\n" ) abbr >&2
return 1
end
if set -l idx (__fish_abbr_get_by_key $key)
# erase the existing abbreviation
set -e fish_user_abbreviations[$idx]
end
if not set -q fish_user_abbreviations
# initialize as a universal variable, so we can skip the -U later
# and therefore work properly if someone sets this as a global variable
set -U fish_user_abbreviations
end
set fish_user_abbreviations $fish_user_abbreviations "$key $value"
return 0
case 'rename'
set -l old_name $param1
set -l new_name $param2
# if the target name already exists, throw an error
if set -l idx (__fish_abbr_get_by_key $new_name)
printf ( _ "%s: abbreviation '%s' already exists, cannot rename\n" ) abbr $new_name >&2
return 2
end
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $new_name
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
set -l idx (__fish_abbr_get_by_key $old_name)
or begin
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $old_name >&2
return 2
end
set -l value (string split " " -m 1 -- $fish_user_abbreviations[$idx])[2]
set fish_user_abbreviations[$idx] "$new_name $value"
return 0
case 'erase'
if set -l idx (__fish_abbr_get_by_key $mode_arg)
set -e fish_user_abbreviations[$idx]
return 0
else
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $mode_arg >&2
return 2
end
case 'show'
for i in $fish_user_abbreviations
set -l opt_double_dash
set -l kv (string split " " -m 1 -- $i)
set -l key $kv[1]
set -l value $kv[2]
# Check to see if either key or value has a leading dash
# If so, we need to write --
string match -q -- '-*' $key $value
and set opt_double_dash '--'
echo abbr $opt_double_dash (string escape -- $key $value)
end
return 0
case 'list'
for i in $fish_user_abbreviations
set -l key (string split " " -m 1 -- $i)[1]
printf "%s\n" $key
end
return 0
end
...
6 6 -----> function __fish_abbr_get_by_key
if not set -q argv[1]
echo "__fish_abbr_get_by_key: expected one argument, got none" >&2
return 2
end
set -q fish_user_abbreviations
or return 1
# Going through all entries is still quicker than calling `seq`
set -l keys
for kv in $fish_user_abbreviations
# If this does not match, we have screwed up before and the error should be reported
set keys $keys (string split " " -m 1 -- $kv)[1]
end
if set -l idx (contains -i -- $argv[1] $keys)
echo $idx
return 0
end
return 1
...
18 18 ----> set -l mode
12 12 ----> set -l mode_flag
12 12 ----> set -l mode_arg
13 13 ----> set -l needs_arg no
3 15 ----> while set -q argv[1]
set -l new_mode
switch $argv[1]
case '-h' '--help'
__fish_print_help abbr
return 0
case '-a' '--add'
set new_mode add
set needs_arg multi
case '-r' '--rename'
set new_mode rename
set needs_arg double
case '-e' '--erase'
set new_mode erase
set needs_arg single
case '-l' '--list'
set new_mode list
case '-s' '--show'
set new_mode show
case '--'
set -e argv[1]
break
case '-*'
printf ( _ "%s: invalid option -- %s\n" ) abbr $argv[1] >&2
return 1
case '*'
break
end
if test -n "$mode" -a -n "$new_mode"
# we're trying to set two different modes
printf ( _ "%s: %s cannot be specified along with %s\n" ) abbr $argv[1] $mode_flag >&2
return 1
end
set mode $new_mode
set mode_flag $argv[1]
set -e argv[1]
...
12 12 -----> set -q argv[1]
9 84 ----> if not set -q mode[1]
if set -q argv[1]
set mode add
set needs_arg multi
else
set mode show
end
...
10 10 -----> not set -q mode[1]
11 65 -----> if set -q argv[1]
set mode add
set needs_arg multi
else
set mode show
...
14 14 ------> set -q argv[1]
40 40 ------> set mode show
13 83 ----> if test $needs_arg = single
set mode_arg $argv[1]
set needs_arg no
set -e argv[1]
else if test $needs_arg = double
# Pull the two parameters from argv.
# * leave argv non-empty, if there are more than two arguments
# * leave needs_arg set to double if there is not enough arguments
if set -q argv[1]
set param1 $argv[1]
set -e argv[1]
if set -q argv[1]
set param2 $argv[1]
set needs_arg no
set -e argv[1]
end
end
else if test $needs_arg = multi
set mode_arg $argv
set needs_arg no
set -e argv
...
27 27 -----> test $needs_arg = single
22 22 -----> test $needs_arg = double
21 21 -----> test $needs_arg = multi
4 27 ----> if test $needs_arg != no
printf ( _ "%s: option requires an argument -- %s\n" ) abbr $mode_flag >&2
return 1
...
23 23 -----> test $needs_arg != no
5 22 ----> if set -q argv[1]
printf ( _ "%s: Unexpected argument -- %s\n" ) abbr $argv[1] >&2
return 1
...
17 17 -----> set -q argv[1]
38 77 ----> switch $mode
case 'add'
# Convert from old "key=value" syntax
# TODO: This should be removed later
if not set -q mode_arg[2]
and string match -qr '^[^ ]+=' -- $mode_arg
set mode_arg (string split "=" -- $mode_arg)
end
# Bail out early if the exact abbr is already in
set -q fish_user_abbreviations
and contains -- "$mode_arg" $fish_user_abbreviations
and return 0
set -l key $mode_arg[1]
set -e mode_arg[1]
set -l value "$mode_arg"
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $key
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
if test -z "$value"
printf ( _ "%s: abbreviation must have a value\n" ) abbr >&2
return 1
end
if set -l idx (__fish_abbr_get_by_key $key)
# erase the existing abbreviation
set -e fish_user_abbreviations[$idx]
end
if not set -q fish_user_abbreviations
# initialize as a universal variable, so we can skip the -U later
# and therefore work properly if someone sets this as a global variable
set -U fish_user_abbreviations
end
set fish_user_abbreviations $fish_user_abbreviations "$key $value"
return 0
case 'rename'
set -l old_name $param1
set -l new_name $param2
# if the target name already exists, throw an error
if set -l idx (__fish_abbr_get_by_key $new_name)
printf ( _ "%s: abbreviation '%s' already exists, cannot rename\n" ) abbr $new_name >&2
return 2
end
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $new_name
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
set -l idx (__fish_abbr_get_by_key $old_name)
or begin
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $old_name >&2
return 2
end
set -l value (string split " " -m 1 -- $fish_user_abbreviations[$idx])[2]
set fish_user_abbreviations[$idx] "$new_name $value"
return 0
case 'erase'
if set -l idx (__fish_abbr_get_by_key $mode_arg)
set -e fish_user_abbreviations[$idx]
return 0
else
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $mode_arg >&2
return 2
end
case 'show'
for i in $fish_user_abbreviations
set -l opt_double_dash
set -l kv (string split " " -m 1 -- $i)
set -l key $kv[1]
set -l value $kv[2]
# Check to see if either key or value has a leading dash
# If so, we need to write --
string match -q -- '-*' $key $value
and set opt_double_dash '--'
echo abbr $opt_double_dash (string escape -- $key $value)
end
return 0
case 'list'
for i in $fish_user_abbreviations
set -l key (string split " " -m 1 -- $i)[1]
printf "%s\n" $key
end
return 0
...
22 22 -----> for i in $fish_user_abbreviations
set -l opt_double_dash
set -l kv (string split " " -m 1 -- $i)
set -l key $kv[1]
set -l value $kv[2]
# Check to see if either key or value has a leading dash
# If so, we need to write --
string match -q -- '-*' $key $value
and set opt_double_dash '--'
echo abbr $opt_double_dash (string escape -- $key $value)
...
17 17 -----> return 0
46 46 ---> set -U __fish_init_3_x
5 22 --> if set -q __fish_config_interactive_done
return
...
17 17 ---> set -q __fish_config_interactive_done
17 17 --> set -g __fish_config_interactive_done
11 11 --> set -g __fish_active_key_bindings
27 27 --> set -l userdatadir ~/.local/share
4 18 --> if set -q XDG_DATA_HOME
set userdatadir $XDG_DATA_HOME
...
14 14 ---> set -q XDG_DATA_HOME
18 704 --> if not set -q fish_greeting
set -l line1 (_ 'Welcome to fish, the friendly interactive shell')
set -l line2 ''
if not set -q __fish_init_2_3_0
set line2 \n(_ 'Type `help` for instructions on how to use fish')
end
set -U fish_greeting "$line1$line2"
...
14 14 ---> not set -q fish_greeting
63 454 ---> set -l line1 (_ 'Welcome to fish, the friendly interactive shell')
97 391 ----> _ 'Welcome to fish, the friendly interactive shell'
100 270 -----> source /usr/share/fish/functions/_.fish
8 170 ------> if command -sq gettext
function _ --description "Alias for the gettext command"
command gettext fish $argv
end
else
function _ --description "Fallback alias for the gettext command"
echo -n $argv
end
...
146 146 -------> command -sq gettext
16 16 -------> function _ --description "Fallback alias for the gettext command"
echo -n $argv
...
24 24 -----> echo -n $argv
14 14 ---> set -l line2 ''
2 13 ---> if not set -q __fish_init_2_3_0
set line2 \n(_ 'Type `help` for instructions on how to use fish')
...
11 11 ----> not set -q __fish_init_2_3_0
191 191 ---> set -U fish_greeting "$line1$line2"
3 16 --> if set -q fish_private_mode
set -l line (_ "fish is running in private mode, history will not be persisted.")
set -g fish_greeting $fish_greeting.\n$line
...
13 13 ---> set -q fish_private_mode
152 3773 --> if not set -q __fish_init_2_39_8
# Regular syntax highlighting colors
set -q fish_color_normal
or set -U fish_color_normal normal
set -q fish_color_command
or set -U fish_color_command 005fd7
set -q fish_color_param
or set -U fish_color_param 00afff
set -q fish_color_redirection
or set -U fish_color_redirection 00afff
set -q fish_color_comment
or set -U fish_color_comment 990000
set -q fish_color_error
or set -U fish_color_error ff0000
set -q fish_color_escape
or set -U fish_color_escape 00a6b2
set -q fish_color_operator
or set -U fish_color_operator 00a6b2
set -q fish_color_end
or set -U fish_color_end 009900
set -q fish_color_quote
or set -U fish_color_quote 999900
set -q fish_color_autosuggestion
or set -U fish_color_autosuggestion 555 brblack
set -q fish_color_user
or set -U fish_color_user brgreen
set -q fish_color_host
or set -U fish_color_host normal
set -q fish_color_valid_path
or set -U fish_color_valid_path --underline
set -q fish_color_cwd
or set -U fish_color_cwd green
set -q fish_color_cwd_root
or set -U fish_color_cwd_root red
# Background color for matching quotes and parenthesis
set -q fish_color_match
or set -U fish_color_match --background=brblue
# Background color for search matches
set -q fish_color_search_match
or set -U fish_color_search_match bryellow --background=brblack
# Background color for selections
set -q fish_color_selection
or set -U fish_color_selection white --bold --background=brblack
set -q fish_color_cancel
or set -U fish_color_cancel -r
# Pager colors
set -q fish_pager_color_prefix
or set -U fish_pager_color_prefix white --bold --underline
set -q fish_pager_color_completion
or set -U fish_pager_color_completion
set -q fish_pager_color_description
or set -U fish_pager_color_description B3A06D yellow
set -q fish_pager_color_progress
or set -U fish_pager_color_progress brwhite --background=cyan
#
# Directory history colors
#
set -q fish_color_history_current
or set -U fish_color_history_current --bold
set -U __fish_init_2_39_8
...
9 9 ---> not set -q __fish_init_2_39_8
8 8 ---> set -q fish_color_normal
114 114 ---> set -U fish_color_normal normal
12 12 ---> set -q fish_color_command
102 102 ---> set -U fish_color_command 005fd7
12 12 ---> set -q fish_color_param
100 100 ---> set -U fish_color_param 00afff
12 12 ---> set -q fish_color_redirection
101 101 ---> set -U fish_color_redirection 00afff
12 12 ---> set -q fish_color_comment
102 102 ---> set -U fish_color_comment 990000
12 12 ---> set -q fish_color_error
106 106 ---> set -U fish_color_error ff0000
12 12 ---> set -q fish_color_escape
127 127 ---> set -U fish_color_escape 00a6b2
12 12 ---> set -q fish_color_operator
109 109 ---> set -U fish_color_operator 00a6b2
13 13 ---> set -q fish_color_end
110 110 ---> set -U fish_color_end 009900
12 12 ---> set -q fish_color_quote
112 112 ---> set -U fish_color_quote 999900
11 11 ---> set -q fish_color_autosuggestion
115 115 ---> set -U fish_color_autosuggestion 555 brblack
12 12 ---> set -q fish_color_user
118 118 ---> set -U fish_color_user brgreen
12 12 ---> set -q fish_color_host
161 161 ---> set -U fish_color_host normal
13 13 ---> set -q fish_color_valid_path
158 158 ---> set -U fish_color_valid_path --underline
13 13 ---> set -q fish_color_cwd
128 128 ---> set -U fish_color_cwd green
13 13 ---> set -q fish_color_cwd_root
127 127 ---> set -U fish_color_cwd_root red
12 12 ---> set -q fish_color_match
129 129 ---> set -U fish_color_match --background=brblue
12 12 ---> set -q fish_color_search_match
136 136 ---> set -U fish_color_search_match bryellow --background=brblack
12 12 ---> set -q fish_color_selection
146 146 ---> set -U fish_color_selection white --bold --background=brblack
12 12 ---> set -q fish_color_cancel
161 161 ---> set -U fish_color_cancel -r
14 14 ---> set -q fish_pager_color_prefix
178 178 ---> set -U fish_pager_color_prefix white --bold --underline
19 19 ---> set -q fish_pager_color_completion
110 110 ---> set -U fish_pager_color_completion
12 12 ---> set -q fish_pager_color_description
117 117 ---> set -U fish_pager_color_description B3A06D yellow
12 12 ---> set -q fish_pager_color_progress
165 165 ---> set -U fish_pager_color_progress brwhite --background=cyan
12 12 ---> set -q fish_color_history_current
187 187 ---> set -U fish_color_history_current --bold
85 85 ---> set -U __fish_init_2_39_8
25 890 --> if not set -q FISH_UNIT_TESTS_RUNNING
if not test -d $userdatadir/fish/generated_completions
# Generating completions from man pages needs python (see issue #3588).
# We cannot simply do `fish_update_completions &` because it is a function.
# We cannot do `eval` since it is a function.
# We don't want to call `fish -c` since that is unnecessary and sources config.fish again.
# Hence we'll call python directly.
# c_m_p.py should work with any python version.
set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
for py in python{3,2,}
if command -sq $py
$py $update_args >/dev/null 2>&1 &
break
end
end
end
...
12 12 ---> not set -q FISH_UNIT_TESTS_RUNNING
16 853 ---> if not test -d $userdatadir/fish/generated_completions
# Generating completions from man pages needs python (see issue #3588).
# We cannot simply do `fish_update_completions &` because it is a function.
# We cannot do `eval` since it is a function.
# We don't want to call `fish -c` since that is unnecessary and sources config.fish again.
# Hence we'll call python directly.
# c_m_p.py should work with any python version.
set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
for py in python{3,2,}
if command -sq $py
$py $update_args >/dev/null 2>&1 &
break
end
end
...
31 31 ----> not test -d $userdatadir/fish/generated_completions
28 28 ----> set -l update_args -B $__fish_data_dir/tools/create_manpage_completions.py --manpath --cleanup-in '~/.config/fish/completions' --cleanup-in '~/.config/fish/generated_completions'
30 778 ----> for py in python{3,2,}
if command -sq $py
$py $update_args >/dev/null 2>&1 &
break
end
...
23 748 -----> if command -sq $py
$py $update_args >/dev/null 2>&1 &
break
...
43 43 ------> command -sq $py
651 651 ------> $py $update_args >/dev/null 2>&1 &
31 31 ------> break
7 175 --> if status --is-interactive
if functions -q fish_greeting
fish_greeting
else
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
end
...
13 13 ---> status --is-interactive
15 155 ---> if functions -q fish_greeting
fish_greeting
else
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
# Keep it that way to not print superfluous newlines on old configuration
test -n "$fish_greeting"
and echo $fish_greeting
...
57 57 ----> functions -q fish_greeting
26 26 ----> test -n "$fish_greeting"
57 57 ----> echo $fish_greeting
28 28 --> function __fish_repaint --on-variable fish_color_cwd --description "Event handler, repaints the prompt when fish_color_cwd changes"
if status --is-interactive
set -e __fish_prompt_cwd
commandline -f repaint 2>/dev/null
end
...
19 19 --> function __fish_repaint_root --on-variable fish_color_cwd_root --description "Event handler, repaints the prompt when fish_color_cwd_root changes"
if status --is-interactive
set -e __fish_prompt_cwd
commandline -f repaint 2>/dev/null
end
...
6 32 --> if test -d /etc/init.d
complete -x -p "/etc/init.d/*" -a start --description 'Start service'
complete -x -p "/etc/init.d/*" -a stop --description 'Stop service'
complete -x -p "/etc/init.d/*" -a status --description 'Print service status'
complete -x -p "/etc/init.d/*" -a restart --description 'Stop and then start service'
complete -x -p "/etc/init.d/*" -a reload --description 'Reload service configuration'
...
26 26 ---> test -d /etc/init.d
54 54 --> complete -c [ --wraps test
14 14 --> function __fish_reload_key_bindings -d "Reload key bindings when binding variable change" --on-variable fish_key_bindings
# Make sure some key bindings are set
if not set -q fish_key_bindings
set -U fish_key_bindings fish_default_key_bindings
end
# Do nothing if the key bindings didn't actually change.
# This could be because the variable was set to the existing value
# or because it was a local variable.
# If fish_key_bindings is empty on the first run, we still need to set the defaults.
if test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
return
end
# Check if fish_key_bindings is a valid function.
# If not, either keep the previous bindings (if any) or revert to default.
# Also print an error so the user knows.
if not functions -q "$fish_key_bindings"
echo "There is no fish_key_bindings function called: '$fish_key_bindings'" >&2
# We need to see if this is a defined function, otherwise we'd be in an endless loop.
if functions -q $__fish_active_key_bindings
echo "Keeping $__fish_active_key_bindings" >&2
# Set the variable to the old value so this error doesn't happen again.
set fish_key_bindings $__fish_active_key_bindings
return 1
else if functions -q fish_default_key_bindings
echo "Reverting to default bindings" >&2
set fish_key_bindings fish_default_key_bindings
# Return because we are called again
return 0
else
# If we can't even find the default bindings, something is broken.
# Without it, we would eventually run into the stack size limit, but that'd print hundreds of duplicate lines
# so we should give up earlier.
echo "Cannot find fish_default_key_bindings, falling back to very simple bindings." >&2
echo "Most likely something is wrong with your installation." >&2
return 0
end
end
set -g __fish_active_key_bindings "$fish_key_bindings"
set -g fish_bind_mode default
if test "$fish_key_bindings" = fish_default_key_bindings
# Redirect stderr per #1155
fish_default_key_bindings 2>/dev/null
else
$fish_key_bindings 2>/dev/null
end
# Load user key bindings if they are defined
if functions --query fish_user_key_bindings >/dev/null
fish_user_key_bindings 2>/dev/null
end
...
40 6606 --> __fish_reload_key_bindings
29 6498 ---> if not set -q fish_key_bindings
set -U fish_key_bindings fish_default_key_bindings
...
12 12 ----> not set -q fish_key_bindings
199 6457 ----> set -U fish_key_bindings fish_default_key_bindings
54 6258 -----> __fish_reload_key_bindings VARIABLE SET fish_key_bindings
5 17 ------> if not set -q fish_key_bindings
set -U fish_key_bindings fish_default_key_bindings
...
12 12 -------> not set -q fish_key_bindings
4 35 ------> if test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
return
...
31 31 -------> test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
3 714 ------> if not functions -q "$fish_key_bindings"
echo "There is no fish_key_bindings function called: '$fish_key_bindings'" >&2
# We need to see if this is a defined function, otherwise we'd be in an endless loop.
if functions -q $__fish_active_key_bindings
echo "Keeping $__fish_active_key_bindings" >&2
# Set the variable to the old value so this error doesn't happen again.
set fish_key_bindings $__fish_active_key_bindings
return 1
else if functions -q fish_default_key_bindings
echo "Reverting to default bindings" >&2
set fish_key_bindings fish_default_key_bindings
# Return because we are called again
return 0
else
# If we can't even find the default bindings, something is broken.
# Without it, we would eventually run into the stack size limit, but that'd print hundreds of duplicate lines
# so we should give up earlier.
echo "Cannot find fish_default_key_bindings, falling back to very simple bindings." >&2
echo "Most likely something is wrong with your installation." >&2
return 0
end
...
119 711 -------> not functions -q "$fish_key_bindings"
575 592 --------> source /usr/share/fish/functions/fish_default_key_bindings.fish
17 17 ---------> function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fish"
if contains -- -h $argv
or contains -- --help $argv
echo "Sorry but this function doesn't support -h or --help"
return 1
end
if not set -q argv[1]
bind --erase --all --preset # clear earlier bindings, if any
if test "$fish_key_bindings" != "fish_default_key_bindings"
# Allow the user to set the variable universally
set -q fish_key_bindings
or set -g fish_key_bindings
# This triggers the handler, which calls us again and ensures the user_key_bindings
# are executed.
set fish_key_bindings fish_default_key_bindings
return
end
end
# Silence warnings about unavailable keys. See #4431, 4188
if not contains -- -s $argv
set argv "-s" $argv
end
# These are shell-specific bindings that we share with vi mode.
__fish_shared_key_bindings $argv
or return # protect against invalid $argv
# This is the default binding, i.e. the one used if no other binding matches
bind --preset $argv "" self-insert
or exit # protect against invalid $argv
bind --preset $argv \n execute
bind --preset $argv \r execute
bind --preset $argv \ck kill-line
bind --preset $argv \eOC forward-char
bind --preset $argv \eOD backward-char
bind --preset $argv \e\[C forward-char
bind --preset $argv \e\[D backward-char
bind --preset $argv -k right forward-char
bind --preset $argv -k left backward-char
bind --preset $argv -k dc delete-char
bind --preset $argv -k backspace backward-delete-char
bind --preset $argv \x7f backward-delete-char
# for PuTTY
# https://github.com/fish-shell/fish-shell/issues/180
bind --preset $argv \e\[1~ beginning-of-line
bind --preset $argv \e\[3~ delete-char
bind --preset $argv \e\[4~ end-of-line
# OS X SnowLeopard doesn't have these keys. Don't show an annoying error message.
bind --preset $argv -k home beginning-of-line 2>/dev/null
bind --preset $argv -k end end-of-line 2>/dev/null
bind --preset $argv \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-ctrl-delete
bind --preset $argv \ca beginning-of-line
bind --preset $argv \ce end-of-line
bind --preset $argv \ch backward-delete-char
bind --preset $argv \cp up-or-search
bind --preset $argv \cn down-or-search
bind --preset $argv \cf forward-char
bind --preset $argv \cb backward-char
bind --preset $argv \ct transpose-chars
bind --preset $argv \et transpose-words
bind --preset $argv \eu upcase-word
# This clashes with __fish_list_current_token
# bind --preset $argv \el downcase-word
bind --preset $argv \ec capitalize-word
# One of these is alt+backspace.
bind --preset $argv \e\x7f backward-kill-word
bind --preset $argv \e\b backward-kill-word
bind --preset $argv \eb backward-word
bind --preset $argv \ef forward-word
bind --preset $argv \e\[1\;5C forward-word
bind --preset $argv \e\[1\;5D backward-word
bind --preset $argv \e\< beginning-of-buffer
bind --preset $argv \e\> end-of-buffer
bind --preset $argv \ed kill-word
# Ignore some known-bad control sequences
# https://github.com/fish-shell/fish-shell/issues/1917
bind --preset $argv \e\[I 'begin;end'
bind --preset $argv \e\[O 'begin;end'
# term-specific special bindings
switch "$TERM"
case 'rxvt*'
bind --preset $argv \e\[8~ end-of-line
bind --preset $argv \eOc forward-word
bind --preset $argv \eOd backward-word
case 'xterm-256color'
# Microsoft's conemu uses xterm-256color plus
# the following to tell a console to paste:
bind --preset $argv \e\x20ep fish_clipboard_paste
end
...
27 27 ------> set -g __fish_active_key_bindings "$fish_key_bindings"
13 13 ------> set -g fish_bind_mode default
22 5332 ------> if test "$fish_key_bindings" = fish_default_key_bindings
# Redirect stderr per #1155
fish_default_key_bindings 2>/dev/null
else
$fish_key_bindings 2>/dev/null
...
16 16 -------> test "$fish_key_bindings" = fish_default_key_bindings
242 5294 -------> fish_default_key_bindings 2>/dev/null
6 33 --------> if contains -- -h $argv
or contains -- --help $argv
echo "Sorry but this function doesn't support -h or --help"
return 1
...
16 16 ---------> contains -- -h $argv
11 11 ---------> contains -- --help $argv
11 86 --------> if not set -q argv[1]
bind --erase --all --preset # clear earlier bindings, if any
if test "$fish_key_bindings" != "fish_default_key_bindings"
# Allow the user to set the variable universally
set -q fish_key_bindings
or set -g fish_key_bindings
# This triggers the handler, which calls us again and ensures the user_key_bindings
# are executed.
set fish_key_bindings fish_default_key_bindings
return
end
...
12 12 ---------> not set -q argv[1]
42 42 ---------> bind --erase --all --preset
2 21 ---------> if test "$fish_key_bindings" != "fish_default_key_bindings"
# Allow the user to set the variable universally
set -q fish_key_bindings
or set -g fish_key_bindings
# This triggers the handler, which calls us again and ensures the user_key_bindings
# are executed.
set fish_key_bindings fish_default_key_bindings
return
...
19 19 ----------> test "$fish_key_bindings" != "fish_default_key_bindings"
9 37 --------> if not contains -- -s $argv
set argv "-s" $argv
...
13 13 ---------> not contains -- -s $argv
15 15 ---------> set argv "-s" $argv
311 4095 --------> __fish_shared_key_bindings $argv
879 911 ---------> source /usr/share/fish/functions/__fish_shared_key_bindings.fish
14 14 ----------> function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mode"
# These are some bindings that are supposed to be shared between vi mode and default mode.
# They are supposed to be unrelated to text-editing (or movement).
# This takes $argv so the vi-bindings can pass the mode they are valid in.
if contains -- -h $argv
or contains -- --help $argv
echo "Sorry but this function doesn't support -h or --help"
return 1
end
bind --preset $argv \cy yank
or return # protect against invalid $argv
bind --preset $argv \ey yank-pop
# Left/Right arrow
bind --preset $argv -k right forward-char
bind --preset $argv -k left backward-char
bind --preset $argv \e\[C forward-char
bind --preset $argv \e\[D backward-char
# Some terminals output these when they're in in keypad mode.
bind --preset $argv \eOC forward-char
bind --preset $argv \eOD backward-char
bind --preset $argv -k ppage beginning-of-history
bind --preset $argv -k npage end-of-history
# Interaction with the system clipboard.
bind --preset $argv \cx fish_clipboard_copy
bind --preset $argv \cv fish_clipboard_paste
bind --preset $argv \e cancel
bind --preset $argv \t complete
bind --preset $argv \cs pager-toggle-search
# shift-tab does a tab complete followed by a search.
bind --preset $argv --key btab complete-and-search
bind --preset $argv \e\n "commandline -i \n"
bind --preset $argv \e\r "commandline -i \n"
bind --preset $argv -k down down-or-search
bind --preset $argv -k up up-or-search
bind --preset $argv \e\[A up-or-search
bind --preset $argv \e\[B down-or-search
bind --preset $argv \eOA up-or-search
bind --preset $argv \eOB down-or-search
# Alt-left/Alt-right
bind --preset $argv \e\eOC nextd-or-forward-word
bind --preset $argv \e\eOD prevd-or-backward-word
bind --preset $argv \e\e\[C nextd-or-forward-word
bind --preset $argv \e\e\[D prevd-or-backward-word
bind --preset $argv \eO3C nextd-or-forward-word
bind --preset $argv \eO3D prevd-or-backward-word
bind --preset $argv \e\[3C nextd-or-forward-word
bind --preset $argv \e\[3D prevd-or-backward-word
bind --preset $argv \e\[1\;3C nextd-or-forward-word
bind --preset $argv \e\[1\;3D prevd-or-backward-word
bind --preset $argv \e\[1\;9C nextd-or-forward-word #iTerm2
bind --preset $argv \e\[1\;9D prevd-or-backward-word #iTerm2
# Alt-up/Alt-down
bind --preset $argv \e\eOA history-token-search-backward
bind --preset $argv \e\eOB history-token-search-forward
bind --preset $argv \e\e\[A history-token-search-backward
bind --preset $argv \e\e\[B history-token-search-forward
bind --preset $argv \eO3A history-token-search-backward
bind --preset $argv \eO3B history-token-search-forward
bind --preset $argv \e\[3A history-token-search-backward
bind --preset $argv \e\[3B history-token-search-forward
bind --preset $argv \e\[1\;3A history-token-search-backward
bind --preset $argv \e\[1\;3B history-token-search-forward
bind --preset $argv \e\[1\;9A history-token-search-backward # iTerm2
bind --preset $argv \e\[1\;9B history-token-search-forward # iTerm2
# Bash compatibility
# https://github.com/fish-shell/fish-shell/issues/89
bind --preset $argv \e. history-token-search-backward
bind --preset $argv \el __fish_list_current_token
bind --preset $argv \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
# ncurses > 6.0 sends a "delete scrollback" sequence along with clear.
# This string replace removes it.
bind --preset $argv \cl 'echo -n (clear | string replace \e\[3J ""); commandline -f repaint'
bind --preset $argv \cc __fish_cancel_commandline
bind --preset $argv \cu backward-kill-line
bind --preset $argv \cw backward-kill-path-component
bind --preset $argv \e\[F end-of-line
bind --preset $argv \e\[H beginning-of-line
bind --preset $argv \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end'
bind --preset $argv \cd delete-or-exit
# Allow reading manpages by pressing F1 (many GUI applications) or Alt+h (like in zsh).
bind --preset $argv -k f1 __fish_man_page
bind --preset $argv \eh __fish_man_page
# This will make sure the output of the current command is paged using the default pager when
# you press Meta-p.
# If none is set, less will be used.
bind --preset $argv \ep '__fish_paginate'
# Make it easy to turn an unexecuted command into a comment in the shell history. Also,
# remove the commenting chars so the command can be further edited then executed.
bind --preset $argv \e\# __fish_toggle_comment_commandline
# The [meta-e] and [meta-v] keystrokes invoke an external editor on the command buffer.
bind --preset $argv \ee edit_command_buffer
bind --preset $argv \ev edit_command_buffer
# Support for "bracketed paste"
# The way it works is that we acknowledge our support by printing
# \e\[?2004h
# then the terminal will "bracket" every paste in
# \e\[200~ and \e\[201~
# Every character in between those two will be part of the paste and should not cause a binding to execute (like \n executing commands).
#
# We enable it after every command and disable it before (in __fish_config_interactive.fish)
#
# Support for this seems to be ubiquitous - emacs enables it unconditionally (!) since 25.1 (though it only supports it since then,
# it seems to be the last term to gain support).
# TODO: Should we disable this in older emacsen?
#
# NOTE: This is more of a "security" measure than a proper feature.
# The better way to paste remains the `fish_clipboard_paste` function (bound to \cv by default).
# We don't disable highlighting here, so it will be redone after every character (which can be slow),
# and it doesn't handle "paste-stop" sequences in the paste (which the terminal needs to strip, but KDE konsole doesn't).
#
# See http://thejh.net/misc/website-terminal-copy-paste. The second case will not be caught in KDE konsole.
# Bind the starting sequence in every bind mode, even user-defined ones.
# We usually just pass the text through as-is to facilitate pasting code,
# but when the current token contains an unbalanced single-quote (`'`),
# we escape all single-quotes and backslashes, effectively turning the paste
# into one literal token, to facilitate pasting non-code (e.g. markdown or git commitishes)
# Exclude paste mode or there'll be an additional binding after switching between emacs and vi
for mode in (bind --list-modes | string match -v paste)
bind --preset -M $mode -m paste \e\[200~ '__fish_start_bracketed_paste'
end
# This sequence ends paste-mode and returns to the previous mode we have saved before.
bind --preset -M paste \e\[201~ '__fish_stop_bracketed_paste'
# In paste-mode, everything self-inserts except for the sequence to get out of it
bind --preset -M paste "" self-insert
# Without this, a \r will overwrite the other text, rendering it invisible - which makes the exercise kinda pointless.
# TODO: Test this in windows (\r\n line endings)
bind --preset -M paste \r "commandline -i \n"
bind --preset -M paste "'" "__fish_commandline_insert_escaped \' \$__fish_paste_quoted"
bind --preset -M paste \\ "__fish_commandline_insert_escaped \\\ \$__fish_paste_quoted"
...
11 11 ----------> function __fish_commandline_insert_escaped --description 'Insert the first arg escaped if a second arg is given'
if set -q argv[2]
commandline -i \\$argv[1]
else
commandline -i $argv[1]
end
...
4 4 ----------> function __fish_start_bracketed_paste
# Save the last bind mode so we can restore it.
set -g __fish_last_bind_mode $fish_bind_mode
# If the token is currently single-quoted,
# we escape single-quotes (and backslashes).
__fish_commandline_is_singlequoted
and set -g __fish_paste_quoted 1
...
3 3 ----------> function __fish_stop_bracketed_paste
# Restore the last bind mode.
set fish_bind_mode $__fish_last_bind_mode
set -e __fish_paste_quoted
commandline -f force-repaint
...
6 35 ---------> if contains -- -h $argv
or contains -- --help $argv
echo "Sorry but this function doesn't support -h or --help"
return 1
...
17 17 ----------> contains -- -h $argv
12 12 ----------> contains -- --help $argv
18 18 ---------> bind --preset $argv \cy yank
16 16 ---------> bind --preset $argv \ey yank-pop
21 21 ---------> bind --preset $argv -k right forward-char
18 18 ---------> bind --preset $argv -k left backward-char
16 16 ---------> bind --preset $argv \e\[C forward-char
15 15 ---------> bind --preset $argv \e\[D backward-char
15 15 ---------> bind --preset $argv \eOC forward-char
15 15 ---------> bind --preset $argv \eOD backward-char
18 18 ---------> bind --preset $argv -k ppage beginning-of-history
18 18 ---------> bind --preset $argv -k npage end-of-history
16 16 ---------> bind --preset $argv \cx fish_clipboard_copy
15 15 ---------> bind --preset $argv \cv fish_clipboard_paste
15 15 ---------> bind --preset $argv \e cancel
15 15 ---------> bind --preset $argv \t complete
15 15 ---------> bind --preset $argv \cs pager-toggle-search
16 16 ---------> bind --preset $argv --key btab complete-and-search
17 17 ---------> bind --preset $argv \e\n "commandline -i \n"
17 17 ---------> bind --preset $argv \e\r "commandline -i \n"
19 19 ---------> bind --preset $argv -k down down-or-search
19 19 ---------> bind --preset $argv -k up up-or-search
16 16 ---------> bind --preset $argv \e\[A up-or-search
25 25 ---------> bind --preset $argv \e\[B down-or-search
15 15 ---------> bind --preset $argv \eOA up-or-search
14 14 ---------> bind --preset $argv \eOB down-or-search
16 16 ---------> bind --preset $argv \e\eOC nextd-or-forward-word
16 16 ---------> bind --preset $argv \e\eOD prevd-or-backward-word
16 16 ---------> bind --preset $argv \e\e\[C nextd-or-forward-word
16 16 ---------> bind --preset $argv \e\e\[D prevd-or-backward-word
27 27 ---------> bind --preset $argv \eO3C nextd-or-forward-word
27 27 ---------> bind --preset $argv \eO3D prevd-or-backward-word
18 18 ---------> bind --preset $argv \e\[3C nextd-or-forward-word
17 17 ---------> bind --preset $argv \e\[3D prevd-or-backward-word
18 18 ---------> bind --preset $argv \e\[1\;3C nextd-or-forward-word
16 16 ---------> bind --preset $argv \e\[1\;3D prevd-or-backward-word
17 17 ---------> bind --preset $argv \e\[1\;9C nextd-or-forward-word
17 17 ---------> bind --preset $argv \e\[1\;9D prevd-or-backward-word
18 18 ---------> bind --preset $argv \e\eOA history-token-search-backward
17 17 ---------> bind --preset $argv \e\eOB history-token-search-forward
17 17 ---------> bind --preset $argv \e\e\[A history-token-search-backward
16 16 ---------> bind --preset $argv \e\e\[B history-token-search-forward
16 16 ---------> bind --preset $argv \eO3A history-token-search-backward
16 16 ---------> bind --preset $argv \eO3B history-token-search-forward
17 17 ---------> bind --preset $argv \e\[3A history-token-search-backward
17 17 ---------> bind --preset $argv \e\[3B history-token-search-forward
18 18 ---------> bind --preset $argv \e\[1\;3A history-token-search-backward
17 17 ---------> bind --preset $argv \e\[1\;3B history-token-search-forward
17 17 ---------> bind --preset $argv \e\[1\;9A history-token-search-backward
18 18 ---------> bind --preset $argv \e\[1\;9B history-token-search-forward
17 17 ---------> bind --preset $argv \e. history-token-search-backward
16 16 ---------> bind --preset $argv \el __fish_list_current_token
19 19 ---------> bind --preset $argv \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
19 19 ---------> bind --preset $argv \cl 'echo -n (clear | string replace \e\[3J ""); commandline -f repaint'
16 16 ---------> bind --preset $argv \cc __fish_cancel_commandline
16 16 ---------> bind --preset $argv \cu backward-kill-line
16 16 ---------> bind --preset $argv \cw backward-kill-path-component
17 17 ---------> bind --preset $argv \e\[F end-of-line
17 17 ---------> bind --preset $argv \e\[H beginning-of-line
19 19 ---------> bind --preset $argv \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end'
16 16 ---------> bind --preset $argv \cd delete-or-exit
20 20 ---------> bind --preset $argv -k f1 __fish_man_page
17 17 ---------> bind --preset $argv \eh __fish_man_page
18 18 ---------> bind --preset $argv \ep '__fish_paginate'
17 17 ---------> bind --preset $argv \e\# __fish_toggle_comment_commandline
17 17 ---------> bind --preset $argv \ee edit_command_buffer
17 17 ---------> bind --preset $argv \ev edit_command_buffer
120 1609 ---------> for mode in (bind --list-modes | string match -v paste)
bind --preset -M $mode -m paste \e\[200~ '__fish_start_bracketed_paste'
...
1009 1429 ----------> bind --list-modes | string match -v paste
189 420 -----------> source /usr/share/fish/functions/string.fish
5 231 ------------> if not contains string (builtin -n)
function string
if not set -q __is_launched_without_string
if status --is-interactive
# We've been autoloaded after fish < 2.3.0 upgraded to >= 2.3.1 - no string builtin
set_color --bold >&2
echo "Fish has been upgraded, and the scripts on your system are not compatible" >&2
echo "with this prior instance of fish. You can probably run:" >&2
set_color green >&2
echo -e "\n exec fish" >&2
set_color normal >&2
echo "… to replace this process with a new one in-place." >&2
set -g __is_launched_without_string 1
end
end
set -p PATH $__fish_bin_dir
set string_cmd string \'$argv\'
if fish -c 'contains string (builtin -n)'
fish -c "$string_cmd"
else
return 127
end
end
...
173 226 -------------> not contains string (builtin -n)
53 53 --------------> builtin -n
60 60 ----------> bind --preset -M $mode -m paste \e\[200~ '__fish_start_bracketed_paste'
26 26 ---------> bind --preset -M paste \e\[201~ '__fish_stop_bracketed_paste'
16 16 ---------> bind --preset -M paste "" self-insert
26 26 ---------> bind --preset -M paste \r "commandline -i \n"
20 20 ---------> bind --preset -M paste "'" "__fish_commandline_insert_escaped \' \$__fish_paste_quoted"
18 18 ---------> bind --preset -M paste \\ "__fish_commandline_insert_escaped \\\ \$__fish_paste_quoted"
21 21 --------> bind --preset $argv "" self-insert
18 18 --------> bind --preset $argv \n execute
17 17 --------> bind --preset $argv \r execute
18 18 --------> bind --preset $argv \ck kill-line
17 17 --------> bind --preset $argv \eOC forward-char
17 17 --------> bind --preset $argv \eOD backward-char
17 17 --------> bind --preset $argv \e\[C forward-char
15 15 --------> bind --preset $argv \e\[D backward-char
23 23 --------> bind --preset $argv -k right forward-char
17 17 --------> bind --preset $argv -k left backward-char
21 21 --------> bind --preset $argv -k dc delete-char
19 19 --------> bind --preset $argv -k backspace backward-delete-char
16 16 --------> bind --preset $argv \x7f backward-delete-char
19 19 --------> bind --preset $argv \e\[1~ beginning-of-line
16 16 --------> bind --preset $argv \e\[3~ delete-char
18 18 --------> bind --preset $argv \e\[4~ end-of-line
37 37 --------> bind --preset $argv -k home beginning-of-line 2>/dev/null
24 24 --------> bind --preset $argv -k end end-of-line 2>/dev/null
21 21 --------> bind --preset $argv \e\[3\;2~ backward-delete-char
18 18 --------> bind --preset $argv \ca beginning-of-line
18 18 --------> bind --preset $argv \ce end-of-line
18 18 --------> bind --preset $argv \ch backward-delete-char
18 18 --------> bind --preset $argv \cp up-or-search
17 17 --------> bind --preset $argv \cn down-or-search
17 17 --------> bind --preset $argv \cf forward-char
17 17 --------> bind --preset $argv \cb backward-char
17 17 --------> bind --preset $argv \ct transpose-chars
19 19 --------> bind --preset $argv \et transpose-words
20 20 --------> bind --preset $argv \eu upcase-word
19 19 --------> bind --preset $argv \ec capitalize-word
18 18 --------> bind --preset $argv \e\x7f backward-kill-word
18 18 --------> bind --preset $argv \e\b backward-kill-word
18 18 --------> bind --preset $argv \eb backward-word
19 19 --------> bind --preset $argv \ef forward-word
21 21 --------> bind --preset $argv \e\[1\;5C forward-word
21 21 --------> bind --preset $argv \e\[1\;5D backward-word
19 19 --------> bind --preset $argv \e\< beginning-of-buffer
19 19 --------> bind --preset $argv \e\> end-of-buffer
17 17 --------> bind --preset $argv \ed kill-word
21 21 --------> bind --preset $argv \e\[I 'begin;end'
20 20 --------> bind --preset $argv \e\[O 'begin;end'
21 21 --------> switch "$TERM"
case 'rxvt*'
bind --preset $argv \e\[8~ end-of-line
bind --preset $argv \eOc forward-word
bind --preset $argv \eOd backward-word
case 'xterm-256color'
# Microsoft's conemu uses xterm-256color plus
# the following to tell a console to paste:
bind --preset $argv \e\x20ep fish_clipboard_paste
...
6 66 ------> if functions --query fish_user_key_bindings >/dev/null
fish_user_key_bindings 2>/dev/null
...
60 60 -------> functions --query fish_user_key_bindings >/dev/null
22 68 ---> if test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
return
...
38 38 ----> test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
8 8 ----> return
13 145 --> if not set -q FISH_UNIT_TESTS_RUNNING
# Enable bracketed paste before every prompt (see __fish_shared_bindings for the bindings).
# Disable it for unit tests so we don't have to add the sequences to bind.expect
function __fish_enable_bracketed_paste --on-event fish_prompt
printf "\e[?2004h"
end
# Disable BP before every command because that might not support it.
function __fish_disable_bracketed_paste --on-event fish_preexec --on-event fish_exit
printf "\e[?2004l"
end
# Tell the terminal we support BP. Since we are in __f_c_i, the first fish_prompt
# has already fired.
__fish_enable_bracketed_paste
...
13 13 ---> not set -q FISH_UNIT_TESTS_RUNNING
14 14 ---> function __fish_enable_bracketed_paste --on-event fish_prompt
printf "\e[?2004h"
...
10 10 ---> function __fish_disable_bracketed_paste --on-event fish_preexec --on-event fish_exit
printf "\e[?2004l"
...
42 95 ---> __fish_enable_bracketed_paste
53 53 ----> printf "\e[?2004h"
36 36 --> function __fish_winch_handler --on-signal WINCH -d "Repaint screen when window changes size"
commandline -f repaint >/dev/null 2>/dev/null
...
19 19 --> set -q VTE_VERSION
21 21 --> set -l VTE_VERSION 0
14 14 --> set -q TERM_PROGRAM
20 20 --> set -l TERM_PROGRAM
7 45 --> if test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
function __update_cwd_osc --on-variable PWD --description 'Notify capable terminals when $PWD changes'
if status --is-command-substitution
or set -q INSIDE_EMACS
return
end
printf \e\]7\;file://\%s\%s\a $hostname (string escape --style=url $PWD)
end
__update_cwd_osc # Run once because we might have already inherited a PWD from an old tab
...
38 38 ---> test "$VTE_VERSION" -ge 3405 -o "$TERM_PROGRAM" = "Apple_Terminal"
29 5485 --> if not type -q __fish_command_not_found_handler
# Read the OS/Distro from /etc/os-release.
# This has a "ID=" line that defines the exact distribution,
# and an "ID_LIKE=" line that defines what it is derived from or otherwise like.
# For our purposes, we use both.
set -l os
if test -r /etc/os-release
set os (string match -r '^ID(?:_LIKE)?\s*=.*' < /etc/os-release | \
string replace -r '^ID(?:_LIKE)?\s*=(.*)' '$1' | string trim -c '\'"' | string split " ")
end
# First check if we are on OpenSUSE since SUSE's handler has no options
# but the same name and path as Ubuntu's.
if contains -- suse $os
or contains -- sles $os
and type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/bin/command-not-found $argv[1]
end
# Check for Fedora's handler
else if test -f /usr/libexec/pk-command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/libexec/pk-command-not-found $argv[1]
end
# Check in /usr/lib, this is where modern Ubuntus place this command
else if test -f /usr/lib/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found -- $argv[1]
end
# Check for NixOS handler
else if test -f /run/current-system/sw/bin/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/run/current-system/sw/bin/command-not-found $argv
end
# Ubuntu Feisty places this command in the regular path instead
else if type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
command-not-found -- $argv[1]
end
# pkgfile is an optional, but official, package on Arch Linux
# it ships with example handlers for bash and zsh, so we'll follow that format
else if type -p -q pkgfile
function __fish_command_not_found_handler --on-event fish_command_not_found
set -l __packages (pkgfile --binaries --verbose -- $argv[1] 2>/dev/null)
if test $status -eq 0
printf "%s may be found in the following packages:\n" "$argv[1]"
printf " %s\n" $__packages
else
__fish_default_command_not_found_handler $argv[1]
end
end
# Use standard fish command not found handler otherwise
else
function __fish_command_not_found_handler --on-event fish_command_not_found
__fish_default_command_not_found_handler $argv[1]
end
end
...
178 1556 ---> not type -q __fish_command_not_found_handler
532 546 ----> source /usr/share/fish/functions/type.fish
14 14 -----> function type --description 'Print the type of a command'
# For legacy reasons, no argument simply causes an unsuccessful return.
set -q argv[1]
or return 1
set -l options 'h/help' 'a/all' 'f/no-functions' 't/type' 'p/path' 'P/force-path' 'q/quiet'
argparse -n type -x t,p,P $options -- $argv
or return
if set -q _flag_help
__fish_print_help type
return 0
end
set -l res 1
set -l mode normal
set -l multi no
set -l selection all
# Technically all four of these flags are mutually exclusive. However, we allow -q to be used
# with the other three because old versions of this function explicitly allowed it by making
# --quiet have precedence.
if set -q _flag_quiet
set mode quiet
else if set -q _flag_type
set mode type
else if set -q _flag_path
set mode path
else if set -q _flag_force_path
set mode path
set selection files
end
set -q _flag_all
and set multi yes
set -q _flag_no_functions
and set selection files
# Check all possible types for the remaining arguments.
for i in $argv
# Found will be set to 1 if a match is found.
set -l found 0
if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
end
set -l paths
if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
end
for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
end
if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
end
end
return $res
...
15 15 ----> set -q argv[1]
25 25 ----> set -l options 'h/help' 'a/all' 'f/no-functions' 't/type' 'p/path' 'P/force-path' 'q/quiet'
58 58 ----> argparse -n type -x t,p,P $options -- $argv
4 15 ----> if set -q _flag_help
__fish_print_help type
return 0
...
11 11 -----> set -q _flag_help
11 11 ----> set -l res 1
11 11 ----> set -l mode normal
29 29 ----> set -l multi no
13 13 ----> set -l selection all
12 30 ----> if set -q _flag_quiet
set mode quiet
else if set -q _flag_type
set mode type
else if set -q _flag_path
set mode path
else if set -q _flag_force_path
set mode path
set selection files
...
8 8 -----> set -q _flag_quiet
10 10 -----> set mode quiet
9 9 ----> set -q _flag_all
9 9 ----> set -q _flag_no_functions
29 593 ----> for i in $argv
# Found will be set to 1 if a match is found.
set -l found 0
if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
end
set -l paths
if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
end
for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
end
if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
end
...
12 12 -----> set -l found 0
12 285 -----> if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
...
16 16 ------> test $selection != files
5 56 ------> if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
...
51 51 -------> functions -q -- $i
6 201 ------> if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
...
147 195 -------> contains -- $i (builtin -n)
48 48 --------> builtin -n
14 14 -----> set -l paths
10 206 -----> if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
...
14 14 ------> test $multi != yes
48 182 ------> set paths (command -s -- $i)
134 134 -------> command -s -- $i
12 12 -----> for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
...
8 35 -----> if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
...
14 14 ------> test $found = 0
13 13 ------> test $mode != quiet
14 14 ----> return $res
11 11 ---> set -l os
13 1957 ---> if test -r /etc/os-release
set os (string match -r '^ID(?:_LIKE)?\s*=.*' < /etc/os-release | \
string replace -r '^ID(?:_LIKE)?\s*=(.*)' '$1' | string trim -c '\'"' | string split " ")
...
17 17 ----> test -r /etc/os-release
115 1927 ----> set os (string match -r '^ID(?:_LIKE)?\s*=.*' < /etc/os-release | \
string replace -r '^ID(?:_LIKE)?\s*=(.*)' '$1' | string trim -c '\'"' | string split " ")
1812 1812 -----> string match -r '^ID(?:_LIKE)?\s*=.*' < /etc/os-release | \
string replace -r '^ID(?:_LIKE)?\s*=(.*)' '$1' | string trim -c '\'"' | string split " "
36 1932 ---> if contains -- suse $os
or contains -- sles $os
and type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/bin/command-not-found $argv[1]
end
# Check for Fedora's handler
else if test -f /usr/libexec/pk-command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/libexec/pk-command-not-found $argv[1]
end
# Check in /usr/lib, this is where modern Ubuntus place this command
else if test -f /usr/lib/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found -- $argv[1]
end
# Check for NixOS handler
else if test -f /run/current-system/sw/bin/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/run/current-system/sw/bin/command-not-found $argv
end
# Ubuntu Feisty places this command in the regular path instead
else if type -q command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
command-not-found -- $argv[1]
end
# pkgfile is an optional, but official, package on Arch Linux
# it ships with example handlers for bash and zsh, so we'll follow that format
else if type -p -q pkgfile
function __fish_command_not_found_handler --on-event fish_command_not_found
set -l __packages (pkgfile --binaries --verbose -- $argv[1] 2>/dev/null)
if test $status -eq 0
printf "%s may be found in the following packages:\n" "$argv[1]"
printf " %s\n" $__packages
else
__fish_default_command_not_found_handler $argv[1]
end
end
# Use standard fish command not found handler otherwise
else
function __fish_command_not_found_handler --on-event fish_command_not_found
__fish_default_command_not_found_handler $argv[1]
end
...
30 30 ----> contains -- suse $os
13 13 ----> contains -- sles $os
22 22 ----> test -f /usr/libexec/pk-command-not-found
14 14 ----> test -f /usr/lib/command-not-found
21 21 ----> test -f /run/current-system/sw/bin/command-not-found
87 945 ----> type -q command-not-found
15 15 -----> set -q argv[1]
30 30 -----> set -l options 'h/help' 'a/all' 'f/no-functions' 't/type' 'p/path' 'P/force-path' 'q/quiet'
62 62 -----> argparse -n type -x t,p,P $options -- $argv
29 40 -----> if set -q _flag_help
__fish_print_help type
return 0
...
11 11 ------> set -q _flag_help
14 14 -----> set -l res 1
11 11 -----> set -l mode normal
11 11 -----> set -l multi no
11 11 -----> set -l selection all
12 30 -----> if set -q _flag_quiet
set mode quiet
else if set -q _flag_type
set mode type
else if set -q _flag_path
set mode path
else if set -q _flag_force_path
set mode path
set selection files
...
8 8 ------> set -q _flag_quiet
10 10 ------> set mode quiet
9 9 -----> set -q _flag_all
9 9 -----> set -q _flag_no_functions
35 602 -----> for i in $argv
# Found will be set to 1 if a match is found.
set -l found 0
if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
end
set -l paths
if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
end
for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
end
if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
end
...
11 11 ------> set -l found 0
12 304 ------> if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
...
14 14 -------> test $selection != files
5 54 -------> if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
...
49 49 --------> functions -q -- $i
5 224 -------> if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
...
166 219 --------> contains -- $i (builtin -n)
53 53 ---------> builtin -n
14 14 ------> set -l paths
10 192 ------> if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
...
15 15 -------> test $multi != yes
49 167 -------> set paths (command -s -- $i)
118 118 --------> command -s -- $i
11 11 ------> for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
...
9 35 ------> if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
...
14 14 -------> test $found = 0
12 12 -------> test $mode != quiet
14 14 -----> return $res
78 838 ----> type -p -q pkgfile
11 11 -----> set -q argv[1]
24 24 -----> set -l options 'h/help' 'a/all' 'f/no-functions' 't/type' 'p/path' 'P/force-path' 'q/quiet'
54 54 -----> argparse -n type -x t,p,P $options -- $argv
4 14 -----> if set -q _flag_help
__fish_print_help type
return 0
...
10 10 ------> set -q _flag_help
10 10 -----> set -l res 1
11 11 -----> set -l mode normal
11 11 -----> set -l multi no
10 10 -----> set -l selection all
22 40 -----> if set -q _flag_quiet
set mode quiet
else if set -q _flag_type
set mode type
else if set -q _flag_path
set mode path
else if set -q _flag_force_path
set mode path
set selection files
...
8 8 ------> set -q _flag_quiet
10 10 ------> set mode quiet
14 14 -----> set -q _flag_all
8 8 -----> set -q _flag_no_functions
28 540 -----> for i in $argv
# Found will be set to 1 if a match is found.
set -l found 0
if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
end
set -l paths
if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
end
for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
end
if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
end
...
12 12 ------> set -l found 0
15 262 ------> if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
...
14 14 -------> test $selection != files
5 44 -------> if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
...
39 39 --------> functions -q -- $i
5 189 -------> if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
...
142 184 --------> contains -- $i (builtin -n)
42 42 ---------> builtin -n
13 13 ------> set -l paths
17 181 ------> if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
...
14 14 -------> test $multi != yes
45 150 -------> set paths (command -s -- $i)
105 105 --------> command -s -- $i
10 10 ------> for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
...
8 34 ------> if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
...
14 14 -------> test $found = 0
12 12 -------> test $mode != quiet
13 13 -----> return $res
13 13 ----> function __fish_command_not_found_handler --on-event fish_command_not_found
__fish_default_command_not_found_handler $argv[1]
...
14 14 -> functions -e __fish_on_interactive
159 171 > source /usr/share/fish/functions/fish_prompt.fish
12 12 -> function fish_prompt --description "Write out the prompt"
set -l color_cwd
set -l suffix
switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
end
echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
...
66 77 > source /usr/share/fish/functions/fish_mode_prompt.fish
11 11 -> function fish_mode_prompt --description "Displays the current mode"
# To reuse the mode indicator use this function instead
fish_default_mode_prompt
...
22 334 > fish_mode_prompt
82 312 -> fish_default_mode_prompt
150 162 --> source /usr/share/fish/functions/fish_default_mode_prompt.fish
12 12 ---> function fish_default_mode_prompt --description "Display the default mode for the prompt"
# Do nothing if not in vi mode
if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
end
...
8 68 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
43 43 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
17 17 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
44 1557 > fish_prompt
22 22 -> set -l color_cwd
20 20 -> set -l suffix
27 62 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
21 21 --> set color_cwd $fish_color_cwd
14 14 --> set suffix '>'
232 1409 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
127 338 --> prompt_hostname
97 108 ---> source /usr/share/fish/functions/prompt_hostname.fish
11 11 ----> function prompt_hostname
# return the short hostname only by default (#4804)
string replace -r "\..*" "" $hostname
...
103 103 ---> string replace -r "\..*" "" $hostname
100 100 --> set_color $color_cwd
137 681 --> prompt_pwd
226 243 ---> source /usr/share/fish/functions/prompt_pwd.fish
17 17 ----> function prompt_pwd --description "Print the current working directory, shortened to fit the prompt"
set -l options 'h/help'
argparse -n prompt_pwd --max-args=0 $options -- $argv
or return
if set -q _flag_help
__fish_print_help prompt_pwd
return 0
end
# This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it
set -q fish_prompt_pwd_dir_length
or set -l fish_prompt_pwd_dir_length 1
# Replace $HOME with "~"
set realhome ~
set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
end
...
21 21 ---> set -l options 'h/help'
30 30 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
4 16 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
12 12 ----> set -q _flag_help
10 10 ---> set -q fish_prompt_pwd_dir_length
14 14 ---> set -l fish_prompt_pwd_dir_length 1
21 21 ---> set realhome ~
60 110 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
50 50 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
11 79 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
26 26 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
42 42 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
58 58 --> set_color normal
23 155 > fish_title
77 132 -> echo (status current-command) " " (__fish_pwd)
16 16 --> status current-command
25 39 --> __fish_pwd
14 14 ---> pwd
36 152 > fish_mode_prompt
50 116 -> fish_default_mode_prompt
9 66 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
39 39 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
18 18 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
38 798 > fish_prompt
18 18 -> set -l color_cwd
13 13 -> set -l suffix
25 56 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
18 18 --> set color_cwd $fish_color_cwd
13 13 --> set suffix '>'
178 673 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
24 69 --> prompt_hostname
45 45 ---> string replace -r "\..*" "" $hostname
36 36 --> set_color $color_cwd
65 361 --> prompt_pwd
20 20 ---> set -l options 'h/help'
31 31 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
3 15 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
12 12 ----> set -q _flag_help
10 10 ---> set -q fish_prompt_pwd_dir_length
13 13 ---> set -l fish_prompt_pwd_dir_length 1
21 21 ---> set realhome ~
60 104 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
44 44 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
11 82 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
26 26 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
45 45 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
29 29 --> set_color normal
25 148 > fish_title
73 123 -> echo (status current-command) " " (__fish_pwd)
16 16 --> status current-command
21 34 --> __fish_pwd
13 13 ---> pwd
531 16800 > __fish_describe_command zl
552 622 -> source /usr/share/fish/functions/__fish_describe_command.fish
70 70 --> function __fish_describe_command -d "Command used to find descriptions for commands"
# We're going to try to build a regex out of $argv inside awk.
# Make sure $argv has no special characters.
# TODO: stop interpolating argv into regex, and remove this hack.
string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv"
or return
type -q apropos; or return
apropos $argv 2>/dev/null | awk -v FS=" +- +" '{
split($1, names, ", ");
for (name in names)
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
sub( "( |\t)*\\\([18]\\\)", "", names[name] );
sub( " \\\[.*\\\]", "", names[name] );
print names[name] "\t" $2;
}
}'
...
209 209 -> string match --quiet --regex '^[a-zA-Z0-9_ ]+$' -- "$argv"
363 3243 -> type -q apropos
46 46 --> set -q argv[1]
88 88 --> set -l options 'h/help' 'a/all' 'f/no-functions' 't/type' 'p/path' 'P/force-path' 'q/quiet'
171 171 --> argparse -n type -x t,p,P $options -- $argv
17 55 --> if set -q _flag_help
__fish_print_help type
return 0
...
38 38 ---> set -q _flag_help
40 40 --> set -l res 1
39 39 --> set -l mode normal
39 39 --> set -l multi no
39 39 --> set -l selection all
40 107 --> if set -q _flag_quiet
set mode quiet
else if set -q _flag_type
set mode type
else if set -q _flag_path
set mode path
else if set -q _flag_force_path
set mode path
set selection files
...
30 30 ---> set -q _flag_quiet
37 37 ---> set mode quiet
31 31 --> set -q _flag_all
57 57 --> set -q _flag_no_functions
130 2122 --> for i in $argv
# Found will be set to 1 if a match is found.
set -l found 0
if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
end
set -l paths
if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
end
for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
end
if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
end
...
45 45 ---> set -l found 0
63 1059 ---> if test $selection != files
if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
end
if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
end
...
55 55 ----> test $selection != files
15 199 ----> if functions -q -- $i
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a function with definition\n') $i
if isatty stdout
functions $i | fish_indent --ansi
else
functions $i | fish_indent
end
case type
echo (_ 'function')
end
if test $multi != yes
continue
end
...
184 184 -----> functions -q -- $i
17 742 ----> if contains -- $i (builtin -n)
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is a builtin\n') $i
case type
echo (_ 'builtin')
end
if test $multi != yes
continue
end
...
588 725 -----> contains -- $i (builtin -n)
137 137 ------> builtin -n
47 47 ---> set -l paths
40 407 ---> if test $multi != yes
set paths (command -s -- $i)
else
set paths (command -sa -- $i)
...
50 50 ----> test $multi != yes
165 317 ----> set paths (command -s -- $i)
152 152 -----> command -s -- $i
99 348 ---> for path in $paths
set res 0
set found 1
switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
end
if test $multi != yes
continue
end
...
38 38 ----> set res 0
37 37 ----> set found 1
33 33 ----> switch $mode
case normal
printf (_ '%s is %s\n') $i $path
case type
echo (_ 'file')
case path
echo $path
...
43 141 ----> if test $multi != yes
continue
...
46 46 -----> test $multi != yes
52 52 -----> continue
22 86 ---> if test $found = 0
and test $mode != quiet
printf (_ "%s: Could not find '%s'\n") type $i >&2
...
64 64 ----> test $found = 0
46 46 --> return $res
12195 12195 -> apropos $argv 2>/dev/null | awk -v FS=" +- +" '{
split($1, names, ", ");
for (name in names)
if (names[name] ~ /^'"$argv"'.* *\([18]\)/ ) {
sub( "( |\t)*\\\([18]\\\)", "", names[name] );
sub( " \\\[.*\\\]", "", names[name] );
print names[name] "\t" $2;
}
}'
176 347 > __fish_disable_bracketed_paste '/home/teddy/Kod/z.lua/z.lua --init fish | source'
171 171 -> printf "\e[?2004l"
95 827 > fish_title /home/teddy/Kod/z.lua/z.lua\ --init\ fish\ \|\ source
395 732 -> echo (status current-command) " " (__fish_pwd)
59 59 --> status current-command
166 278 --> __fish_pwd
112 112 ---> pwd
15256 20252 > /home/teddy/Kod/z.lua/z.lua --init fish | source
65 65 -> set -x ZLUA_SCRIPT "/home/teddy/Kod/z.lua/z.lua"
26 26 -> set -x ZLUA_LUAEXE "/bin/lua"
16 16 -> function _zlua
set -l arg_mode ""
set -l arg_type ""
set -l arg_subdir ""
set -l arg_inter ""
set -l arg_strip ""
function _zlua_call; eval (string escape -- $argv); end
if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
end
while true
switch "$argv[1]"
case "-l"; set arg_mode "-l"
case "-e"; set arg_mode "-e"
case "-x"; set arg_mode "-x"
case "-t"; set arg_type "-t"
case "-r"; set arg_type "-r"
case "-c"; set arg_subdir "-c"
case "-s"; set arg_strip "-s"
case "-i"; set arg_inter "-i"
case "-I"; set arg_inter "-I"
case "-h"; set arg_mode "-h"
case "--help"; set arg_mode "-h"
case '*'; break
end
set -e argv[1]
end
if test "$arg_mode" = "-h"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -h
else if test "$arg_mode" = "-l"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -l $arg_subdir $arg_type $arg_strip $argv
else if test (count $argv) -eq 0
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -l $arg_subdir $arg_type $arg_strip $argv
else if test -n "$arg_mode"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" $arg_mode $arg_subdir $arg_type $arg_inter $argv
else
set -l dest (_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --cd $arg_type $arg_subdir $arg_inter $argv)
if test -n "$dest" -a -d "$dest"
if test -z "$_ZL_CD"
builtin cd "$dest"
else
_zlua_call "$_ZL_CD" "$dest"
end
end
if test -n "$_ZL_ECHO"; pwd; end
end
...
5 31 -> if test -z "$_ZL_CMD"; set -x _ZL_CMD z; ...
26 26 --> test -z "$_ZL_CMD"
299 4348 -> alias "$_ZL_CMD"=_zlua
691 715 --> source /usr/share/fish/functions/alias.fish
24 24 ---> function alias --description 'Creates a function wrapping a command'
set -l options 'h/help' 's/save'
argparse -n alias --max-args=2 $options -- $argv
or return
if set -q _flag_help
__fish_print_help alias
return 0
end
set -l name
set -l body
set -l prefix
set -l first_word
set -l wrapped_cmd
if not set -q argv[1]
# Print the known aliases.
for func in (functions -n)
set -l output (functions $func | string match -r -- "^function .* --description 'alias (.*)'")
if set -q output[2]
set output (string replace -r -- '^'$func'[= ]' '' $output[2])
echo alias $func (string escape -- $output[1])
end
end
return 0
else if not set -q argv[2]
# Alias definition of the form "name=value".
set -l tmp (string split -m 1 "=" -- $argv) ""
set name $tmp[1]
set body $tmp[2]
else
# Alias definition of the form "name value".
set name $argv[1]
set body $argv[2]
end
# sanity check
if test -z "$name"
printf ( _ "%s: Name cannot be empty\n") alias
return 1
else if test -z "$body"
printf ( _ "%s: Body cannot be empty\n") alias
return 1
end
# Extract the first command from the body. This is supposed to replace all non-escaped (i.e.
# preceded by an odd number of `\`) spaces with a newline so it splits on them. See issue #2220
# for why the following borderline incomprehensible code exists.
set -l tmp (string replace -ra -- "([^\\\ ])((\\\\\\\)*) " '$1\n' $body)
set first_word (string trim -- $tmp[1])
# If the user does something like `alias x 'foo; bar'` we need to strip the semicolon.
set base_command (string trim -c ';' -- $first_word)
if set -q tmp[2]
set body $tmp[2..-1]
else
set body
end
# Prevent the alias from immediately running into an infinite recursion if
# $body starts with the same command as $name.
if test $base_command = $name
if contains $name (builtin --names)
set prefix builtin
else
set prefix command
end
end
set -l cmd_string (string escape -- "alias $argv")
set wrapped_cmd (string join ' ' -- $first_word $body | string escape)
echo "function $name --wraps $wrapped_cmd --description $cmd_string; $prefix $first_word $body \$argv; end" | source
if set -q _flag_save
funcsave $name
end
#echo "function $name --wraps $wrapped_cmd --description $cmd_string; $prefix $first_word $body \$argv; end"
...
26 26 --> set -l options 'h/help' 's/save'
51 51 --> argparse -n alias --max-args=2 $options -- $argv
5 20 --> if set -q _flag_help
__fish_print_help alias
return 0
...
15 15 ---> set -q _flag_help
14 14 --> set -l name
12 12 --> set -l body
13 13 --> set -l prefix
15 15 --> set -l first_word
14 14 --> set -l wrapped_cmd
28 228 --> if not set -q argv[1]
# Print the known aliases.
for func in (functions -n)
set -l output (functions $func | string match -r -- "^function .* --description 'alias (.*)'")
if set -q output[2]
set output (string replace -r -- '^'$func'[= ]' '' $output[2])
echo alias $func (string escape -- $output[1])
end
end
return 0
else if not set -q argv[2]
# Alias definition of the form "name=value".
set -l tmp (string split -m 1 "=" -- $argv) ""
set name $tmp[1]
set body $tmp[2]
else
# Alias definition of the form "name value".
set name $argv[1]
set body $argv[2]
...
14 14 ---> not set -q argv[1]
11 11 ---> not set -q argv[2]
89 135 ---> set -l tmp (string split -m 1 "=" -- $argv) ""
46 46 ----> string split -m 1 "=" -- $argv
22 22 ---> set name $tmp[1]
18 18 ---> set body $tmp[2]
9 45 --> if test -z "$name"
printf ( _ "%s: Name cannot be empty\n") alias
return 1
else if test -z "$body"
printf ( _ "%s: Body cannot be empty\n") alias
return 1
...
20 20 ---> test -z "$name"
16 16 ---> test -z "$body"
77 156 --> set -l tmp (string replace -ra -- "([^\\\ ])((\\\\\\\)*) " '$1\n' $body)
79 79 ---> string replace -ra -- "([^\\\ ])((\\\\\\\)*) " '$1\n' $body
68 101 --> set first_word (string trim -- $tmp[1])
33 33 ---> string trim -- $tmp[1]
90 134 --> set base_command (string trim -c ';' -- $first_word)
44 44 ---> string trim -c ';' -- $first_word
13 43 --> if set -q tmp[2]
set body $tmp[2..-1]
else
set body
...
14 14 ---> set -q tmp[2]
16 16 ---> set body
7 41 --> if test $base_command = $name
if contains $name (builtin --names)
set prefix builtin
else
set prefix command
end
...
34 34 ---> test $base_command = $name
81 117 --> set -l cmd_string (string escape -- "alias $argv")
36 36 ---> string escape -- "alias $argv"
134 1087 --> set wrapped_cmd (string join ' ' -- $first_word $body | string escape)
953 953 ---> string join ' ' -- $first_word $body | string escape
1127 1184 --> echo "function $name --wraps $wrapped_cmd --description $cmd_string; $prefix $first_word $body \$argv; end" | source
57 57 ---> function z --wraps _zlua --description 'alias z=_zlua'; _zlua $argv; ...
7 33 --> if set -q _flag_save
funcsave $name
...
26 26 ---> set -q _flag_save
18 18 -> function _zlua_precmd --on-event fish_prompt
_zlua --add "$PWD" 2> /dev/null &
...
8 8 -> function _z_complete
eval "$_ZL_CMD" --complete (commandline -t)
...
133 133 -> complete -c $_ZL_CMD -f -a '(_z_complete)'
42 42 -> complete -c $_ZL_CMD -s 'r' -d 'cd to highest ranked dir matching'
30 30 -> complete -c $_ZL_CMD -s 'i' -d 'cd with interactive selection'
29 29 -> complete -c $_ZL_CMD -s 'I' -d 'cd with interactive selection using fzf'
84 84 -> complete -c $_ZL_CMD -s 't' -d 'cd to most recently accessed dir matching'
31 31 -> complete -c $_ZL_CMD -s 'l' -d 'list matches instead of cd'
27 27 -> complete -c $_ZL_CMD -s 'c' -d 'restrict matches to subdirs of $PWD'
27 27 -> complete -c $_ZL_CMD -s 'e' -d 'echo the best match, don''t cd'
28 28 -> complete -c $_ZL_CMD -s 'b' -d 'jump backwards to given dir or to project root'
53 53 -> complete -c $_ZL_CMD -s 'x' -x -d 'remove path from history' -a '(_z_complete)'
56 102 > __fish_enable_bracketed_paste
46 46 -> printf "\e[?2004h"
53 10366 > _zlua_precmd
193 10313 -> _zlua --add "$PWD" 2> /dev/null &
35 35 --> set -l arg_mode ""
22 22 --> set -l arg_type ""
33 33 --> set -l arg_subdir ""
25 25 --> set -l arg_inter ""
22 22 --> set -l arg_strip ""
12 12 --> function _zlua_call; eval (string escape -- $argv); ...
28 9971 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
34 34 ---> test "$argv[1]" = "--add"
24 24 ---> set -e argv[1]
107 272 ---> set -x _ZL_RANDOM (random)
165 165 ----> random
65 9598 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
297 9533 ----> eval (string escape -- $argv)
449 473 -----> source /usr/share/fish/functions/eval.fish
24 24 ------> function eval -S -d "Evaluate parameters as a command"
# keep a copy of the previous $status and use restore_status
# to preserve the status in case the block that is evaluated
# does not modify the status itself.
set -l status_copy $status
function __fish_restore_status
return $argv[1]
end
if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
end
# If we are in an interactive shell, eval should enable full
# job control since it should behave like the real code was
# executed. If we don't do this, commands that expect to be
# used interactively, like less, wont work using eval.
set -l mode
if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
end
if status --is-interactive
status --job-control full
end
__fish_restore_status $status_copy
# To eval 'foo', we construct a block "begin ; foo; end <&3 3<&-"
# Note the redirections are also within the quotes.
#
# We then pipe this to 'source 3<&0’.
#
# You might expect that the dup2(3, stdin) should overwrite stdin,
# and therefore prevent 'source' from reading the piped-in block. This doesn't happen
# because when you pipe to a builtin, we don't overwrite stdin with the read end
# of the block; instead we set a separate fd in a variable 'builtin_stdin', which is
# what it reads from. So builtins are magic in that, in pipes, their stdin
# is not fd 0.
#
# ‘source’ does not apply the redirections to itself. Instead it saves them and passes
# them as block-level redirections to parser.eval(). Ultimately the eval’d code sees
# the following redirections (in the following order):
# dup2 0 -> 3
# dup2 pipe -> 0
# dup2 3 -> 0
# where the pipe is the pipe we get from piping ‘echo’ to ‘source’. Thus the redirection
# effectively makes stdin fd0, instead of the thing that was piped to ‘source’
echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
set -l res $status
status --job-control $mode
return $res
...
56 56 -----> string escape -- $argv
82 82 -----> set -l status_copy $status
11 11 -----> function __fish_restore_status
return $argv[1]
...
5 27 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
22 22 ------> not set -q argv[2]
19 19 -----> set -l mode
15 49 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
16 16 ------> status --is-interactive-job-control
18 18 ------> set mode interactive
13 39 -----> if status --is-interactive
status --job-control full
...
13 13 ------> status --is-interactive
13 13 ------> status --job-control full
41 64 -----> __fish_restore_status $status_copy
23 23 ------> return $argv[1]
1008 8293 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
75 7285 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
;end <&3 3<&-
7210 7210 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
76 76 -----> set -l res $status
26 26 -----> status --job-control $mode
21 21 -----> return $res
15 15 ---> return
48 246 > fish_mode_prompt
97 198 -> fish_default_mode_prompt
12 101 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
60 60 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
29 29 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
55 1350 > fish_prompt
24 24 -> set -l color_cwd
20 20 -> set -l suffix
34 84 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
28 28 --> set color_cwd $fish_color_cwd
22 22 --> set suffix '>'
300 1167 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
85 160 --> prompt_hostname
75 75 ---> string replace -r "\..*" "" $hostname
110 110 --> set_color $color_cwd
120 559 --> prompt_pwd
30 30 ---> set -l options 'h/help'
46 46 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
5 23 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
18 18 ----> set -q _flag_help
17 17 ---> set -q fish_prompt_pwd_dir_length
22 22 ---> set -l fish_prompt_pwd_dir_length 1
32 32 ---> set realhome ~
90 154 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
64 64 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
16 115 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
34 34 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
65 65 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
38 38 --> set_color normal
33 283 > fish_title
142 250 -> echo (status current-command) " " (__fish_pwd)
25 25 --> status current-command
56 83 --> __fish_pwd
27 27 ---> pwd
191 331 > __fish_disable_bracketed_paste 'z '
140 140 -> printf "\e[?2004l"
89 521 > fish_title z\
263 432 -> echo (status current-command) " " (__fish_pwd)
53 53 --> status current-command
71 116 --> __fish_pwd
45 45 ---> pwd
69 15862 > z
228 15793 -> _zlua $argv
57 57 --> set -l arg_mode ""
45 45 --> set -l arg_type ""
44 44 --> set -l arg_subdir ""
43 43 --> set -l arg_inter ""
42 42 --> set -l arg_strip ""
36 36 --> function _zlua_call; eval (string escape -- $argv); ...
29 141 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
66 66 ---> test "$argv[1]" = "--add"
46 46 ---> test "$argv[1]" = "--complete"
53 345 --> while true
switch "$argv[1]"
case "-l"; set arg_mode "-l"
case "-e"; set arg_mode "-e"
case "-x"; set arg_mode "-x"
case "-t"; set arg_type "-t"
case "-r"; set arg_type "-r"
case "-c"; set arg_subdir "-c"
case "-s"; set arg_strip "-s"
case "-i"; set arg_inter "-i"
case "-I"; set arg_inter "-I"
case "-h"; set arg_mode "-h"
case "--help"; set arg_mode "-h"
case '*'; break
end
set -e argv[1]
...
113 113 ---> true
152 179 ---> switch "$argv[1]"
case "-l"; set arg_mode "-l"
case "-e"; set arg_mode "-e"
case "-x"; set arg_mode "-x"
case "-t"; set arg_type "-t"
case "-r"; set arg_type "-r"
case "-c"; set arg_subdir "-c"
case "-s"; set arg_strip "-s"
case "-i"; set arg_inter "-i"
case "-I"; set arg_inter "-I"
case "-h"; set arg_mode "-h"
case "--help"; set arg_mode "-h"
case '*'; break
...
27 27 ----> break
61 14812 --> if test "$arg_mode" = "-h"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -h
else if test "$arg_mode" = "-l"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -l $arg_subdir $arg_type $arg_strip $argv
else if test (count $argv) -eq 0
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -l $arg_subdir $arg_type $arg_strip $argv
else if test -n "$arg_mode"
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" $arg_mode $arg_subdir $arg_type $arg_inter $argv
else
set -l dest (_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --cd $arg_type $arg_subdir $arg_inter $argv)
if test -n "$dest" -a -d "$dest"
if test -z "$_ZL_CD"
builtin cd "$dest"
else
_zlua_call "$_ZL_CD" "$dest"
end
end
if test -n "$_ZL_ECHO"; pwd; end
...
52 52 ---> test "$arg_mode" = "-h"
43 43 ---> test "$arg_mode" = "-l"
155 289 ---> test (count $argv) -eq 0
134 134 ----> count $argv
134 14367 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" -l $arg_subdir $arg_type $arg_strip $argv
357 14233 ----> eval (string escape -- $argv)
103 103 -----> string escape -- $argv
84 84 -----> set -l status_copy $status
24 24 -----> function __fish_restore_status
return $argv[1]
...
17 57 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
40 40 ------> not set -q argv[2]
64 64 -----> set -l mode
59 157 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
50 50 ------> status --is-interactive-job-control
48 48 ------> set mode interactive
37 90 -----> if status --is-interactive
status --job-control full
...
27 27 ------> status --is-interactive
26 26 ------> status --job-control full
85 126 -----> __fish_restore_status $status_copy
41 41 ------> return $argv[1]
2025 13077 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
153 11052 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua -l '' '' ''
;end <&3 3<&-
10899 10899 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua -l '' '' ''
58 58 -----> set -l res $status
19 19 -----> status --job-control $mode
17 17 -----> return $res
41 77 > __fish_enable_bracketed_paste
36 36 -> printf "\e[?2004h"
36 13984 > _zlua_precmd
157 13948 -> _zlua --add "$PWD" 2> /dev/null &
30 30 --> set -l arg_mode ""
16 16 --> set -l arg_type ""
16 16 --> set -l arg_subdir ""
15 15 --> set -l arg_inter ""
15 15 --> set -l arg_strip ""
14 14 --> function _zlua_call; eval (string escape -- $argv); ...
26 13685 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
25 25 ---> test "$argv[1]" = "--add"
17 17 ---> set -e argv[1]
84 106 ---> set -x _ZL_RANDOM (random)
22 22 ----> random
92 13492 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
140 13400 ----> eval (string escape -- $argv)
38 38 -----> string escape -- $argv
20 20 -----> set -l status_copy $status
9 9 -----> function __fish_restore_status
return $argv[1]
...
4 18 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
14 14 ------> not set -q argv[2]
13 13 -----> set -l mode
10 33 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
11 11 ------> status --is-interactive-job-control
12 12 ------> set mode interactive
8 27 -----> if status --is-interactive
status --job-control full
...
9 9 ------> status --is-interactive
10 10 ------> status --job-control full
27 42 -----> __fish_restore_status $status_copy
15 15 ------> return $argv[1]
954 12933 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
74 11979 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
;end <&3 3<&-
11905 11905 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
75 75 -----> set -l res $status
29 29 -----> status --job-control $mode
23 23 -----> return $res
19 19 ---> return
49 219 > fish_mode_prompt
50 170 -> fish_default_mode_prompt
13 120 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
74 74 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
33 33 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
59 1304 > fish_prompt
28 28 -> set -l color_cwd
22 22 -> set -l suffix
36 90 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
30 30 --> set color_cwd $fish_color_cwd
24 24 --> set suffix '>'
306 1105 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
43 120 --> prompt_hostname
77 77 ---> string replace -r "\..*" "" $hostname
80 80 --> set_color $color_cwd
85 558 --> prompt_pwd
32 32 ---> set -l options 'h/help'
50 50 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
6 26 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
20 20 ----> set -q _flag_help
19 19 ---> set -q fish_prompt_pwd_dir_length
23 23 ---> set -l fish_prompt_pwd_dir_length 1
35 35 ---> set realhome ~
97 166 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
69 69 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
18 122 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
35 35 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
69 69 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
41 41 --> set_color normal
36 281 > fish_title
157 245 -> echo (status current-command) " " (__fish_pwd)
26 26 --> status current-command
38 62 --> __fish_pwd
24 24 ---> pwd
946 996 > source /usr/share/fish/functions/cd.fish
50 50 -> function cd --description "Change directory"
set -l MAX_DIR_HIST 25
if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
end
# Skip history in subshells.
if status --is-command-substitution
builtin cd $argv
return $status
end
# Avoid set completions.
set -l previous $PWD
if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
end
# allow explicit "cd ." if the mount-point became stale in the meantime
if test "$argv" = "."
cd "$PWD"
return $status
end
builtin cd $argv
set -l cd_status $status
if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
end
return $cd_status
...
285 449 > source /usr/share/fish/completions/cd.fish
103 103 -> complete -c cd -a "(__fish_complete_cd)"
61 61 -> complete -c cd -s h -l help -d 'Display help and exit'
224 312 > __fish_disable_bracketed_paste 'cd .'
88 88 -> printf "\e[?2004l"
90 535 > fish_title cd\ .
270 445 -> echo (status current-command) " " (__fish_pwd)
56 56 --> status current-command
73 119 --> __fish_pwd
46 46 ---> pwd
142 1755 > cd .
50 50 -> set -l MAX_DIR_HIST 25
18 256 -> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
166 238 --> test (count $argv) -gt 1
72 72 ---> count $argv
15 47 -> if status --is-command-substitution
builtin cd $argv
return $status
...
32 32 --> status --is-command-substitution
57 57 -> set -l previous $PWD
15 64 -> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
49 49 --> test "$argv" = "-"
52 1139 -> if test "$argv" = "."
cd "$PWD"
return $status
...
42 42 --> test "$argv" = "."
182 1009 --> cd "$PWD"
39 39 ---> set -l MAX_DIR_HIST 25
15 284 ---> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
153 269 ----> test (count $argv) -gt 1
116 116 -----> count $argv
15 45 ---> if status --is-command-substitution
builtin cd $argv
return $status
...
30 30 ----> status --is-command-substitution
53 53 ---> set -l previous $PWD
15 61 ---> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
46 46 ----> test "$argv" = "-"
15 56 ---> if test "$argv" = "."
cd "$PWD"
return $status
...
41 41 ----> test "$argv" = "."
96 96 ---> builtin cd $argv
57 57 ---> set -l cd_status $status
15 97 ---> if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
...
82 82 ----> test $cd_status -eq 0 -a "$PWD" != "$previous"
39 39 ---> return $cd_status
36 36 --> return $status
141 185 > __fish_enable_bracketed_paste
44 44 -> printf "\e[?2004h"
70 14309 > _zlua_precmd
186 14239 -> _zlua --add "$PWD" 2> /dev/null &
36 36 --> set -l arg_mode ""
27 27 --> set -l arg_type ""
25 25 --> set -l arg_subdir ""
26 26 --> set -l arg_inter ""
25 25 --> set -l arg_strip ""
22 22 --> function _zlua_call; eval (string escape -- $argv); ...
37 13892 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
37 37 ---> test "$argv[1]" = "--add"
27 27 ---> set -e argv[1]
95 126 ---> set -x _ZL_RANDOM (random)
31 31 ----> random
81 13646 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
209 13565 ----> eval (string escape -- $argv)
56 56 -----> string escape -- $argv
34 34 -----> set -l status_copy $status
31 31 -----> function __fish_restore_status
return $argv[1]
...
7 32 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
25 25 ------> not set -q argv[2]
23 23 -----> set -l mode
18 56 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
18 18 ------> status --is-interactive-job-control
20 20 ------> set mode interactive
14 45 -----> if status --is-interactive
status --job-control full
...
15 15 ------> status --is-interactive
16 16 ------> status --job-control full
47 71 -----> __fish_restore_status $status_copy
24 24 ------> return $argv[1]
1411 12853 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
135 11442 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
;end <&3 3<&-
11307 11307 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
90 90 -----> set -l res $status
36 36 -----> status --job-control $mode
29 29 -----> return $res
19 19 ---> return
67 281 > fish_mode_prompt
63 214 -> fish_default_mode_prompt
15 151 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
95 95 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
41 41 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
98 1687 > fish_prompt
38 38 -> set -l color_cwd
28 28 -> set -l suffix
47 115 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
38 38 --> set color_cwd $fish_color_cwd
30 30 --> set suffix '>'
382 1408 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
54 152 --> prompt_hostname
98 98 ---> string replace -r "\..*" "" $hostname
80 80 --> set_color $color_cwd
102 742 --> prompt_pwd
40 40 ---> set -l options 'h/help'
61 61 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
8 33 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
25 25 ----> set -q _flag_help
22 22 ---> set -q fish_prompt_pwd_dir_length
29 29 ---> set -l fish_prompt_pwd_dir_length 1
81 81 ---> set realhome ~
128 218 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
90 90 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
22 156 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
46 46 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
88 88 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
52 52 --> set_color normal
47 360 > fish_title
179 313 -> echo (status current-command) " " (__fish_pwd)
33 33 --> status current-command
72 101 --> __fish_pwd
29 29 ---> pwd
170 281 > __fish_disable_bracketed_paste 'cd .'
111 111 -> printf "\e[?2004l"
87 571 > fish_title cd\ .
306 484 -> echo (status current-command) " " (__fish_pwd)
55 55 --> status current-command
76 123 --> __fish_pwd
47 47 ---> pwd
147 1776 > cd .
51 51 -> set -l MAX_DIR_HIST 25
18 264 -> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
172 246 --> test (count $argv) -gt 1
74 74 ---> count $argv
14 47 -> if status --is-command-substitution
builtin cd $argv
return $status
...
33 33 --> status --is-command-substitution
56 56 -> set -l previous $PWD
16 64 -> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
48 48 --> test "$argv" = "-"
50 1147 -> if test "$argv" = "."
cd "$PWD"
return $status
...
44 44 --> test "$argv" = "."
185 1017 --> cd "$PWD"
40 40 ---> set -l MAX_DIR_HIST 25
15 282 ---> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
196 267 ----> test (count $argv) -gt 1
71 71 -----> count $argv
15 46 ---> if status --is-command-substitution
builtin cd $argv
return $status
...
31 31 ----> status --is-command-substitution
53 53 ---> set -l previous $PWD
15 63 ---> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
48 48 ----> test "$argv" = "-"
15 58 ---> if test "$argv" = "."
cd "$PWD"
return $status
...
43 43 ----> test "$argv" = "."
96 96 ---> builtin cd $argv
57 57 ---> set -l cd_status $status
15 98 ---> if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
...
83 83 ----> test $cd_status -eq 0 -a "$PWD" != "$previous"
39 39 ---> return $cd_status
36 36 --> return $status
103 175 > __fish_enable_bracketed_paste
72 72 -> printf "\e[?2004h"
79 16397 > _zlua_precmd
237 16318 -> _zlua --add "$PWD" 2> /dev/null &
58 58 --> set -l arg_mode ""
44 44 --> set -l arg_type ""
43 43 --> set -l arg_subdir ""
41 41 --> set -l arg_inter ""
41 41 --> set -l arg_strip ""
33 33 --> function _zlua_call; eval (string escape -- $argv); ...
38 15821 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
60 60 ---> test "$argv[1]" = "--add"
45 45 ---> set -e argv[1]
187 239 ---> set -x _ZL_RANDOM (random)
52 52 ----> random
103 15431 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
278 15328 ----> eval (string escape -- $argv)
192 192 -----> string escape -- $argv
57 57 -----> set -l status_copy $status
22 22 -----> function __fish_restore_status
return $argv[1]
...
9 48 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
39 39 ------> not set -q argv[2]
38 38 -----> set -l mode
28 91 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
28 28 ------> status --is-interactive-job-control
35 35 ------> set mode interactive
24 101 -----> if status --is-interactive
status --job-control full
...
49 49 ------> status --is-interactive
28 28 ------> status --job-control full
78 119 -----> __fish_restore_status $status_copy
41 41 ------> return $argv[1]
1991 14299 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
81 12308 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
;end <&3 3<&-
12227 12227 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /home/teddy
53 53 -----> set -l res $status
17 17 -----> status --job-control $mode
13 13 -----> return $res
8 8 ---> return
28 131 > fish_mode_prompt
31 103 -> fish_default_mode_prompt
6 72 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
48 48 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
18 18 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
48 1589 > fish_prompt
16 16 -> set -l color_cwd
13 13 -> set -l suffix
51 112 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
29 29 --> set color_cwd $fish_color_cwd
32 32 --> set suffix '>'
382 1400 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
52 151 --> prompt_hostname
99 99 ---> string replace -r "\..*" "" $hostname
98 98 --> set_color $color_cwd
99 717 --> prompt_pwd
41 41 ---> set -l options 'h/help'
63 63 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
7 32 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
25 25 ----> set -q _flag_help
23 23 ---> set -q fish_prompt_pwd_dir_length
29 29 ---> set -l fish_prompt_pwd_dir_length 1
44 44 ---> set realhome ~
128 230 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
102 102 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
24 156 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
45 45 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
87 87 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
52 52 --> set_color normal
46 325 > fish_title
170 279 -> echo (status current-command) " " (__fish_pwd)
33 33 --> status current-command
46 76 --> __fish_pwd
30 30 ---> pwd
387 1449 > __fish_complete_cd
955 993 -> source /usr/share/fish/functions/__fish_complete_cd.fish
38 38 --> function __fish_complete_cd -d "Completions for the cd command"
set -q CDPATH[1]
or return 0 # no CDPATH so rely solely on the core file name completions
set -l token (commandline -ct)
if string match -qr '^\.{0,2}/.*' -- $token
# Absolute path or explicitly relative to the current directory. Rely on the builtin file
# name completions since we no longer exclude them from the `cd` argument completion.
return
end
# Relative path. Check $CDPATH and use that as the description for any possible matches.
# We deliberately exclude the `.` path because the core file name completion logic will include
# it when presenting possible matches.
set -l cdpath (string match -v '.' -- $CDPATH)
# Remove the CWD if it is in CDPATH since, again, the core file name completion logic will
# handle it.
set -l cdpath (string match -v -- $PWD $cdpath)
set -q cdpath[1]
or return 0
# TODO: There's a subtlety regarding descriptions - if $cdpath[1]/foo and $cdpath[2]/foo
# exist, we print both but want the first description to win - this currently works, but
# is not guaranteed.
for cdpath in $cdpath
# Replace $HOME with "~".
set -l desc (string replace -r -- "^$HOME" "~" "$cdpath")
# This assumes the CDPATH component itself is cd-able.
for d in $cdpath/$token*/
# Remove the cdpath component again.
test -x $d
and printf "%s\tCDPATH %s\n" (string replace -r "^$cdpath/" "" -- $d) $desc
end
end
...
36 36 -> set -q CDPATH[1]
33 33 -> return 0
152 232 > __fish_disable_bracketed_paste 'cd /tmp/'
80 80 -> printf "\e[?2004l"
83 544 > fish_title cd\ /tmp/
293 461 -> echo (status current-command) " " (__fish_pwd)
51 51 --> status current-command
72 117 --> __fish_pwd
45 45 ---> pwd
190 1389 > cd /tmp/
50 50 -> set -l MAX_DIR_HIST 25
18 253 -> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
165 235 --> test (count $argv) -gt 1
70 70 ---> count $argv
18 93 -> if status --is-command-substitution
builtin cd $argv
return $status
...
75 75 --> status --is-command-substitution
61 61 -> set -l previous $PWD
14 66 -> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
52 52 --> test "$argv" = "-"
15 58 -> if test "$argv" = "."
cd "$PWD"
return $status
...
43 43 --> test "$argv" = "."
91 91 -> builtin cd $argv
55 55 -> set -l cd_status $status
109 432 -> if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
...
85 85 --> test $cd_status -eq 0 -a "$PWD" != "$previous"
32 32 --> set -q dirprev
35 35 --> set -l dirprev
46 46 --> set -q dirprev[$MAX_DIR_HIST]
51 51 --> set -g -a dirprev $previous
33 33 --> set -e dirnext
41 41 --> set -g __fish_cd_direction prev
40 40 -> return $cd_status
96 164 > __fish_enable_bracketed_paste
68 68 -> printf "\e[?2004h"
61 17316 > _zlua_precmd
226 17255 -> _zlua --add "$PWD" 2> /dev/null &
79 79 --> set -l arg_mode ""
85 85 --> set -l arg_type ""
76 76 --> set -l arg_subdir ""
44 44 --> set -l arg_inter ""
41 41 --> set -l arg_strip ""
43 43 --> function _zlua_call; eval (string escape -- $argv); ...
43 16661 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
84 84 ---> test "$argv[1]" = "--add"
48 48 ---> set -e argv[1]
159 211 ---> set -x _ZL_RANDOM (random)
52 52 ----> random
102 16266 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
258 16164 ----> eval (string escape -- $argv)
97 97 -----> string escape -- $argv
57 57 -----> set -l status_copy $status
23 23 -----> function __fish_restore_status
return $argv[1]
...
10 48 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
38 38 ------> not set -q argv[2]
36 36 -----> set -l mode
28 90 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
29 29 ------> status --is-interactive-job-control
33 33 ------> set mode interactive
24 101 -----> if status --is-interactive
status --job-control full
...
49 49 ------> status --is-interactive
28 28 ------> status --job-control full
78 119 -----> __fish_restore_status $status_copy
41 41 ------> return $argv[1]
1804 15243 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
165 13439 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /tmp
;end <&3 3<&-
13274 13274 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /tmp
57 57 -----> set -l res $status
19 19 -----> status --job-control $mode
16 16 -----> return $res
9 9 ---> return
36 149 > fish_mode_prompt
33 113 -> fish_default_mode_prompt
10 80 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
49 49 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
21 21 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
42 850 > fish_prompt
17 17 -> set -l color_cwd
15 15 -> set -l suffix
55 93 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
23 23 --> set color_cwd $fish_color_cwd
15 15 --> set suffix '>'
189 683 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
28 81 --> prompt_hostname
53 53 ---> string replace -r "\..*" "" $hostname
42 42 --> set_color $color_cwd
50 346 --> prompt_pwd
20 20 ---> set -l options 'h/help'
32 32 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
4 17 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
13 13 ----> set -q _flag_help
11 11 ---> set -q fish_prompt_pwd_dir_length
14 14 ---> set -l fish_prompt_pwd_dir_length 1
23 23 ---> set realhome ~
60 103 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
43 43 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
12 76 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
23 23 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
41 41 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
25 25 --> set_color normal
31 263 > fish_title
130 232 -> echo (status current-command) " " (__fish_pwd)
33 33 --> status current-command
37 69 --> __fish_pwd
32 32 ---> pwd
194 284 > __fish_disable_bracketed_paste 'cd .'
90 90 -> printf "\e[?2004l"
91 570 > fish_title cd\ .
307 479 -> echo (status current-command) " " (__fish_pwd)
54 54 --> status current-command
73 118 --> __fish_pwd
45 45 ---> pwd
203 1858 > cd .
53 53 -> set -l MAX_DIR_HIST 25
18 261 -> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
170 243 --> test (count $argv) -gt 1
73 73 ---> count $argv
16 48 -> if status --is-command-substitution
builtin cd $argv
return $status
...
32 32 --> status --is-command-substitution
56 56 -> set -l previous $PWD
14 64 -> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
50 50 --> test "$argv" = "-"
55 1173 -> if test "$argv" = "."
cd "$PWD"
return $status
...
54 54 --> test "$argv" = "."
208 1028 --> cd "$PWD"
42 42 ---> set -l MAX_DIR_HIST 25
15 233 ---> if test (count $argv) -gt 1
printf "%s\n" (_ "Too many args for cd command")
return 1
...
152 218 ----> test (count $argv) -gt 1
66 66 -----> count $argv
14 45 ---> if status --is-command-substitution
builtin cd $argv
return $status
...
31 31 ----> status --is-command-substitution
53 53 ---> set -l previous $PWD
14 62 ---> if test "$argv" = "-"
if test "$__fish_cd_direction" = "next"
nextd
else
prevd
end
return $status
...
48 48 ----> test "$argv" = "-"
15 58 ---> if test "$argv" = "."
cd "$PWD"
return $status
...
43 43 ----> test "$argv" = "."
93 93 ---> builtin cd $argv
54 54 ---> set -l cd_status $status
19 134 ---> if test $cd_status -eq 0 -a "$PWD" != "$previous"
set -q dirprev
or set -l dirprev
set -q dirprev[$MAX_DIR_HIST]
and set -e dirprev[1]
set -g -a dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
...
115 115 ----> test $cd_status -eq 0 -a "$PWD" != "$previous"
46 46 ---> return $cd_status
36 36 --> return $status
153 250 > __fish_enable_bracketed_paste
97 97 -> printf "\e[?2004h"
103 20643791 > _zlua_precmd
302 20643688 -> _zlua --add "$PWD" 2> /dev/null &
61 61 --> set -l arg_mode ""
44 44 --> set -l arg_type ""
96 96 --> set -l arg_subdir ""
44 44 --> set -l arg_inter ""
41 41 --> set -l arg_strip ""
33 33 --> function _zlua_call; eval (string escape -- $argv); ...
55 20643067 --> if test "$argv[1]" = "--add"
set -e argv[1]
set -x _ZL_RANDOM (random)
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
return
else if test "$argv[1]" = "--complete"
set -e argv[1]
_zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --complete $argv
return
...
60 60 ---> test "$argv[1]" = "--add"
46 46 ---> set -e argv[1]
161 212 ---> set -x _ZL_RANDOM (random)
51 51 ----> random
127 20642669 ---> _zlua_call "$ZLUA_LUAEXE" "$ZLUA_SCRIPT" --add $argv
375 20642542 ----> eval (string escape -- $argv)
90 90 -----> string escape -- $argv
55 55 -----> set -l status_copy $status
31 31 -----> function __fish_restore_status
return $argv[1]
...
11 55 -----> if not set -q argv[2]
# like most builtins, we only check for -h/--help
# if we only have a single argument
switch "$argv[1]"
case -h --help
__fish_print_help eval
return 0
end
...
44 44 ------> not set -q argv[2]
38 38 -----> set -l mode
27 90 -----> if status --is-interactive-job-control
set mode interactive
else
if status --is-full-job-control
set mode full
else
set mode none
end
...
29 29 ------> status --is-interactive-job-control
34 34 ------> set mode interactive
24 75 -----> if status --is-interactive
status --job-control full
...
25 25 ------> status --is-interactive
26 26 ------> status --job-control full
79 120 -----> __fish_restore_status $status_copy
41 41 ------> return $argv[1]
2164 20641349 -----> echo "begin; $argv "\n" ;end <&3 3<&-" | source 3<&0
157 20639185 ------> begin; /bin/lua /home/teddy/Kod/z.lua/z.lua --add /tmp
;end <&3 3<&-
20639028 20639028 -------> /bin/lua /home/teddy/Kod/z.lua/z.lua --add /tmp
175 175 -----> set -l res $status
51 51 -----> status --job-control $mode
38 38 -----> return $res
25 25 ---> return
84 488 > fish_mode_prompt
207 404 -> fish_default_mode_prompt
22 197 --> if test "$fish_key_bindings" = "fish_vi_key_bindings"
or test "$fish_key_bindings" = "fish_hybrid_key_bindings"
switch $fish_bind_mode
case default
set_color --bold --background red white
echo '[N]'
case insert
set_color --bold --background green white
echo '[I]'
case replace_one
set_color --bold --background green white
echo '[R]'
case visual
set_color --bold --background magenta white
echo '[V]'
end
set_color normal
echo -n ' '
...
119 119 ---> test "$fish_key_bindings" = "fish_vi_key_bindings"
56 56 ---> test "$fish_key_bindings" = "fish_hybrid_key_bindings"
107 2691 > fish_prompt
54 54 -> set -l color_cwd
38 38 -> set -l suffix
67 161 -> switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix '>'
...
52 52 --> set color_cwd $fish_color_cwd
42 42 --> set suffix '>'
614 2331 -> echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) (set_color normal) "$suffix "
186 395 --> prompt_hostname
209 209 ---> string replace -r "\..*" "" $hostname
173 173 --> set_color $color_cwd
237 1077 --> prompt_pwd
59 59 ---> set -l options 'h/help'
107 107 ---> argparse -n prompt_pwd --max-args=0 $options -- $argv
10 47 ---> if set -q _flag_help
__fish_print_help prompt_pwd
return 0
...
37 37 ----> set -q _flag_help
32 32 ---> set -q fish_prompt_pwd_dir_length
40 40 ---> set -l fish_prompt_pwd_dir_length 1
61 61 ---> set realhome ~
174 291 ---> set -l tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
117 117 ----> string replace -r '^'"$realhome"'($|/)' '~$1' $PWD
32 203 ---> if [ $fish_prompt_pwd_dir_length -eq 0 ]
echo $tmp
else
# Shorten to at most $fish_prompt_pwd_dir_length characters per directory
string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
...
61 61 ----> [ $fish_prompt_pwd_dir_length -eq 0 ]
110 110 ----> string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp
72 72 --> set_color normal
74 599 > fish_title
232 525 -> echo (status current-command) " " (__fish_pwd)
46 46 --> status current-command
147 247 --> __fish_pwd
100 100 ---> pwd
392 1418 > delete-or-exit
533 562 -> source /usr/share/fish/functions/delete-or-exit.fish
29 29 --> function delete-or-exit
set -l cmd (commandline)
switch "$cmd"
case ''
exit 0
case '*'
commandline -f delete-char
end
...
172 305 -> set -l cmd (commandline)
133 133 --> commandline
57 159 -> switch "$cmd"
case ''
exit 0
case '*'
commandline -f delete-char
...
102 102 --> exit 0
112 250 > __fish_disable_bracketed_paste
138 138 -> printf "\e[?2004l"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment