From 6288f89bf95273cbce8437cfd6466cf8fc80850b Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 6 Mar 2016 15:28:54 +0100 Subject: Move code in etc/config.fish to share/config.fish instead add a bit of information on how fish's configuration works for the admin to etc/config.fish. This means that fish is fully functional without /etc, which might be nice for "stateless" systems. --- etc/config.fish | 44 ++++++++++++++------------------------------ share/config.fish | 29 +++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/etc/config.fish b/etc/config.fish index f4126d36..9be6f072 100644 --- a/etc/config.fish +++ b/etc/config.fish @@ -1,30 +1,14 @@ -# -# Init file for fish -# - -# -# Some things should only be done for login terminals -# - -if status --is-login - - # Check for i18n information in - # /etc/sysconfig/i18n - - if test -f /etc/sysconfig/i18n - eval (cat /etc/sysconfig/i18n |sed -ne 's/^\([a-zA-Z]*\)=\(.*\)$/set -gx \1 \2;/p') - end - - # - # Put linux consoles in unicode mode. - # - - if test "$TERM" = linux - if expr "$LANG" : ".*\.[Uu][Tt][Ff].*" >/dev/null - if which unicode_start >/dev/null - unicode_start - end - end - end -end - +# Put system-wide fish configuration entries here +# or in .fish files in conf.d/ +# Files in conf.d can be overridden by the user +# by files with the same name in $XDG_CONFIG_HOME/fish/conf.d + +# This file is run by all fish instances. +# To include configuration only for login shells, use +# if status --is-login +# ... +# end +# To include configuration only for interactive shells, use +# if status --is-interactiv +# ... +# end diff --git a/share/config.fish b/share/config.fish index b7a461c3..9ed3250a 100644 --- a/share/config.fish +++ b/share/config.fish @@ -176,3 +176,32 @@ if not set -q __fish_init_2_3_0 set fish_user_abbreviations $fab set -U __fish_init_2_3_0 end + +# +# Some things should only be done for login terminals +# This used to be in etc/config.fish - keep it here to keep the semantics +# + +if status --is-login + + # Check for i18n information in + # /etc/sysconfig/i18n + + if test -f /etc/sysconfig/i18n + string match -r '^[a-zA-Z]*=.*' < /etc/sysconfig/i18n | while read -l line + set -gx (string split '=' -m 1 -- $line | string replace -ra '"([^"]+)"' '$1' | string replace -ra "'([^']+)'" '$1') + end + end + + # + # Put linux consoles in unicode mode. + # + + if test "$TERM" = linux + if string match -qir '\.UTF' -- $LANG + if command -s unicode_start >/dev/null + unicode_start + end + end + end +end -- cgit v1.2.3