use same shell setup as in nix home manager
This commit is contained in:
@@ -1,6 +1,52 @@
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
starship init fish | source
|
||||
set -g fish_key_bindings fish_vi_key_bindings
|
||||
|
||||
# Debian's fzf package ships its fish integration as loose scripts rather
|
||||
# than auto-loading them; source them so fzf-file-widget/fzf-cd-widget
|
||||
# exist for fish_user_key_bindings to bind below.
|
||||
if test -f /usr/share/doc/fzf/examples/key-bindings.fish
|
||||
source /usr/share/doc/fzf/examples/key-bindings.fish
|
||||
end
|
||||
if test -f /usr/share/doc/fzf/examples/completion.fish
|
||||
source /usr/share/doc/fzf/examples/completion.fish
|
||||
end
|
||||
|
||||
function fish_user_key_bindings
|
||||
# Accept the current autosuggestion regardless of vi mode (by default
|
||||
# vi-mode only binds this in insert mode).
|
||||
for mode in insert default visual
|
||||
bind -M $mode \cf forward-char
|
||||
end
|
||||
|
||||
# Esc in visual mode returns to normal mode instead of leaving vi mode
|
||||
# bindings altogether.
|
||||
bind -M visual escape 'set fish_bind_mode default; commandline -f repaint'
|
||||
|
||||
# Replace fzf's ctrl-t/alt-c defaults with alt-f/alt-d for the file and
|
||||
# cd widgets, bound in both insert and normal mode.
|
||||
for mode in insert default
|
||||
bind -e -M $mode \ct
|
||||
bind -e -M $mode \ec
|
||||
bind -M $mode alt-f 'fzf-file-widget; commandline -f repaint'
|
||||
bind -M $mode alt-d 'fzf-cd-widget; commandline -f repaint'
|
||||
end
|
||||
end
|
||||
|
||||
# oh-my-posh's vi-mode segment reads $FISH__BIND_MODE (set here on every
|
||||
# mode change) rather than fish's own $fish_bind_mode, and needs the
|
||||
# built-in mode prompt silenced so it isn't drawn twice.
|
||||
function rerender_on_bind_mode_change --on-variable fish_bind_mode
|
||||
if test "$fish_bind_mode" != paste -a "$fish_bind_mode" != "$FISH__BIND_MODE"
|
||||
set -gx FISH__BIND_MODE $fish_bind_mode
|
||||
omp_repaint_prompt
|
||||
end
|
||||
end
|
||||
function fish_default_mode_prompt; end
|
||||
function fish_mode_prompt; end
|
||||
set -x VIRTUAL_ENV_DISABLE_PROMPT 1
|
||||
|
||||
oh-my-posh init fish --config ~/.config/ohmyposh.json | source
|
||||
|
||||
abbr --add ls lsd
|
||||
abbr --add ll 'lsd -l'
|
||||
|
||||
Reference in New Issue
Block a user