From e2d9ad8ff4d6e2d0094b49d97b520631b62ea933 Mon Sep 17 00:00:00 2001
From: Bruno Pinto <brunoferreirapinto@gmail.com>
Date: Tue, 26 May 2015 14:28:06 +0100
Subject: [PATCH] new Plugin and Theme functions

---
 functions/Plugin.fish |  9 +++++++++
 functions/Theme.fish  |  9 +++++++++
 oh-my-fish.fish       | 12 ++++++++++++
 templates/config.fish | 13 +++++--------
 4 files changed, 35 insertions(+), 8 deletions(-)
 create mode 100644 functions/Plugin.fish
 create mode 100644 functions/Theme.fish

diff --git a/functions/Plugin.fish b/functions/Plugin.fish
new file mode 100644
index 0000000..f7defd6
--- /dev/null
+++ b/functions/Plugin.fish
@@ -0,0 +1,9 @@
+function Plugin --argument-names name
+  if [ -e $fish_path/plugins/$name -o -e $fish_custom/plugins/$name ]
+    import plugins/$name
+  else
+    set_color red
+    echo "Plugin '$name' is not installed. Run 'fish install' to download and install it."
+    set_color normal
+  end
+end
diff --git a/functions/Theme.fish b/functions/Theme.fish
new file mode 100644
index 0000000..4b6d929
--- /dev/null
+++ b/functions/Theme.fish
@@ -0,0 +1,9 @@
+function Theme --argument-names name
+  if [ -e $fish_path/themes/$name -o -e $fish_custom/themes/$name ]
+    import themes/$name
+  else
+    set_color red
+    echo "Theme '$name' is not installed. Run 'fish install' to download and install it."
+    set_color normal
+  end
+end
diff --git a/oh-my-fish.fish b/oh-my-fish.fish
index 7fb33fd..18f7b9e 100644
--- a/oh-my-fish.fish
+++ b/oh-my-fish.fish
@@ -9,6 +9,18 @@ if not contains $fish_path/functions/ $fish_function_path
   set fish_function_path $fish_path/functions/ $fish_function_path
 end
 
+if set -q fish_plugins
+  set_color red
+  echo '$fish_plugins usage has been deprecated. Please see https://asciinema.org/a/20802.'
+  set_color normal
+end
+
+if set -q fish_theme
+  set_color red
+  echo '$fish_theme usage has been deprecated. Please see https://asciinema.org/a/20802.'
+  set_color normal
+end
+
 # Add imported plugins, completions and themes. Customize imported
 # commands via the $fish_path/custom directory, for example create
 # a directory under $fish_path/custom/themes with the same name as
diff --git a/templates/config.fish b/templates/config.fish
index cf3ac0b..9020cb0 100644
--- a/templates/config.fish
+++ b/templates/config.fish
@@ -1,16 +1,13 @@
 # Path to your oh-my-fish.
 set fish_path $HOME/.oh-my-fish
 
-# Theme
-set fish_theme robbyrussell
-
-# All built-in plugins can be found at ~/.oh-my-fish/plugins/
-# Custom plugins may be added to ~/.oh-my-fish/custom/plugins/
-# Enable plugins by adding their name separated by a space to the line below.
-set fish_plugins theme
-
 # Path to your custom folder (default path is ~/.oh-my-fish/custom)
 #set fish_custom $HOME/dotfiles/oh-my-fish
 
 # Load oh-my-fish configuration.
 . $fish_path/oh-my-fish.fish
+
+# Custom plugins and themes may be added to ~/.oh-my-fish/custom
+# Plugins and themes can be found at https://github.com/oh-my-fish/
+Theme 'robbyrussell'
+Plugin 'theme'
-- 
GitLab