dotfiles/.config/fish/config.fish

107 lines
2.1 KiB
Fish

set -x PATH "$HOME/bin:$PATH"
if not which sh > /dev/null 2>&1
alias which="command -v"
end
if not which hostname > /dev/null 2>&1
alias hostname="cat /etc/hostname"
end
if which doas > /dev/null 2>&1
alias sudo="doas"
else
alias doas="sudo"
end
if which nvim >/dev/null 2>&1
alias vim="nvim"
set -x EDITOR nvim
else
alias nvim="vim -u ~/.config/vim/vimrc"
alias vim="vim -u ~/.config/vim/vimrc"
set -x EDITOR "vim -u ~/.config/vim/vimrc"
end
alias datenow="date '+%Y-%m-%d'"
function please
eval doas $history[1]
end
function x
startx ~/.config/xinitrc
if [ -f "$XDG_RUNTIME_DIR/logout" ]
rm "$XDG_RUNTIME_DIR/logout"
exit
end
end
function pingme
set COMMAND $argv
$COMMAND
notify-send --urgency=normal "Ping!" "Job '$COMMAND' exited with status $status."
end
function nope-syntax --on-event fish_posterror
if [ $status -gt 0 ]
play ~/.config/sounds/nope.mp3 > /dev/null 2>&1 & disown
end
end
function nope-command --on-event fish_postexec
if [ $status -gt 0 ]
play ~/.config/sounds/nope.mp3 > /dev/null 2>&1 & disown
end
end
fish_vi_key_bindings
function fish_mode_prompt; end; funcsave fish_mode_prompt > /dev/null
set fish_cursor_default block blink
set fish_cursor_insert line blink
set fish_cursor_replace_one underscore blink
set fish_cursor_visual block
if which starship >/dev/null 2>&1
export STARSHIP_CONFIG="$HOME/.config/starship/config.toml"
starship init fish | source
end
if status --is-login
echo ""
end
if status --is-interactive
alias la="ls -a --color=always"
alias ll="ls -l --color=always"
alias ls="ls --color=always"
alias g="git"
mkdir -p ~/.local
set time_diff (expr (date '+%s') - (cat "$HOME/.local/last_shell" 2>/dev/null || echo 0))
if [ "$time_diff" -gt "28800" ]
[ -d "$HOME/tmp" ] && rm -rf "$HOME/tmp/*"
timeout 5 git sit && date '+%s' > "$HOME/.local/last_shell"
echo ""
end
set remind (remind)
if [ ! -z "$remind" ]
echo Reminders:
echo "$remind"
echo ""
end
end