Dotfiles/fish/config.fish

160 lines
3.7 KiB
Fish

set -x EDITOR /usr/bin/nvim
set -x VISUAL /usr/bin/nvim
alias ls eza
functions --copy cd __fish_cd
function cd
if [ "$argv[1]" = "" ]
set dir (fd -t d | fzf)
else
set dir "$argv[1]"
end
if [ "$dir" != "" ]
__fish_cd "$dir" && pwd > /tmp/last_cd
end
end
function cl
cd $argv[1] && ls
end
function last_cd
__fish_cd (cat /tmp/last_cd)
end
function fish_greeting
end
function fish_prompt
end
function custom_vi_bindings
fish_vi_key_bindings
bind -M insert -m default jj backward-char force-repaint
#bind -M insert -m default kk backward-char force-repaint
end
set -g fish_key_bindings custom_vi_bindings
function mkcd
mkdir -p $argv[1]
cd $argv[1]
end
function fzf_search
set p (fzf)
if [ $status = 0 ]
if not string match "* " (commandline)
commandline -a " "
end
commandline -a $p
end
end
bind -M insert \cf fzf_search
source ~/scripts/ssh-agent.fish 2>/dev/null
source ~/.config/fish/config.local 2>/dev/null
source ~/.config/fish/abbr.fish 2>/dev/null
set -x PATH "$HOME/scripts" /opt/uif $PATH
set -x PYTHONPATH "$HOME/scripts" $PYTHONPATH
set -x PATH "$HOME/.cargo/bin" $PATH
set -x SVDIR "$HOME/.service"
# Start flavours
set base00 282936
set base01 3a3c4e
set base02 4d4f68
set base03 626483
set base04 62d6e8
set base05 e9e9f4
set base06 f1f2f8
set base07 f7f7fb
set base08 ea51b2
set base09 b45bcf
set base0A 00f769
set base0B ebff87
set base0C a1efe4
set base0D 62d6e8
set base0E b45bcf
set base0F 00f769
# End flavours
set -x LS_COLORS (cat ~/.config/fish/ls_colors)
set fish_color_autosuggestion $base03 $base00
set fish_color_cancel -r
set fish_color_command $base04
set fish_color_comment $base03
# set fish_color_cwd green
# set fish_color_cwd_root red
# set fish_color_end green
# set fish_color_error brred
# set fish_color_escape brcyan
# set fish_color_history_current --bold
# set fish_color_host normal
# set fish_color_host_remote yellow
# set fish_color_normal normal
# set fish_color_operator brcyan
# set fish_color_param cyan
# set fish_color_quote yellow
# set fish_color_redirection 'cyan' '--bold'
# set fish_color_search_match --background=111
# set fish_color_selection 'white' '--bold' '--background=brblack'
# set fish_color_status red
# set fish_color_user brgreen
# set fish_color_valid_path --underline
# set fish_pager_color_completion normal
# set fish_pager_color_description 'B3A06D' 'yellow' '-i'
# set fish_pager_color_prefix 'cyan' '--bold' '--underline'
# set fish_pager_color_progress 'brwhite' '--background=cyan'
# set fish_pager_color_selected_background -r
function fish_mode_prompt
set last_status $status
if [ "$fish_key_bindings" = "fish_vi_key_bindings" ]
switch $fish_bind_mode
case default
set mode_indicator " N "
set indicator_colour $base04
case insert
set mode_indicator " I "
set indicator_colour $base0A
case replace_one
set mode_indicator " R "
set indicator_colour $base08
case visual
set mode_indicator " V "
set indicator_colour $base0E
end
end
set_color -b $indicator_colour black
echo -n "$mode_indicator"
if [ "$last_status" != "0" ]
set_color -b $base08 $base05
echo -n " $last_status "
end
set_color -b $base02 $base05
echo -n " $USER "
set_color -b $base01 $base05
echo -n " "
echo -n (pwd | sd "/home/$USER" "~") # | sed -E "s!/(.).*/!/\1/!g")
echo -n " "
set_color normal
set_color $base01
echo -n "┃ "
set_color normal
if [ $CMD_DURATION -gt 3000 ]
echo -ne '\007'
end
end