2006-10-19 11:50:23 +00:00
|
|
|
#
|
|
|
|
# Main file for fish command completions. This file contains various
|
|
|
|
# common helper functions for the command completions. All actual
|
|
|
|
# completions are located in the completions subdirectory.
|
|
|
|
#
|
|
|
|
# @configure_input@
|
|
|
|
|
2007-04-22 18:49:56 +00:00
|
|
|
#
|
|
|
|
# Set default field separators
|
|
|
|
#
|
|
|
|
|
|
|
|
set -g IFS \n\ \t
|
|
|
|
|
2006-10-19 11:50:23 +00:00
|
|
|
#
|
|
|
|
# Set default search paths for completions and shellscript functions
|
|
|
|
# unless they already exist
|
|
|
|
#
|
|
|
|
|
|
|
|
set -l configdir ~/.config
|
2007-10-28 09:08:40 +00:00
|
|
|
|
2006-10-19 11:50:23 +00:00
|
|
|
if set -q XDG_CONFIG_HOME
|
|
|
|
set configdir $XDG_CONFIG_HOME
|
|
|
|
end
|
|
|
|
|
2007-10-28 09:08:40 +00:00
|
|
|
# These are used internally by fish in various places
|
2006-11-17 16:24:38 +00:00
|
|
|
if not set -q __fish_datadir
|
2007-08-19 16:42:30 +00:00
|
|
|
set -g __fish_datadir @datadir@/fish
|
|
|
|
end
|
|
|
|
|
|
|
|
if not set -q __fish_sysconfdir
|
|
|
|
set -g __fish_sysconfdir @sysconfdir@/fish
|
2006-11-17 16:24:38 +00:00
|
|
|
end
|
2006-10-19 11:50:23 +00:00
|
|
|
|
2007-10-28 09:08:40 +00:00
|
|
|
# Set up function and completion paths. Make sure that the fish
|
|
|
|
# default functions/completions are included in the respective path.
|
|
|
|
|
2010-09-18 02:18:26 +00:00
|
|
|
if not set -q fish_function_path
|
|
|
|
set -U fish_function_path $configdir/fish/functions @sysconfdir@/fish/functions @datadir@/fish/functions
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
|
|
|
|
2010-09-18 02:18:26 +00:00
|
|
|
if not contains @datadir@/fish/functions $fish_function_path
|
|
|
|
set fish_function_path[-1] @datadir@/fish/functions
|
2007-10-28 09:10:42 +00:00
|
|
|
end
|
|
|
|
|
2010-09-18 02:18:26 +00:00
|
|
|
if not set -q fish_complete_path
|
|
|
|
set -U fish_complete_path $configdir/fish/completions @sysconfdir@/fish/completions @datadir@/fish/completions
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
|
|
|
|
2010-09-18 02:18:26 +00:00
|
|
|
if not contains @datadir@/fish/completions $fish_complete_path
|
|
|
|
set fish_complete_path[-1] @datadir@/fish/completions
|
2007-10-28 09:10:42 +00:00
|
|
|
end
|
|
|
|
|
2006-10-19 11:50:23 +00:00
|
|
|
set __fish_help_dir @docdir@
|
|
|
|
|
2007-10-28 09:08:40 +00:00
|
|
|
#
|
2006-10-19 11:50:23 +00:00
|
|
|
# This is a Solaris-specific test to modify the PATH so that
|
2007-10-28 09:08:40 +00:00
|
|
|
# Posix-conformant tools are used by default. It is separate from the
|
|
|
|
# other PATH code because this directory needs to be prepended, not
|
|
|
|
# appended, since it contains POSIX-compliant replacements for various
|
|
|
|
# system utilities.
|
|
|
|
#
|
2006-10-19 11:50:23 +00:00
|
|
|
|
|
|
|
if test -d /usr/xpg4/bin
|
|
|
|
if not contains /usr/xpg4/bin $PATH
|
2010-09-18 02:18:26 +00:00
|
|
|
set PATH /usr/xpg4/bin $PATH
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
2010-09-18 02:18:26 +00:00
|
|
|
end
|
2006-10-19 11:50:23 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Add a few common directories to path, if they exists. Note that pure
|
|
|
|
# console programs like makedep sometimes live in /usr/X11R6/bin, so we
|
|
|
|
# want this even for text-only terminals.
|
|
|
|
#
|
|
|
|
|
2007-09-28 21:38:55 +00:00
|
|
|
set -l path_list /bin /usr/bin /usr/X11R6/bin /usr/local/bin @prefix@/bin @optbindirs@
|
2006-10-19 11:50:23 +00:00
|
|
|
|
|
|
|
# Root should also have the sbin directories in the path
|
2007-08-19 16:42:30 +00:00
|
|
|
switch $USER
|
|
|
|
case root
|
2007-09-28 21:38:55 +00:00
|
|
|
set path_list $path_list /sbin /usr/sbin /usr/local/sbin @prefix@/sbin
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
|
|
|
|
2007-09-28 21:38:21 +00:00
|
|
|
for i in $path_list
|
|
|
|
if not contains $i $PATH
|
|
|
|
if test -d $i
|
|
|
|
set PATH $PATH $i
|
|
|
|
end
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-08-19 16:42:30 +00:00
|
|
|
#
|
2007-04-23 21:10:26 +00:00
|
|
|
# Launch debugger on SIGTRAP
|
2007-08-19 16:42:30 +00:00
|
|
|
#
|
2007-04-23 21:10:26 +00:00
|
|
|
function fish_sigtrap_handler --on-signal TRAP --no-scope-shadowing --description "Signal handler for the TRAP signal. Lanches a debug prompt."
|
|
|
|
breakpoint
|
|
|
|
end
|
2006-10-19 11:50:23 +00:00
|
|
|
|
2007-08-19 16:42:30 +00:00
|
|
|
#
|
|
|
|
# Whenever a prompt is displayed, make sure that interactive
|
|
|
|
# mode-specific initializations have been performed.
|
2007-10-28 09:11:17 +00:00
|
|
|
# This handler removes itself after it is first called.
|
2007-08-19 16:42:30 +00:00
|
|
|
#
|
|
|
|
function __fish_on_interactive --on-event fish_prompt
|
|
|
|
__fish_config_interactive
|
2007-10-28 09:11:17 +00:00
|
|
|
functions -e __fish_on_interactive
|
2006-10-19 11:50:23 +00:00
|
|
|
end
|
2007-08-19 16:42:30 +00:00
|
|
|
|