mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
Compatibility with emacs mode
This commit is contained in:
parent
9376094d05
commit
8713d30236
@ -1,6 +1,18 @@
|
||||
# budspencer theme
|
||||
|
||||
Translation of zsh's prezto [budspencer theme][budspencer]
|
||||
Translation of zsh's prezto [budspencer theme][budspencer].
|
||||
|
||||
## Configuration
|
||||
|
||||
The theme behaves similar to vim's airline/powerline plugins. It needs a
|
||||
[powerline font][font]. Although it works with emacs mode, it's more powerful
|
||||
with vi mode. In order to enable vi mode, put the following lines into
|
||||
`$HOME/.config/fish/config.fish` before `set fish_path $HOME/.oh-my-fish`:
|
||||
|
||||
```
|
||||
set -e fish_key_bindings
|
||||
set -U fish_key_bindings fish_vi_key_bindings
|
||||
```
|
||||
|
||||
## Left prompt segments
|
||||
|
||||
@ -46,8 +58,9 @@ Translation of zsh's prezto [budspencer theme][budspencer]
|
||||
|
||||
## TODO
|
||||
|
||||
- vi REPLACE mode
|
||||
- vi REPLACE mode, as soon as REPLACE mode is implemented within fish
|
||||
|
||||
[budspencer]: https://github.com/tannhuber/prezto
|
||||
[font]: https://github.com/Lokaltog/powerline-fonts
|
||||
[ranger]: http://ranger.nongnu.org/
|
||||
[screenshot]: https://raw.githubusercontent.com/tannhuber/prezto/master/screenshots/budspencer.png
|
||||
|
@ -50,7 +50,11 @@ function fish_vi_prompt_cm -d "Displays the current mode"
|
||||
case default
|
||||
set_color -b $budspencer_colors[10] $budspencer_colors[1]
|
||||
echo -en $budspencer_cursors[1]
|
||||
echo -n " NORMAL "
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
echo -n " NORMAL "
|
||||
else
|
||||
echo -n " EMACS "
|
||||
end
|
||||
set_color -b $budspencer_colors[1] $budspencer_colors[10]
|
||||
case insert
|
||||
set_color -b $budspencer_colors[5] $budspencer_colors[1]
|
||||
@ -118,9 +122,9 @@ function fish_prompt -d "Write out the left prompt of the budspencer theme"
|
||||
|
||||
# vi mode
|
||||
set -l ps_vi ""
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
set ps_vi (fish_vi_prompt_cm)
|
||||
end
|
||||
# end
|
||||
|
||||
# git
|
||||
set -l ps_git ""
|
||||
|
@ -43,8 +43,10 @@ function fish_git_toggle_cm -d "Toggles style of git segment, press # in NORMAL
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
bind -M default '#' fish_git_toggle_cm
|
||||
bind -M visual '#' fish_git_toggle_cm
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
bind -M default '#' fish_git_toggle_cm
|
||||
bind -M visual '#' fish_git_toggle_cm
|
||||
end
|
||||
|
||||
if set -q -x $PWDSTYLE
|
||||
set -x PWDSTYLE short long none
|
||||
@ -59,8 +61,10 @@ function fish_pwd_toggle_cm -d "Toggles style of pwd segment, press space bar in
|
||||
end
|
||||
end
|
||||
end
|
||||
bind -M default ' ' fish_pwd_toggle_cm
|
||||
bind -M visual ' ' fish_pwd_toggle_cm
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
bind -M default ' ' fish_pwd_toggle_cm
|
||||
bind -M visual ' ' fish_pwd_toggle_cm
|
||||
end
|
||||
|
||||
function fish_cmd_duration_cm -d "Displays the elapsed time of last command"
|
||||
set -l seconds ""
|
||||
@ -225,14 +229,14 @@ function fish_right_prompt -d "Write out the right prompt of the budspencer them
|
||||
# git
|
||||
set ps_git (fish_git_prompt_cm)
|
||||
if test -n "$ps_git"
|
||||
set ps_git (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3])""$ps_git
|
||||
set ps_git (set_color $budspencer_colors[3])""(set_color -b $budspencer_colors[3])""$ps_git(set_color -b $budspencer_colors[3] normal)
|
||||
end
|
||||
|
||||
# pwd
|
||||
set -l ps_pwd ""
|
||||
if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
# if test "$fish_key_bindings" = "fish_vi_key_bindings" -o "$fish_key_bindings" = "my_fish_key_bindings"
|
||||
set ps_pwd (fish_pwd_prompt_cm)
|
||||
end
|
||||
# end
|
||||
|
||||
# right prompt
|
||||
echo -n $ps_duration $ps_git $ps_pwd
|
||||
|
Loading…
Reference in New Issue
Block a user