diff --git a/Makefile.in b/Makefile.in
index 0044ee058..fe0dd5fcb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48,13 +48,11 @@ datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
-fishdir = @fishdir@
-fishfile = @fishfile@
fishinputfile = @fishinputfile@
docdir = @docdir@
-#Init files to install
-INIT_DIR_INSTALL = init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish
+#etc files to install
+ETC_DIR_INSTALL = etc/fish_interactive.fish etc/fish_function.fish
# Set to 1 if we have gettext
HAVE_GETTEXT=@HAVE_GETTEXT@
@@ -162,18 +160,20 @@ MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \
config.guess fish_tests.c main.c fish_pager.c fishd.c seq.in
-# Files in ./init/
-INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
- init/fish_function.fish init/fish_inputrc \
- init/fish_interactive.fish.in
+# Files in ./etc/
+ETC_DIR_FILES :=etc/fish.in etc/fish_function.fish etc/fish_inputrc \
+ etc/fish_interactive.fish.in
+
+# Files in ./share/
+SHARE_DIR_FILES :=share/fish
# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
-COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
+COMPLETIONS_DIR_FILES := $(wildcard share/completions/*.fish)
-FUNCTIONS_DIR_FILES := $(wildcard init/functions/*.fish)
+FUNCTIONS_DIR_FILES := $(wildcard share/functions/*.fish)
# Programs to build
PROGRAMS:=fish set_color @XSEL@ @SEQ_FALLBACK@ mimedb count fish_pager fishd
@@ -266,10 +266,10 @@ doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
fi
# Create a template translation object
-messages.pot: *.c *.h init/*.in init/*.fish init/completions/*.fish init/functions/*.fish seq
+messages.pot: *.c *.h etc/*.in etc/*.fish share/*.in share/completions/*.fish share/functions/*.fish seq
if test $(HAVE_GETTEXT) = 1;then \
xgettext -k_ -kN_ -kcomplete_desc *.c *.h -o messages.pot; \
- if ! xgettext -j -k_ -LShell init/*.in init/*.fish init/functions/*.fish init/completions/*.fish seq -o messages.pot; then \
+ if ! xgettext -j -k_ -LShell etc/*.in etc/*.fish share/*.in share/completions/*.fish share/functions/*.fish seq -o messages.pot; then \
echo "Your xgettext version is too old to build the messages.pot file"\
rm messages.pot\
false;\
@@ -348,20 +348,22 @@ install: all install-translations
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
done;
- $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
- $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
- $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/functions
- $(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
- for i in $(INIT_DIR_INSTALL); do \
- $(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
+ $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish.d
+ $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
+ $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
+ $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
+ $(INSTALL) -m 644 etc/fish $(DESTDIR)$(sysconfdir)/fish
+ $(INSTALL) -m 644 share/fish $(DESTDIR)$(datadir)/fish
+ for i in $(ETC_DIR_INSTALL); do \
+ $(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)/fish.d; \
done;
for i in $(COMPLETIONS_DIR_FILES); do \
- $(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/completions/; \
+ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
done;
for i in $(FUNCTIONS_DIR_FILES); do \
- $(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/functions/; \
+ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
done;
- $(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
+ $(INSTALL) -m 644 etc/fish_inputrc $(DESTDIR)$(sysconfdir)/fish_inputrc;
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* ChangeLog; do \
if test -f $$i; then \
@@ -387,9 +389,10 @@ uninstall: uninstall-translations
rm -f $(DESTDIR)$(bindir)/$$i; \
done;
rm -f $(DESTDIR)$(bindir)/xsel
- rm -f $(DESTDIR)$(sysconfdir)$(fishfile)
- rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
- rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
+ rm -f $(DESTDIR)$(sysconfdir)/fish
+ rm -f $(DESTDIR)$(sysconfdir)/fish_inputrc
+ rm -r $(DESTDIR)$(sysconfdir)/fish.d
+ rm -r $(DESTDIR)$(datadir)/fish
rm -r $(DESTDIR)$(docdir)
for i in fish.1* @XSEL_MAN@ mimedb.1* fishd.1* set_color.1* count.1*; do \
rm $(DESTDIR)$(mandir)/man1/$$i; \
@@ -458,20 +461,22 @@ depend:
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
-fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
+fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(ETC_DIR_FILES) $(TEST_DIR_FILES) $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
- $(INSTALL) -d fish-@PACKAGE_VERSION@/init
- $(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
- $(INSTALL) -d fish-@PACKAGE_VERSION@/init/functions
+ $(INSTALL) -d fish-@PACKAGE_VERSION@/etc
+ $(INSTALL) -d fish-@PACKAGE_VERSION@/share
+ $(INSTALL) -d fish-@PACKAGE_VERSION@/share/completions
+ $(INSTALL) -d fish-@PACKAGE_VERSION@/share/functions
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
$(INSTALL) -d fish-@PACKAGE_VERSION@/po
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
- cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
- cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
- cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/functions/
+ cp -f $(ETC_DIR_FILES) fish-@PACKAGE_VERSION@/etc/
+ cp -f $(SHARE_DIR_FILES) fish-@PACKAGE_VERSION@/share/
+ cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/completions/
+ cp -f $(FUNCTIONS_DIR_FILES) fish-@PACKAGE_VERSION@/share/functions/
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
cp -f $(TRANSLATIONS_SRC) fish-@PACKAGE_VERSION@/po/
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
@@ -499,7 +504,7 @@ rpm: fish-@PACKAGE_VERSION@.tar.bz2
distclean: clean
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
- rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
+ rm -f etc/fish etc/fish_interactive.fish share/fish
rm -f config.status config.log config.h Makefile
.PHONY: distclean
diff --git a/configure.ac b/configure.ac
index 90b47f840..2d49994f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,10 +104,6 @@ else
AC_SUBST( PREFIX, [$prefix])
fi
-AC_SUBST(fishdir,[/fish.d])
-AC_SUBST(fishfile,[/fish])
-AC_SUBST(fishinputfile,[/fish_inputrc])
-
AC_ARG_VAR( [docdir], [Documentation direcotry] )
if test -z $docdir; then
@@ -116,7 +112,9 @@ fi
AC_DEFINE_UNQUOTED( DOCDIR, [L"$(eval echo $docdir)"], [Documentation directory] )
AC_DEFINE_UNQUOTED( SYSCONFDIR, [L"$(eval echo $sysconfdir)"], [System configuration directory] )
+AC_DEFINE_UNQUOTED( DATADIR, [L"$(eval echo $datadir)"], [System configuration directory] )
AC_SUBST( SYSCONFDIR, ["$(eval echo $sysconfdir)"] )
+AC_SUBST( DATADIR, ["$(eval echo $datadir)"] )
# Set up locale directory
AC_DEFINE_UNQUOTED( [LOCALEDIR], "$(eval echo $datadir)/locale", [Locale directory])
@@ -235,7 +233,7 @@ fi
# Check if we have ncurses, and use it rather than curses if possible.
AC_SEARCH_LIBS( setupterm, [ncurses curses], [ AC_MSG_NOTICE([Found curses implementation])], [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish])] )
-AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile init/fish init/fish_interactive.fish init/fish_complete.fish seq])
+AC_CONFIG_FILES([Makefile fish.spec doc_src/fish.1 doc_src/Doxyfile etc/fish etc/fish_interactive.fish seq])
AC_OUTPUT
echo "Now run 'make' and 'make install' to built and install fish."
diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr
index 82db951ec..3ee8866ef 100644
--- a/doc_src/doc.hdr
+++ b/doc_src/doc.hdr
@@ -216,6 +216,42 @@ the fg command.
To get a listing of all currently started jobs, use the jobs command.
+\subsection syntax-function Shellscript functions
+
+Functions are used to group together commands and arguments
+using a single name. For example, the following is a function
+definition that calls the command 'ls -l' to print a detailed listing
+of the contents of the current directory:
+
+
+function ll
+ ls -l $argv
+end
+
+
+The first line tells fish that a function by the name of ll is to be
+defined. To use it, simply write ll
on the
+commandline. The second line tells fish that the command ls -l
+$argv
should be called when ll is invoked. $argv is an array
+variable, which always contains all arguments sent to the function. In
+the example above, these are simply passed on to the ls command. For
+more information on functions, see the documentation for the function builtin.
+
+Functions can be defined on the commandline or in a configuration
+file, but they can also be automatically loaded. Fish automatically
+searches through any directories in the array variable
+\$fish_function_path, and any functions defined are automatically
+loaded when needed. A function definition file must have a filename
+consisting of the name of the function and the suffix '.fish'.
+
+The default value for \$fish_function_path is ~/.fish.d/functions,
+/etc/fish.d/functions /usr/share/fish/functions. The exact path to the
+last two of these may be slighly different depending on what install
+path prefix was chosen at configuration time. The rationale behind
+having three different directories is that the first one is for user
+specific functions, the second one is for system-wide additional
+functions and the last one is for default fish functions.
\subsection syntax-words Some common words
@@ -313,17 +349,33 @@ href="builtins.html#complete">complete builtin, or write 'complete
--help' inside the \c fish shell.
For examples of how to write your own complex completions, study the
-completions in /etc/fish.d/completions (or ~/etc/fish.d/completions if
-you installed fish in your home directory).
+completions in /usr/share/fish/completions. (The exact path depends on
+your chosen installation prefix and may be slightly different)
-If you wish to use a completion, you should consider adding it to your
-startup files. When completion has been requested for a command \c
-COMMAND, fish will automatically look for the file
-~/.fish.d/completions/COMMAND.fish. If it exists, it will be
-automatically loaded. If you have written new completions for a common
+\subsection completion-path Where to put completions
+
+Completions can be defined on the commandline or in a configuration
+file, but they can also be automatically loaded. Fish automatically
+searches through any directories in the array variable
+\$fish_complete_path, and any completions defined are automatically
+loaded when needed. A completion file must have a filename consisting
+of the name of the command to complete and the suffix '.fish'.
+
+The default value for \$fish_complete_path is ~/.fish.d/completions,
+/etc/fish.d/completions and /usr/share/fish/completions. The exact
+path to the last two of these may be slighly different depending on
+what install path prefix was chosen at configuration time. If a
+suitable file is found in one of these directories, it will be
+automatically loaded and the search will be stopped. The rationale
+behind having three different directories is that the first one is for
+user specific completions, the second one is for system-wide
+completions and the last one is for default fish completions.
+
+If you have written new completions for a common
Unix command, please consider sharing your work by sending it to the fish mailinglist.
+
\section expand Parameter expansion (Globbing)
When an argument for a program is given on the commandline, it
@@ -878,12 +930,15 @@ which the user can change fish
's behaviour.
\section initialization Initialization files
-On startup, \c fish evaluates the file /etc/fish (Or ~/etc/fish if you
-installed fish in your home directory) and ~/.fish, in that order. If
-you want to run a command only on starting an interactive shell, use
-the exit status of the command 'status --is-interactive' to determine
-if the shell is interactive. If you want to run a command only when
-using a login shell, use 'status --is-login' instead.
+On startup, \c fish evaluates the files /usr/share/fish/fish,
+/etc/fish (Or ~/etc/fish if you installed fish in your home directory)
+and ~/.fish, in that order. The first file should not be directly
+edited, the second one is meant for systemwide configuration and the
+last one is meant for user configuration. If you want to run a command
+only on starting an interactive shell, use the exit status of the
+command 'status --is-interactive' to determine if the shell is
+interactive. If you want to run a command only when using a login
+shell, use 'status --is-login' instead.
Examples:
diff --git a/etc/fish b/etc/fish
new file mode 100644
index 000000000..8c170a6cd
--- /dev/null
+++ b/etc/fish
@@ -0,0 +1,103 @@
+#
+# Init file for fish
+#
+# etc/fish. Generated from fish.in by configure.
+
+#
+# Set default search paths
+#
+
+set -g fish_function_path /usr/share/functions /etc/fish.d/functions ~/.fish.d/functions
+set -g fish_complete_path /usr/share/completions /etc/fish.d/completions ~/.fish.d/completions
+
+#
+# Set default field separators
+#
+
+set -g IFS \ \t\n
+
+#
+# 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.
+#
+
+set -l path_list /bin /usr/bin /usr/X11R6/bin /usr/bin /sw/bin
+
+# Root should also have the sbin directories in the path
+if test "$USER" = root
+ set path_list $path_list /sbin /usr/sbin /usr/local/sbin
+end
+
+for i in $path_list
+ if not expr "$PATH" : .\*$i.\* >/dev/null
+ if test -d $i
+ set PATH $PATH $i
+ end
+ end
+end
+
+
+#
+# Set some value for LANG if nothing was set before, and this is a
+# login shell. Also check for i18n information in /etc/sysconfig/i18n
+#
+
+if status --is-login
+ if not set -q LANG >/dev/null
+ set -gx LANG en_US.UTF-8
+ end
+
+ if test -f /etc/sysconfig/i18n
+ eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p')
+ end
+end
+
+
+#
+# Put linux console in unicode mode. Should this be done in any other
+# situation as well?
+#
+
+if expr "$LANG" : ".*[Uu][Tt][Ff]" >/dev/null
+ if test linux = "$TERM"
+ unicode_start ^/dev/null
+ end
+end
+
+
+#
+# There are variables that contain colons that are not arrays. This
+# reverts them back to regular strings.
+#
+
+for i in DISPLAY
+ if set -q $i
+ set -- $i (printf ":%s" $$i|cut -c 2-)
+ end
+end
+
+#
+# Alias for gettext (or a fallback if gettext isn't installed) This
+# needs to be defined here and not in fish_function.fish, since it is
+# used by other init files.
+#
+
+function _ -d "Alias for the gettext command"
+ printf "%s" $argv
+end
+if test 1 = "1"
+ if which gettext ^/dev/null >/dev/null
+ function _ -d "Alias for the gettext command"
+ gettext fish $argv
+ end
+ end
+end
+
+#
+# Load additional initialization files
+#
+
+for i in fish.d/*.fish
+ . $i
+end
diff --git a/init/fish.in b/etc/fish.in
similarity index 86%
rename from init/fish.in
rename to etc/fish.in
index fe32960e2..b010c31a7 100644
--- a/init/fish.in
+++ b/etc/fish.in
@@ -3,12 +3,18 @@
#
# @configure_input@
+#
+# Set default search paths
+#
+
+set -g fish_function_path ~/.fish.d/functions @SYSCONFDIR@/fish.d/functions @DATADIR@/functions
+set -g fish_complete_path ~/.fish.d/completions @SYSCONFDIR@/fish.d/completions @DATADIR@/completions
+
#
# Set default field separators
#
set -g IFS \ \t\n
-set -g fish_function_path $PWD/fish.d/functions ~/.fish.d/functions
#
# Add a few common directories to path, if they exists. Note that pure
@@ -53,7 +59,7 @@ end
# situation as well?
#
-if expr "$LANG" : ".*UTF" >/dev/null
+if expr "$LANG" : ".*[Uu][Tt][Ff]" >/dev/null
if test linux = "$TERM"
unicode_start ^/dev/null
end
diff --git a/init/fish_inputrc b/etc/fish_inputrc
similarity index 100%
rename from init/fish_inputrc
rename to etc/fish_inputrc
diff --git a/fish.spec.in b/fish.spec.in
index 3ce51b7e7..a7c9802f7 100644
--- a/fish.spec.in
+++ b/fish.spec.in
@@ -13,40 +13,65 @@ Source0: http://roo.no-ip.org/%{name}/files/%{version}/%{name}-%{
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: doxygen ncurses-devel xorg-x11-devel
+
+
+
%description
fish is a shell geared towards interactive use. It's features are
focused on user friendlieness and discoverability. The language syntax
is simple but incompatible with other shell languages.
+
+
+
%prep
%setup -q
-%build
+
+
+%build
%configure docdir=%_datadir/doc/%{name}-%{version}
make %{?_smp_mflags}
+
+
+
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR="$RPM_BUILD_ROOT"
+
+
+
%clean
rm -rf $RPM_BUILD_ROOT
+
+
+
%post
if ! grep %_bindir/fish %_sysconfdir/shells >/dev/null; then
echo %_bindir/fish >>%_sysconfdir/shells
fi
+
+
+
%postun
if [ "$1" = 0 ]; then
grep -v %_bindir/fish %_sysconfdir/shells >%_sysconfdir/fish.tmp
mv %_sysconfdir/fish.tmp %_sysconfdir/shells
fi
+
+
+
%files
%defattr(-,root,root,-)
+
%doc %_datadir/doc/%{name}-%{version}
+
%_mandir/man1/fish.1*
%_mandir/man1/xsel.1x*
%_mandir/man1/mimedb.1*
@@ -54,6 +79,7 @@ fi
%_mandir/man1/count.1*
%_mandir/man1/fishd.1*
%_mandir/man1/fish_pager.1*
+
%attr(0755,root,root) %_bindir/fish
%attr(0755,root,root) %_bindir/fishd
%attr(0755,root,root) %_bindir/fish_pager
@@ -61,16 +87,26 @@ fi
%attr(0755,root,root) %_bindir/set_color
%attr(0755,root,root) %_bindir/mimedb
%attr(0755,root,root) %_bindir/count
+
%config %_sysconfdir/fish
%config %_sysconfdir/fish_inputrc
%dir %_sysconfdir/fish.d
%config %_sysconfdir/fish.d/fish_*.fish
-%dir %_sysconfdir/fish.d/completions
-%config %_sysconfdir/fish.d/completions/*.fish
-%dir %_sysconfdir/fish.d/functions
-%config %_sysconfdir/fish.d/functions/*.fish
+
+%dir %_datadir/fish
+%_datadir/fish/fish
+
+%dir %_datadir/fish/completions
+%_datadir/fish/completions/*.fish
+
+%dir %_datadir/fish/functions
+%_datadir/fish/functions/*.fish
+
%_datadir/locale/*/LC_MESSAGES/fish.mo
+
+
+
%changelog
* Tue Nov 29 2005 Axel Liljencrantz 1.17.0-0
- 1.17.0
diff --git a/function.c b/function.c
index 661f71f2d..02f034961 100644
--- a/function.c
+++ b/function.c
@@ -102,7 +102,7 @@ static void autoload_names( array_list_t *out, int get_hidden )
suffix = wcsrchr( fn, L'.' );
if( suffix && (wcscmp( suffix, L".fish" ) == 0 ) )
{
- wchar_t *dup;
+ const wchar_t *dup;
*suffix = 0;
dup = intern( fn );
if( !dup )
diff --git a/init/fish_function.fish b/init/fish_function.fish
deleted file mode 100644
index 0c0652732..000000000
--- a/init/fish_function.fish
+++ /dev/null
@@ -1,37 +0,0 @@
-
-#
-# Print the current working directory in a shortened form. This
-# function is used by the default prompt command.
-#
-
-function prevd-or-backward-word --key-binding
- if test -z (commandline)
- prevd
- else
- commandline -f backward-word
- end
-end
-
-function nextd-or-forward-word --key-binding
- if test -z (commandline)
- nextd
- else
- commandline -f forward-word
- end
-end
-
-#
-# This function deletes a character from the commandline if it is
-# non-empty, and exits the shell otherwise. Implementing this
-# functionality has been a longstanding request from various
-# fish-users.
-#
-
-function delete-or-exit --key-binding
- if test (commandline)
- commandline -f delete-char
- else
- exit
- end
-end
-
diff --git a/init/fish_interactive.fish.in b/init/fish_interactive.fish.in
deleted file mode 100644
index bbd89ab9e..000000000
--- a/init/fish_interactive.fish.in
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-# Initializations that should only be performed when in interactive mode
-#
-# @configure_input@
-
-if not status --is-interactive
- exit
-end
-
-#
-# Print a greeting
-#
-
-printf (_ 'Welcome to fish, the friendly interactive shell\n')
-printf (_ 'Type %shelp%s for instructions on how to use fish\n') (set_color green) (set_color normal)
-
-#
-# Set exit message
-#
-
-function fish_on_exit -d (_ "Commands to execute when fish exits") --on-process %self
- printf (_ "Good bye\n")
-end
-
-#
-# Set INPUTRC to something nice
-#
-# We override INPUTRC if already set, since it may be set by a shell
-# other than fish, which may use a different file. The new value should
-# be exported, since the fish inputrc file plays nice with other files
-# by including them when found.
-# Give priority to the default file installed with fish in
-# @SYSCONFDIR@/fish_inputrc.
-#
-
-for i in ~/.fish_inputrc @SYSCONFDIR@/fish_inputrc ~/.inputrc /etc/inputrc
- if test -f $i
- set -xg INPUTRC $i
- break
- end
-end
-
-
-#
-# Set various color values
-#
-
-function set_default -d "Set an exported universal variable, unless it has already been set"
- if not set -q $argv[1]
- set -Ux -- $argv
- end
-end
-
-function set_exported_default -d "Set an exported universal variable, unless it has already been set"
- if not set -q $argv[1]
- set -Ux -- $argv
- end
-end
-
-
-# Regular syntax highlighting colors
-set_default fish_color_normal normal
-set_default fish_color_command green
-set_default fish_color_redirection normal
-set_default fish_color_comment brown
-set_default fish_color_error red
-
-set_default fish_color_cwd green
-
-# Background color for matching quotes and parenthesis
-set_default fish_color_match cyan
-
-# Background color for search matches
-set_default fish_color_search_match purple
-
-# Pager colors
-set_default fish_pager_color_prefix cyan
-set_default fish_pager_color_completion normal
-set_default fish_pager_color_description normal
-set_default fish_pager_color_progress cyan
-
-# Directory history colors
-set_default fish_color_history_current cyan
-
-
-#
-# Setup the CDPATH variable
-#
-
-set_default CDPATH . ~
-
-#
-# Match colors for grep, if supported
-#
-
-if grep --color=auto --help 1>/dev/null 2>/dev/null
- set_exported_default GREP_COLOR '97;45'
- set_exported_default GREP_OPTIONS '--color=auto'
-end
-
-#
-# Color definitions for ls, if supported
-#
-
-if command ls --color=auto --help 1>/dev/null 2>/dev/null
-
- set -l color_document 35
- set -l color_image '01;35'
- set -l color_sound '01;35'
- set -l color_video '01;35'
- set -l color_archive '01;31'
- set -l color_command '01;32'
- set -l color_backup 37
-
- set -l default no=00 fi=00 'di=01;34' 'ln=01;36' 'pi=40;33' 'so=01;35' 'bd=40;33;01' 'cd=40;33;01' 'or=01;05;37;41' 'mi=01;05;37;41' ex=$color_command
-
- for i in .cmd .exe .com .btm .bat .sh .csh .fish
- set default $default "*$i=$color_command"
- end
-
- for i in .tar .tgz .arj .taz .lhz .zip .z .Z .gz .bz2 .bz .tz .rpm .cpio .jar .deb .rar .bin .hqx
- set default $default "*$i=$color_archive"
- end
-
- for i in .jpg .jpeg .gif .bmp .xbm .xpm .png .tif
- set default $default "*$i=$color_image"
- end
-
- for i in .mp3 .au .wav .aiff .ogg .wma
- set default $default "*$i=$color_sound"
- end
-
- for i in .avi .mpeg .mpg .divx .mov .qt .wmv .rm
- set default $default "*$i=$color_video"
- end
-
- for i in .htm .html .rtf .wpd .doc .pdf .ps .xls .swf .txt .tex .sxw .dvi INSTALL README ChangeLog
- set default $default "*$i=$color_document"
- end
-
- for i in '~' .bak
- set default $default "*$i=$color_backup"
- end
-
- set -gx LS_COLORS $default
-end
-
-
-#
-# Remove temporary functions
-#
-
-functions -e set_exported_default
-functions -e set_default
diff --git a/main.c b/main.c
index 0258f8f2e..0da1d5622 100644
--- a/main.c
+++ b/main.c
@@ -75,6 +75,7 @@ static int read_init()
env_set( L"__fish_help_dir", DOCDIR, 0);
+ eval( L"builtin cd " DATADIR L" 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd " SYSCONFDIR L" 2>/dev/null; . fish 2>/dev/null", 0, TOP );
eval( L"builtin cd 2>/dev/null;. .fish 2>/dev/null", 0, TOP );
diff --git a/init/completions/apm.fish b/share/completions/apm.fish
similarity index 100%
rename from init/completions/apm.fish
rename to share/completions/apm.fish
diff --git a/init/completions/apropos.fish b/share/completions/apropos.fish
similarity index 100%
rename from init/completions/apropos.fish
rename to share/completions/apropos.fish
diff --git a/init/completions/apt-build.fish b/share/completions/apt-build.fish
similarity index 100%
rename from init/completions/apt-build.fish
rename to share/completions/apt-build.fish
diff --git a/init/completions/apt-cache.fish b/share/completions/apt-cache.fish
similarity index 100%
rename from init/completions/apt-cache.fish
rename to share/completions/apt-cache.fish
diff --git a/init/completions/apt-cdrom.fish b/share/completions/apt-cdrom.fish
similarity index 100%
rename from init/completions/apt-cdrom.fish
rename to share/completions/apt-cdrom.fish
diff --git a/init/completions/apt-config.fish b/share/completions/apt-config.fish
similarity index 100%
rename from init/completions/apt-config.fish
rename to share/completions/apt-config.fish
diff --git a/init/completions/apt-extracttemplates.fish b/share/completions/apt-extracttemplates.fish
similarity index 100%
rename from init/completions/apt-extracttemplates.fish
rename to share/completions/apt-extracttemplates.fish
diff --git a/init/completions/apt-file.fish b/share/completions/apt-file.fish
similarity index 100%
rename from init/completions/apt-file.fish
rename to share/completions/apt-file.fish
diff --git a/init/completions/apt-ftparchive.fish b/share/completions/apt-ftparchive.fish
similarity index 100%
rename from init/completions/apt-ftparchive.fish
rename to share/completions/apt-ftparchive.fish
diff --git a/init/completions/apt-get.fish b/share/completions/apt-get.fish
similarity index 100%
rename from init/completions/apt-get.fish
rename to share/completions/apt-get.fish
diff --git a/init/completions/apt-key.fish b/share/completions/apt-key.fish
similarity index 100%
rename from init/completions/apt-key.fish
rename to share/completions/apt-key.fish
diff --git a/init/completions/apt-listbugs.fish b/share/completions/apt-listbugs.fish
similarity index 100%
rename from init/completions/apt-listbugs.fish
rename to share/completions/apt-listbugs.fish
diff --git a/init/completions/apt-listchanges.fish b/share/completions/apt-listchanges.fish
similarity index 100%
rename from init/completions/apt-listchanges.fish
rename to share/completions/apt-listchanges.fish
diff --git a/init/completions/apt-move.fish b/share/completions/apt-move.fish
similarity index 100%
rename from init/completions/apt-move.fish
rename to share/completions/apt-move.fish
diff --git a/init/completions/apt-proxy-import.fish b/share/completions/apt-proxy-import.fish
similarity index 100%
rename from init/completions/apt-proxy-import.fish
rename to share/completions/apt-proxy-import.fish
diff --git a/init/completions/apt-rdepends.fish b/share/completions/apt-rdepends.fish
similarity index 100%
rename from init/completions/apt-rdepends.fish
rename to share/completions/apt-rdepends.fish
diff --git a/init/completions/apt-setup.fish b/share/completions/apt-setup.fish
similarity index 100%
rename from init/completions/apt-setup.fish
rename to share/completions/apt-setup.fish
diff --git a/init/completions/apt-show-source.fish b/share/completions/apt-show-source.fish
similarity index 100%
rename from init/completions/apt-show-source.fish
rename to share/completions/apt-show-source.fish
diff --git a/init/completions/apt-show-versions.fish b/share/completions/apt-show-versions.fish
similarity index 100%
rename from init/completions/apt-show-versions.fish
rename to share/completions/apt-show-versions.fish
diff --git a/init/completions/apt-sortpkgs.fish b/share/completions/apt-sortpkgs.fish
similarity index 100%
rename from init/completions/apt-sortpkgs.fish
rename to share/completions/apt-sortpkgs.fish
diff --git a/init/completions/apt-spy.fish b/share/completions/apt-spy.fish
similarity index 100%
rename from init/completions/apt-spy.fish
rename to share/completions/apt-spy.fish
diff --git a/init/completions/apt-src.fish b/share/completions/apt-src.fish
similarity index 100%
rename from init/completions/apt-src.fish
rename to share/completions/apt-src.fish
diff --git a/init/completions/apt-zip-inst.fish b/share/completions/apt-zip-inst.fish
similarity index 100%
rename from init/completions/apt-zip-inst.fish
rename to share/completions/apt-zip-inst.fish
diff --git a/init/completions/apt-zip-list.fish b/share/completions/apt-zip-list.fish
similarity index 100%
rename from init/completions/apt-zip-list.fish
rename to share/completions/apt-zip-list.fish
diff --git a/init/completions/arp.fish b/share/completions/arp.fish
similarity index 100%
rename from init/completions/arp.fish
rename to share/completions/arp.fish
diff --git a/init/completions/at.fish b/share/completions/at.fish
similarity index 100%
rename from init/completions/at.fish
rename to share/completions/at.fish
diff --git a/init/completions/atd.fish b/share/completions/atd.fish
similarity index 100%
rename from init/completions/atd.fish
rename to share/completions/atd.fish
diff --git a/init/completions/atq.fish b/share/completions/atq.fish
similarity index 100%
rename from init/completions/atq.fish
rename to share/completions/atq.fish
diff --git a/init/completions/atrm.fish b/share/completions/atrm.fish
similarity index 100%
rename from init/completions/atrm.fish
rename to share/completions/atrm.fish
diff --git a/init/completions/bc.fish b/share/completions/bc.fish
similarity index 100%
rename from init/completions/bc.fish
rename to share/completions/bc.fish
diff --git a/init/completions/btdownloadcurses.py.fish b/share/completions/btdownloadcurses.py.fish
similarity index 100%
rename from init/completions/btdownloadcurses.py.fish
rename to share/completions/btdownloadcurses.py.fish
diff --git a/init/completions/btdownloadheadless.py.fish b/share/completions/btdownloadheadless.py.fish
similarity index 100%
rename from init/completions/btdownloadheadless.py.fish
rename to share/completions/btdownloadheadless.py.fish
diff --git a/init/completions/bunzip2.fish b/share/completions/bunzip2.fish
similarity index 100%
rename from init/completions/bunzip2.fish
rename to share/completions/bunzip2.fish
diff --git a/init/completions/bzcat.fish b/share/completions/bzcat.fish
similarity index 100%
rename from init/completions/bzcat.fish
rename to share/completions/bzcat.fish
diff --git a/init/completions/bzip2.fish b/share/completions/bzip2.fish
similarity index 100%
rename from init/completions/bzip2.fish
rename to share/completions/bzip2.fish
diff --git a/init/completions/bzip2recover.fish b/share/completions/bzip2recover.fish
similarity index 100%
rename from init/completions/bzip2recover.fish
rename to share/completions/bzip2recover.fish
diff --git a/init/completions/cat.fish b/share/completions/cat.fish
similarity index 100%
rename from init/completions/cat.fish
rename to share/completions/cat.fish
diff --git a/init/completions/cd.fish b/share/completions/cd.fish
similarity index 100%
rename from init/completions/cd.fish
rename to share/completions/cd.fish
diff --git a/init/completions/chgrp.fish b/share/completions/chgrp.fish
similarity index 100%
rename from init/completions/chgrp.fish
rename to share/completions/chgrp.fish
diff --git a/init/completions/chown.fish b/share/completions/chown.fish
similarity index 100%
rename from init/completions/chown.fish
rename to share/completions/chown.fish
diff --git a/init/completions/chsh.fish b/share/completions/chsh.fish
similarity index 100%
rename from init/completions/chsh.fish
rename to share/completions/chsh.fish
diff --git a/init/completions/commandline.fish b/share/completions/commandline.fish
similarity index 100%
rename from init/completions/commandline.fish
rename to share/completions/commandline.fish
diff --git a/init/completions/complete.fish b/share/completions/complete.fish
similarity index 100%
rename from init/completions/complete.fish
rename to share/completions/complete.fish
diff --git a/init/completions/configure.fish b/share/completions/configure.fish
similarity index 100%
rename from init/completions/configure.fish
rename to share/completions/configure.fish
diff --git a/init/completions/cut.fish b/share/completions/cut.fish
similarity index 100%
rename from init/completions/cut.fish
rename to share/completions/cut.fish
diff --git a/init/completions/cvs.fish b/share/completions/cvs.fish
similarity index 100%
rename from init/completions/cvs.fish
rename to share/completions/cvs.fish
diff --git a/init/completions/darcs.fish b/share/completions/darcs.fish
similarity index 100%
rename from init/completions/darcs.fish
rename to share/completions/darcs.fish
diff --git a/init/completions/date.fish b/share/completions/date.fish
similarity index 100%
rename from init/completions/date.fish
rename to share/completions/date.fish
diff --git a/init/completions/df.fish b/share/completions/df.fish
similarity index 100%
rename from init/completions/df.fish
rename to share/completions/df.fish
diff --git a/init/completions/diff.fish b/share/completions/diff.fish
similarity index 100%
rename from init/completions/diff.fish
rename to share/completions/diff.fish
diff --git a/init/completions/du.fish b/share/completions/du.fish
similarity index 100%
rename from init/completions/du.fish
rename to share/completions/du.fish
diff --git a/init/completions/echo.fish b/share/completions/echo.fish
similarity index 100%
rename from init/completions/echo.fish
rename to share/completions/echo.fish
diff --git a/init/completions/elatex.fish b/share/completions/elatex.fish
similarity index 100%
rename from init/completions/elatex.fish
rename to share/completions/elatex.fish
diff --git a/init/completions/emacs.fish b/share/completions/emacs.fish
similarity index 100%
rename from init/completions/emacs.fish
rename to share/completions/emacs.fish
diff --git a/init/completions/emerge.fish b/share/completions/emerge.fish
similarity index 100%
rename from init/completions/emerge.fish
rename to share/completions/emerge.fish
diff --git a/init/completions/etex.fish b/share/completions/etex.fish
similarity index 100%
rename from init/completions/etex.fish
rename to share/completions/etex.fish
diff --git a/init/completions/fish.fish b/share/completions/fish.fish
similarity index 100%
rename from init/completions/fish.fish
rename to share/completions/fish.fish
diff --git a/init/completions/function.fish b/share/completions/function.fish
similarity index 100%
rename from init/completions/function.fish
rename to share/completions/function.fish
diff --git a/init/completions/functions.fish b/share/completions/functions.fish
similarity index 100%
rename from init/completions/functions.fish
rename to share/completions/functions.fish
diff --git a/init/completions/fusermount.fish b/share/completions/fusermount.fish
similarity index 100%
rename from init/completions/fusermount.fish
rename to share/completions/fusermount.fish
diff --git a/init/completions/gcc.fish b/share/completions/gcc.fish
similarity index 100%
rename from init/completions/gcc.fish
rename to share/completions/gcc.fish
diff --git a/init/completions/gpg.fish b/share/completions/gpg.fish
similarity index 100%
rename from init/completions/gpg.fish
rename to share/completions/gpg.fish
diff --git a/init/completions/gprof.fish b/share/completions/gprof.fish
similarity index 100%
rename from init/completions/gprof.fish
rename to share/completions/gprof.fish
diff --git a/init/completions/grep.fish b/share/completions/grep.fish
similarity index 100%
rename from init/completions/grep.fish
rename to share/completions/grep.fish
diff --git a/init/completions/gunzip.fish b/share/completions/gunzip.fish
similarity index 100%
rename from init/completions/gunzip.fish
rename to share/completions/gunzip.fish
diff --git a/init/completions/gzip.fish b/share/completions/gzip.fish
similarity index 100%
rename from init/completions/gzip.fish
rename to share/completions/gzip.fish
diff --git a/init/completions/help.fish b/share/completions/help.fish
similarity index 100%
rename from init/completions/help.fish
rename to share/completions/help.fish
diff --git a/init/completions/id.fish b/share/completions/id.fish
similarity index 100%
rename from init/completions/id.fish
rename to share/completions/id.fish
diff --git a/init/completions/ifconfig.fish b/share/completions/ifconfig.fish
similarity index 100%
rename from init/completions/ifconfig.fish
rename to share/completions/ifconfig.fish
diff --git a/init/completions/jobs.fish b/share/completions/jobs.fish
similarity index 100%
rename from init/completions/jobs.fish
rename to share/completions/jobs.fish
diff --git a/init/completions/kill.fish b/share/completions/kill.fish
similarity index 100%
rename from init/completions/kill.fish
rename to share/completions/kill.fish
diff --git a/init/completions/la.fish b/share/completions/la.fish
similarity index 100%
rename from init/completions/la.fish
rename to share/completions/la.fish
diff --git a/init/completions/latex.fish b/share/completions/latex.fish
similarity index 100%
rename from init/completions/latex.fish
rename to share/completions/latex.fish
diff --git a/init/completions/less.fish b/share/completions/less.fish
similarity index 100%
rename from init/completions/less.fish
rename to share/completions/less.fish
diff --git a/init/completions/ll.fish b/share/completions/ll.fish
similarity index 100%
rename from init/completions/ll.fish
rename to share/completions/ll.fish
diff --git a/init/completions/ls.fish b/share/completions/ls.fish
similarity index 100%
rename from init/completions/ls.fish
rename to share/completions/ls.fish
diff --git a/init/completions/make.fish b/share/completions/make.fish
similarity index 100%
rename from init/completions/make.fish
rename to share/completions/make.fish
diff --git a/init/completions/makedepend.fish b/share/completions/makedepend.fish
similarity index 100%
rename from init/completions/makedepend.fish
rename to share/completions/makedepend.fish
diff --git a/init/completions/man.fish b/share/completions/man.fish
similarity index 100%
rename from init/completions/man.fish
rename to share/completions/man.fish
diff --git a/init/completions/mimedb.fish b/share/completions/mimedb.fish
similarity index 100%
rename from init/completions/mimedb.fish
rename to share/completions/mimedb.fish
diff --git a/init/completions/modprobe.fish b/share/completions/modprobe.fish
similarity index 100%
rename from init/completions/modprobe.fish
rename to share/completions/modprobe.fish
diff --git a/init/completions/mount.fish b/share/completions/mount.fish
similarity index 100%
rename from init/completions/mount.fish
rename to share/completions/mount.fish
diff --git a/init/completions/mplayer.fish b/share/completions/mplayer.fish
similarity index 100%
rename from init/completions/mplayer.fish
rename to share/completions/mplayer.fish
diff --git a/init/completions/mv.fish b/share/completions/mv.fish
similarity index 100%
rename from init/completions/mv.fish
rename to share/completions/mv.fish
diff --git a/init/completions/nextd.fish b/share/completions/nextd.fish
similarity index 100%
rename from init/completions/nextd.fish
rename to share/completions/nextd.fish
diff --git a/init/completions/nice.fish b/share/completions/nice.fish
similarity index 100%
rename from init/completions/nice.fish
rename to share/completions/nice.fish
diff --git a/init/completions/omega.fish b/share/completions/omega.fish
similarity index 100%
rename from init/completions/omega.fish
rename to share/completions/omega.fish
diff --git a/init/completions/pdfelatex.fish b/share/completions/pdfelatex.fish
similarity index 100%
rename from init/completions/pdfelatex.fish
rename to share/completions/pdfelatex.fish
diff --git a/init/completions/pdfetex.fish b/share/completions/pdfetex.fish
similarity index 100%
rename from init/completions/pdfetex.fish
rename to share/completions/pdfetex.fish
diff --git a/init/completions/pdflatex.fish b/share/completions/pdflatex.fish
similarity index 100%
rename from init/completions/pdflatex.fish
rename to share/completions/pdflatex.fish
diff --git a/init/completions/pdftex.fish b/share/completions/pdftex.fish
similarity index 100%
rename from init/completions/pdftex.fish
rename to share/completions/pdftex.fish
diff --git a/init/completions/perl.fish b/share/completions/perl.fish
similarity index 100%
rename from init/completions/perl.fish
rename to share/completions/perl.fish
diff --git a/init/completions/pine.fish b/share/completions/pine.fish
similarity index 100%
rename from init/completions/pine.fish
rename to share/completions/pine.fish
diff --git a/init/completions/ping.fish b/share/completions/ping.fish
similarity index 100%
rename from init/completions/ping.fish
rename to share/completions/ping.fish
diff --git a/init/completions/prevd.fish b/share/completions/prevd.fish
similarity index 100%
rename from init/completions/prevd.fish
rename to share/completions/prevd.fish
diff --git a/init/completions/ps.fish b/share/completions/ps.fish
similarity index 100%
rename from init/completions/ps.fish
rename to share/completions/ps.fish
diff --git a/init/completions/pushd.fish b/share/completions/pushd.fish
similarity index 100%
rename from init/completions/pushd.fish
rename to share/completions/pushd.fish
diff --git a/init/completions/python.fish b/share/completions/python.fish
similarity index 100%
rename from init/completions/python.fish
rename to share/completions/python.fish
diff --git a/init/completions/read.fish b/share/completions/read.fish
similarity index 100%
rename from init/completions/read.fish
rename to share/completions/read.fish
diff --git a/init/completions/renice.fish b/share/completions/renice.fish
similarity index 100%
rename from init/completions/renice.fish
rename to share/completions/renice.fish
diff --git a/init/completions/rm.fish b/share/completions/rm.fish
similarity index 100%
rename from init/completions/rm.fish
rename to share/completions/rm.fish
diff --git a/init/completions/rmdir.fish b/share/completions/rmdir.fish
similarity index 100%
rename from init/completions/rmdir.fish
rename to share/completions/rmdir.fish
diff --git a/init/completions/rpm.fish b/share/completions/rpm.fish
similarity index 100%
rename from init/completions/rpm.fish
rename to share/completions/rpm.fish
diff --git a/init/completions/ruby.fish b/share/completions/ruby.fish
similarity index 100%
rename from init/completions/ruby.fish
rename to share/completions/ruby.fish
diff --git a/init/completions/scp.fish b/share/completions/scp.fish
similarity index 100%
rename from init/completions/scp.fish
rename to share/completions/scp.fish
diff --git a/init/completions/screen.fish b/share/completions/screen.fish
similarity index 100%
rename from init/completions/screen.fish
rename to share/completions/screen.fish
diff --git a/init/completions/sed.fish b/share/completions/sed.fish
similarity index 100%
rename from init/completions/sed.fish
rename to share/completions/sed.fish
diff --git a/init/completions/service.fish b/share/completions/service.fish
similarity index 100%
rename from init/completions/service.fish
rename to share/completions/service.fish
diff --git a/init/completions/set.fish b/share/completions/set.fish
similarity index 100%
rename from init/completions/set.fish
rename to share/completions/set.fish
diff --git a/init/completions/set_color.fish b/share/completions/set_color.fish
similarity index 100%
rename from init/completions/set_color.fish
rename to share/completions/set_color.fish
diff --git a/init/completions/sort.fish b/share/completions/sort.fish
similarity index 100%
rename from init/completions/sort.fish
rename to share/completions/sort.fish
diff --git a/init/completions/ssh.fish b/share/completions/ssh.fish
similarity index 100%
rename from init/completions/ssh.fish
rename to share/completions/ssh.fish
diff --git a/init/completions/sshfs.fish b/share/completions/sshfs.fish
similarity index 100%
rename from init/completions/sshfs.fish
rename to share/completions/sshfs.fish
diff --git a/init/completions/status.fish b/share/completions/status.fish
similarity index 100%
rename from init/completions/status.fish
rename to share/completions/status.fish
diff --git a/init/completions/su.fish b/share/completions/su.fish
similarity index 100%
rename from init/completions/su.fish
rename to share/completions/su.fish
diff --git a/init/completions/sudo.fish b/share/completions/sudo.fish
similarity index 100%
rename from init/completions/sudo.fish
rename to share/completions/sudo.fish
diff --git a/init/completions/svn.fish b/share/completions/svn.fish
similarity index 100%
rename from init/completions/svn.fish
rename to share/completions/svn.fish
diff --git a/init/completions/tar.fish b/share/completions/tar.fish
similarity index 100%
rename from init/completions/tar.fish
rename to share/completions/tar.fish
diff --git a/init/completions/test.fish b/share/completions/test.fish
similarity index 100%
rename from init/completions/test.fish
rename to share/completions/test.fish
diff --git a/init/completions/tex.fish b/share/completions/tex.fish
similarity index 100%
rename from init/completions/tex.fish
rename to share/completions/tex.fish
diff --git a/init/completions/time.fish b/share/completions/time.fish
similarity index 100%
rename from init/completions/time.fish
rename to share/completions/time.fish
diff --git a/init/completions/top.fish b/share/completions/top.fish
similarity index 100%
rename from init/completions/top.fish
rename to share/completions/top.fish
diff --git a/init/completions/touch.fish b/share/completions/touch.fish
similarity index 100%
rename from init/completions/touch.fish
rename to share/completions/touch.fish
diff --git a/init/completions/trap.fish b/share/completions/trap.fish
similarity index 100%
rename from init/completions/trap.fish
rename to share/completions/trap.fish
diff --git a/init/completions/type.fish b/share/completions/type.fish
similarity index 100%
rename from init/completions/type.fish
rename to share/completions/type.fish
diff --git a/init/completions/ulimit.fish b/share/completions/ulimit.fish
similarity index 100%
rename from init/completions/ulimit.fish
rename to share/completions/ulimit.fish
diff --git a/init/completions/umount.fish b/share/completions/umount.fish
similarity index 100%
rename from init/completions/umount.fish
rename to share/completions/umount.fish
diff --git a/init/completions/uname.fish b/share/completions/uname.fish
similarity index 100%
rename from init/completions/uname.fish
rename to share/completions/uname.fish
diff --git a/init/completions/uniq.fish b/share/completions/uniq.fish
similarity index 100%
rename from init/completions/uniq.fish
rename to share/completions/uniq.fish
diff --git a/init/completions/valgrind.fish b/share/completions/valgrind.fish
similarity index 100%
rename from init/completions/valgrind.fish
rename to share/completions/valgrind.fish
diff --git a/init/completions/vared.fish b/share/completions/vared.fish
similarity index 100%
rename from init/completions/vared.fish
rename to share/completions/vared.fish
diff --git a/init/completions/w.fish b/share/completions/w.fish
similarity index 100%
rename from init/completions/w.fish
rename to share/completions/w.fish
diff --git a/init/completions/wc.fish b/share/completions/wc.fish
similarity index 100%
rename from init/completions/wc.fish
rename to share/completions/wc.fish
diff --git a/init/completions/wget.fish b/share/completions/wget.fish
similarity index 100%
rename from init/completions/wget.fish
rename to share/completions/wget.fish
diff --git a/init/completions/whatis.fish b/share/completions/whatis.fish
similarity index 100%
rename from init/completions/whatis.fish
rename to share/completions/whatis.fish
diff --git a/init/completions/who.fish b/share/completions/who.fish
similarity index 100%
rename from init/completions/who.fish
rename to share/completions/who.fish
diff --git a/init/completions/xprop.fish b/share/completions/xprop.fish
similarity index 100%
rename from init/completions/xprop.fish
rename to share/completions/xprop.fish
diff --git a/init/completions/xsel.fish b/share/completions/xsel.fish
similarity index 100%
rename from init/completions/xsel.fish
rename to share/completions/xsel.fish
diff --git a/init/completions/yum.fish b/share/completions/yum.fish
similarity index 100%
rename from init/completions/yum.fish
rename to share/completions/yum.fish
diff --git a/init/completions/zcat.fish b/share/completions/zcat.fish
similarity index 100%
rename from init/completions/zcat.fish
rename to share/completions/zcat.fish
diff --git a/init/completions/zip.fish b/share/completions/zip.fish
similarity index 100%
rename from init/completions/zip.fish
rename to share/completions/zip.fish
diff --git a/init/fish_complete.fish.in b/share/fish
similarity index 95%
rename from init/fish_complete.fish.in
rename to share/fish
index 64b8ab180..9877edd58 100644
--- a/init/fish_complete.fish.in
+++ b/share/fish
@@ -1,8 +1,13 @@
+#
# 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@
+
+#
+# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish.
+#
+set -g fish_function_path
#
# Don't need completions in non-interactive mode
@@ -12,8 +17,6 @@ if not status --is-interactive
exit
end
-set -g fish_complete_path @SYSCONFDIR@/fish.d/completions ~/.fish.d/completions
-
#
# Convenience functions
#
diff --git a/init/functions/__fish_complete_bittorrent.fish b/share/functions/__fish_complete_bittorrent.fish
similarity index 100%
rename from init/functions/__fish_complete_bittorrent.fish
rename to share/functions/__fish_complete_bittorrent.fish
diff --git a/init/functions/__fish_complete_directory.fish b/share/functions/__fish_complete_directory.fish
similarity index 100%
rename from init/functions/__fish_complete_directory.fish
rename to share/functions/__fish_complete_directory.fish
diff --git a/init/functions/__fish_complete_ls.fish b/share/functions/__fish_complete_ls.fish
similarity index 100%
rename from init/functions/__fish_complete_ls.fish
rename to share/functions/__fish_complete_ls.fish
diff --git a/init/functions/__fish_complete_man.fish b/share/functions/__fish_complete_man.fish
similarity index 100%
rename from init/functions/__fish_complete_man.fish
rename to share/functions/__fish_complete_man.fish
diff --git a/init/functions/__fish_complete_pids.fish b/share/functions/__fish_complete_pids.fish
similarity index 100%
rename from init/functions/__fish_complete_pids.fish
rename to share/functions/__fish_complete_pids.fish
diff --git a/init/functions/__fish_complete_ssh.fish b/share/functions/__fish_complete_ssh.fish
similarity index 100%
rename from init/functions/__fish_complete_ssh.fish
rename to share/functions/__fish_complete_ssh.fish
diff --git a/init/functions/__fish_complete_subcommand.fish b/share/functions/__fish_complete_subcommand.fish
similarity index 100%
rename from init/functions/__fish_complete_subcommand.fish
rename to share/functions/__fish_complete_subcommand.fish
diff --git a/init/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish
similarity index 100%
rename from init/functions/__fish_complete_suffix.fish
rename to share/functions/__fish_complete_suffix.fish
diff --git a/init/functions/__fish_complete_tex.fish b/share/functions/__fish_complete_tex.fish
similarity index 100%
rename from init/functions/__fish_complete_tex.fish
rename to share/functions/__fish_complete_tex.fish
diff --git a/init/functions/__fish_contains_opt.fish b/share/functions/__fish_contains_opt.fish
similarity index 100%
rename from init/functions/__fish_contains_opt.fish
rename to share/functions/__fish_contains_opt.fish
diff --git a/init/functions/__fish_describe_command.fish b/share/functions/__fish_describe_command.fish
similarity index 100%
rename from init/functions/__fish_describe_command.fish
rename to share/functions/__fish_describe_command.fish
diff --git a/init/functions/__fish_gnu_complete.fish b/share/functions/__fish_gnu_complete.fish
similarity index 100%
rename from init/functions/__fish_gnu_complete.fish
rename to share/functions/__fish_gnu_complete.fish
diff --git a/init/functions/__fish_is_first_token.fish b/share/functions/__fish_is_first_token.fish
similarity index 100%
rename from init/functions/__fish_is_first_token.fish
rename to share/functions/__fish_is_first_token.fish
diff --git a/init/functions/__fish_list_current_token.fish b/share/functions/__fish_list_current_token.fish
similarity index 100%
rename from init/functions/__fish_list_current_token.fish
rename to share/functions/__fish_list_current_token.fish
diff --git a/init/functions/__fish_move_last.fish b/share/functions/__fish_move_last.fish
similarity index 100%
rename from init/functions/__fish_move_last.fish
rename to share/functions/__fish_move_last.fish
diff --git a/init/functions/__fish_no_arguments.fish b/share/functions/__fish_no_arguments.fish
similarity index 100%
rename from init/functions/__fish_no_arguments.fish
rename to share/functions/__fish_no_arguments.fish
diff --git a/init/functions/__fish_print_filesystems.fish b/share/functions/__fish_print_filesystems.fish
similarity index 100%
rename from init/functions/__fish_print_filesystems.fish
rename to share/functions/__fish_print_filesystems.fish
diff --git a/init/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish
similarity index 100%
rename from init/functions/__fish_print_hostnames.fish
rename to share/functions/__fish_print_hostnames.fish
diff --git a/init/functions/__fish_print_packages.fish b/share/functions/__fish_print_packages.fish
similarity index 100%
rename from init/functions/__fish_print_packages.fish
rename to share/functions/__fish_print_packages.fish
diff --git a/init/functions/cd.fish b/share/functions/cd.fish
similarity index 100%
rename from init/functions/cd.fish
rename to share/functions/cd.fish
diff --git a/init/functions/contains.fish b/share/functions/contains.fish
similarity index 100%
rename from init/functions/contains.fish
rename to share/functions/contains.fish
diff --git a/share/functions/delete-or-exit.fish b/share/functions/delete-or-exit.fish
new file mode 100644
index 000000000..3e030f799
--- /dev/null
+++ b/share/functions/delete-or-exit.fish
@@ -0,0 +1,15 @@
+#
+# This function deletes a character from the commandline if it is
+# non-empty, and exits the shell otherwise. Implementing this
+# functionality has been a longstanding request from various
+# fish-users.
+#
+
+function delete-or-exit --key-binding
+ if test (commandline)
+ commandline -f delete-char
+ else
+ exit
+ end
+end
+
diff --git a/init/functions/dirh.fish b/share/functions/dirh.fish
similarity index 100%
rename from init/functions/dirh.fish
rename to share/functions/dirh.fish
diff --git a/init/functions/dirs.fish b/share/functions/dirs.fish
similarity index 100%
rename from init/functions/dirs.fish
rename to share/functions/dirs.fish
diff --git a/init/functions/fish_prompt.fish b/share/functions/fish_prompt.fish
similarity index 100%
rename from init/functions/fish_prompt.fish
rename to share/functions/fish_prompt.fish
diff --git a/init/functions/help.fish b/share/functions/help.fish
similarity index 100%
rename from init/functions/help.fish
rename to share/functions/help.fish
diff --git a/init/functions/la.fish b/share/functions/la.fish
similarity index 100%
rename from init/functions/la.fish
rename to share/functions/la.fish
diff --git a/init/functions/ll.fish b/share/functions/ll.fish
similarity index 100%
rename from init/functions/ll.fish
rename to share/functions/ll.fish
diff --git a/init/functions/ls.fish b/share/functions/ls.fish
similarity index 100%
rename from init/functions/ls.fish
rename to share/functions/ls.fish
diff --git a/share/functions/nextd-or-forward-word.fish b/share/functions/nextd-or-forward-word.fish
new file mode 100644
index 000000000..3407f6802
--- /dev/null
+++ b/share/functions/nextd-or-forward-word.fish
@@ -0,0 +1,8 @@
+
+function nextd-or-forward-word --key-binding
+ if test -z (commandline)
+ nextd
+ else
+ commandline -f forward-word
+ end
+end
diff --git a/init/functions/nextd.fish b/share/functions/nextd.fish
similarity index 100%
rename from init/functions/nextd.fish
rename to share/functions/nextd.fish
diff --git a/init/functions/open.fish b/share/functions/open.fish
similarity index 100%
rename from init/functions/open.fish
rename to share/functions/open.fish
diff --git a/init/functions/popd.fish b/share/functions/popd.fish
similarity index 100%
rename from init/functions/popd.fish
rename to share/functions/popd.fish
diff --git a/share/functions/prevd-or-backward-word.fish b/share/functions/prevd-or-backward-word.fish
new file mode 100644
index 000000000..e06a05a7b
--- /dev/null
+++ b/share/functions/prevd-or-backward-word.fish
@@ -0,0 +1,8 @@
+function prevd-or-backward-word --key-binding
+ if test -z (commandline)
+ prevd
+ else
+ commandline -f backward-word
+ end
+end
+
diff --git a/init/functions/prevd.fish b/share/functions/prevd.fish
similarity index 100%
rename from init/functions/prevd.fish
rename to share/functions/prevd.fish
diff --git a/init/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish
similarity index 100%
rename from init/functions/prompt_pwd.fish
rename to share/functions/prompt_pwd.fish
diff --git a/init/functions/psub.fish b/share/functions/psub.fish
similarity index 100%
rename from init/functions/psub.fish
rename to share/functions/psub.fish
diff --git a/init/functions/pushd.fish b/share/functions/pushd.fish
similarity index 100%
rename from init/functions/pushd.fish
rename to share/functions/pushd.fish
diff --git a/init/functions/pwd.fish b/share/functions/pwd.fish
similarity index 100%
rename from init/functions/pwd.fish
rename to share/functions/pwd.fish
diff --git a/init/functions/trap.fish b/share/functions/trap.fish
similarity index 100%
rename from init/functions/trap.fish
rename to share/functions/trap.fish
diff --git a/init/functions/type.fish b/share/functions/type.fish
similarity index 100%
rename from init/functions/type.fish
rename to share/functions/type.fish
diff --git a/init/functions/umask.fish b/share/functions/umask.fish
similarity index 100%
rename from init/functions/umask.fish
rename to share/functions/umask.fish
diff --git a/init/functions/vared.fish b/share/functions/vared.fish
similarity index 100%
rename from init/functions/vared.fish
rename to share/functions/vared.fish