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
8aef0b2d
Commit
8aef0b2d
authored
Mar 03, 2017
by
Stephen M. Coakley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle missing theme setting more gracefully
parent
6c5f3ba1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
init.fish
init.fish
+6
-2
pkg/omf/functions/cli/omf.cli.themes.list.fish
pkg/omf/functions/cli/omf.cli.themes.list.fish
+4
-1
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 @
8aef0b2d
...
...
@@ -8,7 +8,9 @@ test -f $OMF_CONFIG/before.init.fish
and source $OMF_CONFIG/before.init.fish ^/dev/null
emit perf:timer:start "Oh My Fish initialisation"
# Read current theme
read -l theme < $OMF_CONFIG/theme
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
# Prepare Oh My Fish paths
set -l core_function_path $OMF_PATH/lib{,/git}
set -l theme_function_path {$OMF_CONFIG,$OMF_PATH}/themes*/$theme{,/functions}
...
...
@@ -27,7 +29,9 @@ functions -q fish_user_key_bindings
and functions -c fish_user_key_bindings __original_fish_user_key_bindings
# Override key bindings, calling original if existent
function fish_user_key_bindings
read -l theme < $OMF_CONFIG/theme
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
# Prepare packages key bindings paths
set -l key_bindings $OMF_CONFIG/key_binding?.fish \
{$OMF_CONFIG,$OMF_PATH}/pkg/*/key_bindings.fish \
...
...
pkg/omf/functions/cli/omf.cli.themes.list.fish
View file @
8aef0b2d
function omf.cli.themes.list
set -l theme (cat $OMF_CONFIG/theme)
test -f $OMF_CONFIG/theme
and read -l theme < $OMF_CONFIG/theme
or set -l theme default
set -l regex_current "(^|[[:space:]])($theme)([[:space:]]|\$)"
set -l highlight_current s/"$regex_current"/"\1"(omf::em)"\2"(omf::off)"\3"/g
...
...
pkg/omf/functions/themes/omf.theme.set.fish
View file @
8aef0b2d
...
...
@@ -5,8 +5,10 @@ function omf.theme.set -a target_theme
return $OMF_INVALID_ARG
end
read -l current_theme < $OMF_CONFIG/theme
test "$target_theme" = "$current_theme"; and return 0
if test -f $OMF_CONFIG/theme
read current_theme < $OMF_CONFIG/theme
test "$target_theme" = "$current_theme"; and return 0
end
set -l prompt_filename "fish_prompt.fish"
set -l user_functions_path (omf.xdg.config_home)/fish/functions
...
...
@@ -20,7 +22,8 @@ function omf.theme.set -a target_theme
end
# Replace autoload paths of current theme with the target one
autoload -e {$OMF_CONFIG,$OMF_PATH}/themes/$current_theme{,/functions}
set -q current_theme
and autoload -e {$OMF_CONFIG,$OMF_PATH}/themes/$current_theme{,/functions}
set -l theme_path {$OMF_CONFIG,$OMF_PATH}/themes*/$target_theme{,/functions}
autoload $theme_path
...
...
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