Nix-Configs/configs/programs/fish.nix

117 lines
3.1 KiB
Nix
Raw Normal View History

2022-12-18 15:15:15 +00:00
pkgs: {
enable = true;
plugins = [
{
name = "bang-bang";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-bang-bang";
rev = "816c66d";
hash = "sha256-35xXBWCciXl4jJrFUUN5NhnHdzk6+gAxetPxXCv4pDc=";
};
}
];
shellAliases = {
clip = "kitty +kitten clipboard";
l = "ls -lah --hyperlink=auto";
icat = "kitty +kitten icat";
rust-musl-builder = "fish -c 'docker run --rm -it -v (pwd):/home/rust/src ekidd/rust-musl-builder cargo build --release'";
lonk = "qrencode -t utf8i";
s = "kitty +kitten ssh";
weather = "curl wttr.in/43.0844,-77.6749";
};
shellInit = ''
set -x PATH ~/.cargo/bin/ ~/go/bin ~/.local/bin ~/.gem/ruby/*/bin /var/lib/flatpak/exports/bin/ $PATH
set -x KEYFILE ~/.config/void/keyfile
set fish_color_command magenta
set fish_color_normal white
set fish_color_param ffffff
set fish_color_quote blue
set fish_color_redirection green
set fish_color_end b4a8c8
set fish_color_comment black
set fish_color_operator green
set fish_color_escape yellow
set fish_color_autosuggestion 91889b
set fish_greeting ""
# echo "You're cute and loved <3"
# echo "You seriously are incredibly wonderful and you mean so much to me, you've made my life so much brighter and i never wanna let you go <3"
'';
functions = {
n = {
description = "support nnn quit and change directory";
wraps = "nnn";
body = ''
# Block nesting of nnn in subshells
if test -n "$NNNLVL"
if [ (expr $NNNLVL + 0) -ge 1 ]
echo "nnn is already running"
return
end
end
set -x NNN_TMPFILE '.nnn.tmp'
nnn $argv
if test -e $NNN_TMPFILE
source $NNN_TMPFILE
rm $NNN_TMPFILE
end
'';
};
fish_prompt = ''
# Theme based on Bira theme from oh-my-zsh: https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/bira.zsh-theme
# Some code stolen from oh-my-fish clearance theme: https://github.com/bpinto/oh-my-fish/blob/master/themes/clearance/
# Further modification by Ember, to make the colors cooler
function __user_host
set -l content
echo -n (set_color --bold cyan)
echo -n $USER@(hostname|cut -d . -f 1) (set color normal)
end
function __current_path
echo -n (set_color --bold red) (pwd) (set_color normal)
end
function _git_branch_name
echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
end
function _git_is_dirty
echo (command git status -s --ignore-submodules=dirty 2> /dev/null)
end
function __git_status
if [ (_git_branch_name) ]
set -l git_branch (_git_branch_name)
if [ (_git_is_dirty) ]
set git_info '['$git_branch"*"']'
else
set git_info '['$git_branch']'
end
echo -n (set_color white) $git_info (set_color normal)
end
end
function fish_right_prompt
set -l st $status
if [ $st != 0 ];
echo (set_color red) $st(set_color normal)
end
end
echo -n (set_color white)""(set_color normal)
__user_host
__current_path
__git_status
echo -e '''
echo (set_color white)""(set_color --bold white)"\$ "(set_color normal)
'';
};
}