mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-25 09:41:40 +08:00
Fix theme key bindings (#334)
* init: load only key bindings from current theme * theme: reload key bindings on theme change
This commit is contained in:
parent
065bc9c649
commit
0ca26d01e2
12
init.fish
12
init.fish
|
@ -25,13 +25,15 @@ emit perf:timer:finish "Oh My Fish init installed packages"
|
|||
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 packages key bindings
|
||||
for file in {$OMF_CONFIG,$OMF_PATH}/{,pkg,theme}/*/key_bindings.fish
|
||||
function fish_user_key_bindings -V theme
|
||||
# Prepare packages key bindings paths
|
||||
set -l key_bindings $OMF_CONFIG/key_binding?.fish \
|
||||
{$OMF_CONFIG,$OMF_PATH}/pkg/*/key_bindings.fish \
|
||||
{$OMF_CONFIG,$OMF_PATH}/themes/$theme/key_binding?.fish
|
||||
# Source all keybindings collected
|
||||
for file in $key_bindings
|
||||
source $file
|
||||
end
|
||||
# Read custom key bindings file
|
||||
source $OMF_CONFIG/key_bindings.fish ^/dev/null
|
||||
# Call original key bindings if existent
|
||||
functions -q __original_fish_user_key_bindings
|
||||
and __original_fish_user_key_bindings
|
||||
|
|
|
@ -30,6 +30,10 @@ function omf.theme.set -a target_theme
|
|||
end
|
||||
end
|
||||
|
||||
# If key bindings file found, reload fish key bindings
|
||||
test (count {$OMF_CONFIG,$OMF_PATH}/key_binding?.fish) -gt 0
|
||||
and __fish_reload_key_bindings
|
||||
|
||||
# Persist the changes
|
||||
echo "$target_theme" > "$OMF_CONFIG/theme"
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user