diff --git a/.gitignore b/.gitignore index 2d48bdff473f5b0fa7a30d13ac759dc5b9477f79..11d505315b144a5e2e8489b24cb90fa74d3a47c0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ themes/* *.sw? plugins/ta/data/* + +# Track oh-my-fish plugin +!plugins/omf/ diff --git a/README.md b/README.md index d108b75bf8e0d15b1300a28b3932b257cf871a5f..9d26d48d83b73ae1801854e45b9244ff328da7f0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ If you want to install it manually, [click here](https://github.com/bpinto/oh-my ## Usage -Open your fish configuration file `~/.config/fish/config.fish` and specify the theme and the plugins you want to use. And then run `fish install` on your terminal to install them. +Open your fish configuration file `~/.config/fish/config.fish` and specify the theme and the plugins you want to use. And then run `omf install` on your terminal to install them. Before setting down on a theme, you might want to have a go with all themes using our quick [theme switcher](https://github.com/bpinto/oh-my-fish/blob/master/plugins/theme/README.md) by typing `theme --help` on your shell. diff --git a/functions/Plugin.fish b/functions/Plugin.fish index fcd0513ec2f86525c5d974242a268054cc9e78f4..85a86ab32dc89ac271ea05580e216d08783c274c 100644 --- a/functions/Plugin.fish +++ b/functions/Plugin.fish @@ -5,7 +5,7 @@ function Plugin --argument-names name import plugins/$name else set_color red - echo "Plugin '$name' is not installed. Run 'fish install' to download and install it." + echo "Plugin '$name' is not installed. Run 'omf install' to download and install it." set_color normal end end diff --git a/functions/Theme.fish b/functions/Theme.fish index 546ea5b0cad5c32b8cc2dfacf0b36d97c127490b..ec316d485fca67aea97860ad86ed9aeab1f3efc1 100644 --- a/functions/Theme.fish +++ b/functions/Theme.fish @@ -5,7 +5,7 @@ function Theme --argument-names name import themes/$name else set_color red - echo "Theme '$name' is not installed. Run 'fish install' to download and install it." + echo "Theme '$name' is not installed. Run 'omf install' to download and install it." set_color normal end end diff --git a/oh-my-fish.fish b/oh-my-fish.fish index 18f7b9e82a34105495e9f06b3e09e79791952bdf..3cece54f077ad3cdf6ec264fad6845058d1ab975 100644 --- a/oh-my-fish.fish +++ b/oh-my-fish.fish @@ -28,6 +28,9 @@ end # repeat for plugins. import plugins/$fish_plugins themes/$fish_theme +# Always load oh-my-fish plugin +import plugins/omf + # Source all files inside custom directory. for load in $fish_custom/*.load . $load diff --git a/functions/fish.fish b/plugins/omf/omf.fish similarity index 54% rename from functions/fish.fish rename to plugins/omf/omf.fish index 51791abdfb7464a86311ae0d6e12479d8ef3aca9..7eabbf4777a2c9d5198e6a9e32cafb24f80504c7 100644 --- a/functions/fish.fish +++ b/plugins/omf/omf.fish @@ -1,20 +1,20 @@ # NAME -# fish - Extend default fish binary +# omf - Oh My Fish helper # # DESCRIPTION # Extend fish binary to support plugins and themes installation # -function fish -d "Extend fish binary" +function omf -d "Oh My Fish helper" if test (count $argv) -gt 0 switch $argv[1] case 'install' - fish.packages --install + omf.packages --install case 'update' - fish.packages --update + omf.packages --update case '*' - command fish $argv + omf.helper end else - command fish + omf.helper end end diff --git a/plugins/omf/omf.helper.fish b/plugins/omf/omf.helper.fish new file mode 100644 index 0000000000000000000000000000000000000000..5179dccec6ef4cd7dc7c6d7e29674b5ba86deccc --- /dev/null +++ b/plugins/omf/omf.helper.fish @@ -0,0 +1,15 @@ +# NAME +# omf.helper - Prints Oh My Fish help +# +# DESCRIPTION +# Prints all functions supported by Oh My Fish helper +# +function omf.helper -d 'Prints all functions supported by Oh My Fish helper' + omf.log normal 'Oh My Fish is a package manager for fish shell. This is a' + omf.log normal 'basic help message containing pointers to more information.' + omf.log normal '' + omf.log normal ' Examples:' + omf.log normal ' omf install' + omf.log normal ' omf update' +end + diff --git a/functions/fish.log.fish b/plugins/omf/omf.log.fish similarity index 78% rename from functions/fish.log.fish rename to plugins/omf/omf.log.fish index 55eb3a8892004865c07acf324ff773bc878c5243..7b17aab13a125bc5d9b22fad1cb832bd06e7c0e9 100644 --- a/functions/fish.log.fish +++ b/plugins/omf/omf.log.fish @@ -1,5 +1,5 @@ # NAME -# fish.log - simple log with color +# omf.log - simple log with color # # SYNOPSIS # <string> [<string>...] @@ -7,7 +7,7 @@ # DESCRIPTION # Simply log a message with a specified color. # -function fish.log -d "Simple log with color" +function omf.log -d "Simple log with color" switch $argv[1] case '-*' echo $argv[1] (set_color $argv[2])$argv[3..-1](set_color normal) diff --git a/functions/fish.packages.fish b/plugins/omf/omf.packages.fish similarity index 57% rename from functions/fish.packages.fish rename to plugins/omf/omf.packages.fish index 857e438961fafb1f0e2e57fc453ed8f23caada81..3c08261410179249546b0658f88c6d17439cbeb7 100644 --- a/functions/fish.packages.fish +++ b/plugins/omf/omf.packages.fish @@ -1,8 +1,8 @@ # NAME -# fish.packages - Manage all plugins and themes +# omf.packages - Manage all plugins and themes # # SYNOPSIS -# fish.packages [OPTIONS] +# omf.packages [OPTIONS] # # OPTIONS # --install @@ -14,15 +14,15 @@ # Manage all plugins and themes specified on the $fish_plugins # and $fish_theme variables # -function fish.packages --argument-names options -d 'Manage all plugins and themes' +function omf.packages --argument-names options -d 'Manage all plugins and themes' set -l modified_packages 0 switch $options case "--install" - fish.packages.install + omf.packages.install case "--update" - fish.packages.update + omf.packages.update case "*" - fish.log red 'Unknown option' + omf.log red 'Unknown option' end end diff --git a/functions/fish.packages.install.fish b/plugins/omf/omf.packages.install.fish similarity index 71% rename from functions/fish.packages.install.fish rename to plugins/omf/omf.packages.install.fish index 57830d330100d1a3b8a2e80771895333aa07fc7e..ac8dbe367fa0f3557ddd8f44227cee2c891125f5 100644 --- a/functions/fish.packages.install.fish +++ b/plugins/omf/omf.packages.install.fish @@ -1,11 +1,11 @@ # NAME -# fish.packages.install - Install all plugins and themes +# omf.packages.install - Install all plugins and themes # # DESCRIPTION # Install all plugins and themes specified on the $fish_plugins # and $fish_theme variables # -function fish.packages.install -d "Install all plugins and themes" +function omf.packages.install -d "Install all plugins and themes" set -l installed_packages 0 # Plugins @@ -13,9 +13,9 @@ function fish.packages.install -d "Install all plugins and themes" if [ -e $fish_path/plugins/$plugin -o -e $fish_custom/plugins/$plugin ] #echo "$plugin is already installed. Skipping." else - fish.log -n white "Installing $plugin... " + omf.log -n white "Installing $plugin... " git clone "https://github.com/oh-my-fish/plugins-$plugin" $fish_path/plugins/$plugin ^ /dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 end end @@ -24,13 +24,13 @@ function fish.packages.install -d "Install all plugins and themes" if [ -e $fish_path/themes/$fish_theme -o -e $fish_custom/themes/$fish_theme ] #echo "$fish_theme is already installed. Skipping." else - fish.log -n white "Installing $fish_theme... " + omf.log -n white "Installing $fish_theme... " git clone "https://github.com/oh-my-fish/themes-$fish_theme" $fish_path/themes/$fish_theme ^ /dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 end if [ $installed_packages -eq 0 ] - fish.log green 'All plugins were already installed.' + omf.log green 'All plugins were already installed.' end end diff --git a/functions/fish.packages.update.fish b/plugins/omf/omf.packages.update.fish similarity index 73% rename from functions/fish.packages.update.fish rename to plugins/omf/omf.packages.update.fish index 513ce465e38bb6baf6487fe22e03c9082efaaf61..7075834e9fe95a7254dcec1b1a411f27138834ef 100644 --- a/functions/fish.packages.update.fish +++ b/plugins/omf/omf.packages.update.fish @@ -1,26 +1,26 @@ # NAME -# fish.packages.update - Update all plugins and themes +# omf.packages.update - Update all plugins and themes # # DESCRIPTION # Update all plugins and themes specified on the $fish_plugins # and $fish_theme variables # -function fish.packages.update -d "Update all plugins and themes" +function omf.packages.update -d "Update all plugins and themes" set -l installed_packages 0 pushd # Plugins for plugin in $fish_plugins if [ -e $fish_path/plugins/$plugin -a -e $fish_path/plugins/$plugin/.git ] - fish.log -n white "Updating $plugin... " + omf.log -n white "Updating $plugin... " echo (cd $fish_path/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 else if [ -e $fish_custom/plugins/$plugin -a -e $fish_custom/plugins/$plugin/.git ] - fish.log -n white "Updating $plugin... " + omf.log -n white "Updating $plugin... " echo (cd $fish_custom/plugins/$plugin; and git pull --rebase > /dev/null) >/dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 else #echo "$plugin is not installed or not a git repo. Skipping." @@ -30,15 +30,15 @@ function fish.packages.update -d "Update all plugins and themes" # Theme if [ -e $fish_path/themes/$fish_theme -a -e $fish_path/themes/$fish_theme/.git ] - fish.log -n white "Updating $fish_theme... " + omf.log -n white "Updating $fish_theme... " echo (cd $fish_path/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 else if [ -e $fish_custom/themes/$fish_theme -a -e $fish_custom/themes/$fish_theme/.git ] - fish.log -n white "Updating $fish_theme... " + omf.log -n white "Updating $fish_theme... " echo (cd $fish_custom/themes/$fish_theme; and git pull --rebase > /dev/null) >/dev/null - fish.log green "√" + omf.log green "√" set -l installed_packages 1 else #echo "$fish_theme is not installed or not a git repo. Skipping." @@ -46,7 +46,7 @@ function fish.packages.update -d "Update all plugins and themes" end if [ $installed_packages -eq 0 ] - fish.log green 'No plugins to update.' + omf.log green 'No plugins to update.' end popd