Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
oh-my-fish
Commits
8217eac3
Commit
8217eac3
authored
Jun 29, 2016
by
Derek Stavis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
themes: supercharge require to also load themes
parent
f79cd118
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
16 deletions
+27
-16
init.fish
init.fish
+3
-1
lib/require.fish
lib/require.fish
+18
-12
pkg/omf/functions/themes/omf.theme.set.fish
pkg/omf/functions/themes/omf.theme.set.fish
+6
-3
No files found.
init.fish
View file @
8217eac3
...
...
@@ -15,12 +15,14 @@ set -l theme_function_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme{,/functions}
# Autoload core library
set fish_function_path $fish_function_path[1] \
$core_function_path \
$theme_function_path \
$fish_function_path[2..-1]
# Require all packages
emit perf:timer:start "Oh My Fish init installed packages"
require --path {$OMF_PATH,$OMF_CONFIG}/pkg/*
emit perf:timer:finish "Oh My Fish init installed packages"
emit perf:timer:start "Oh My Fish init selected theme"
require --theme $theme
emit perf:timer:finish "Oh My Fish init selected theme"
# Backup key bindings
functions -q fish_user_key_bindings
and functions -c fish_user_key_bindings __original_fish_user_key_bindings
...
...
lib/require.fish
View file @
8217eac3
...
...
@@ -8,29 +8,35 @@ function require
return 1
end
# If bundle should
be
# If bundle should
not be processed
if set index (contains -i -- --no-bundle $packages)
set -e packages[$index]
set ignore_bundle
end
# If requiring a theme we load the root path
if set index (contains -i -- --theme $packages)
set -e packages[$index]
set package_path {$OMF_PATH,$OMF_CONFIG}/theme?/$packages
set function_path $package_path
else
set package_path {$OMF_PATH,$OMF_CONFIG}/pk?/$packages
end
# Requiring absolute paths
if set index (contains -i -- --path $packages)
set -e packages[$index]
set package_path $packages
# Requiring specific packages from default paths
else
set package_path {$OMF_PATH,$OMF_CONFIG}/pkg*/$packages
# Exit with error if no package paths were generated
test -z "$package_path"
and return 1
end
set function_path $package_path/functions*
set complete_path $package_path/completions*
set init_path $package_path/init.fish*
# Exit with error if no paths were generated
test -z "$package_path"
and return 1
# Build package paths
set function_path $function_path $package_path/function?
set complete_path $package_path/completion?
set init_path $package_path/ini?.fish
# Autoload functions
test -n "$function_path"
...
...
pkg/omf/functions/themes/omf.theme.set.fish
View file @
8217eac3
...
...
@@ -19,9 +19,12 @@ function omf.theme.set -a target_theme
return $OMF_INVALID_ARG
end
# Replace autoload paths of current theme with the target one
autoload -e {$OMF_CONFIG,$OMF_PATH}/themes/$current_theme
autoload {$OMF_CONFIG,$OMF_PATH}/themes/$target_theme
# Remove current theme paths
set -l current_theme_paths {$OMF_CONFIG,$OMF_PATH}/theme?/{,functions,completions}/$current_theme
autoload -e $current_theme_paths
# Require new theme
require --theme $target_theme
# Find target theme's fish_prompt and link to user function path
for path in {$OMF_CONFIG,$OMF_PATH}/themes/$target_theme/$prompt_filename
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment