Permalink
Browse files

Add support for OS/user/host specific config files

- (uname).fish is version controlled and used for OS specific functions
- (whoami).fish is not version controlled and used for user specific settings
- (hostname).fish is not version controlled and used for host specific settings
  • Loading branch information...
Marius Mathiesen
Marius Mathiesen committed Jul 8, 2010
1 parent df02d6f commit c4b7a02dc4432609aa7ac4c38f573324d6f9abb9
Showing with 49 additions and 7 deletions.
  1. +14 −0 Darwin.fish
  2. +3 −0 Linux.fish
  3. +32 −7 config.fish
View
@@ -0,0 +1,14 @@
+# OSX specific cusomizations go here
+# This file is version controlled; to make local changes, add them to either:
+# - Your user specific file (~/.config/fish/<username>.fish)
+# - Your host specific file (~/.config/fish/<hostname>.fish)
+
+# Textmate defaults to /usr/bin/mate, but let's check for /usr/local/bin/mate
+if test -f "/usr/local/bin/mate"
+ set -x EDITOR "/usr/local/bin/mate -w"
+else
+ set -x EDITOR "/usr/bin/mate -w"
+end
+
+
+set BROWSER open
View
@@ -0,0 +1,3 @@
+# Functions specific to Linux users
+# Please note that this file is version controlled.
+# Use one of the local files (hostname or username) for user/host specific settings
View
@@ -6,13 +6,34 @@ if status --is-login
end
end
-# Textmate defaults to /usr/bin/mate, but let's check for /usr/local/bin/mate
-if test -f "/usr/local/bin/mate"
- set -x EDITOR "/usr/local/bin/mate -w"
+# Load custom settings for current hostname
+set HOST_SPECIFIC_FILE ~/.config/fish/(hostname).fish
+if test -f $HOST_SPECIFIC_FILE
+ . $HOST_SPECIFIC_FILE
+else
+ echo Creating host specific file: $HOST_SPECIFIC_FILE
+ touch $HOST_SPECIFIC_FILE
+end
+
+# Load custom settings for current user
+set USER_SPECIFIC_FILE ~/.config/fish/(whoami).fish
+if test -f $USER_SPECIFIC_FILE
+ . $USER_SPECIFIC_FILE
else
- set -x EDITOR "/usr/bin/mate -w"
+ echo Creating user specific file: $USER_SPECIFIC_FILE
+ touch $USER_SPECIFIC_FILE
end
+# Load custom settings for current OS
+set PLATFORM_SPECIFIC_FILE ~/.config/fish/(uname -s).fish
+if test -f $PLATFORM_SPECIFIC_FILE
+ . $PLATFORM_SPECIFIC_FILE
+else
+ echo Creating platform specific file: $PLATFORM_SPECIFIC_FILE
+ touch $PLATFORM_SPECIFIC_FILE
+end
+
+
set fish_greeting ""
set -x CLICOLOR 1
@@ -55,7 +76,6 @@ function fish_prompt -d "Write out the prompt"
printf '%s> ' (set_color normal)
end
-set BROWSER open
bind \cr "rake"
@@ -67,7 +87,12 @@ function sc -d "Run the Rails console"
script/console
end
-set -x JAVA_HOME "/opt/java"
+if test -d "/opt/java"
+ set -x JAVA_HOME "/opt/java"
+end
# yarrr, add /var/lib/gems/1.8/bin to path so gems installed by the retarded ubuntu rubygems package are on the path
-set -x PATH $PATH "/var/lib/gems/1.8/bin"
+set CUSTOM_GEM_PATH "/var/lib/gems/1.8/bin"
+if test -d $CUSTOM_GEM_PATH
+ set -x PATH $PATH "/var/lib/gems/1.8/bin"
+end

0 comments on commit c4b7a02

Please sign in to comment.