nix-config/home/features/cli/fish.nix

144 lines
3.5 KiB
Nix

{ pkgs, ... }:
{
programs.fish = {
enable = true;
functions = {
setpath = "test -e $argv[1]; and fish_add_path $argv[1]";
};
interactiveShellInit = ''
if test -z "$XDG_RUNTIME_DIR"
set -x XDG_RUNTIME_DIR "/tmp/$USER-runtime-dir"
if test ! -e "$XDG_RUNTIME_DIR"
mkdir "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
end
end
setpath /opt/local/bin
setpath /opt/homebrew/bin
setpath ~/.cargo/bin
setpath ~/.ghcup/bin
setpath ~/.cabal/bin
setpath ~/.local/bin
setpath ~/.bun/bin
setpath ~/Projects/Checkouts/arcanist/bin
set -x EDITOR nvim
set -x USER lu
set -x SHELL (which fish)
set -x TERM xterm-256color
set -x LANG en_US.UTF-8
set -x LC_ALL en_US.UTF-8
set -x LC_CTYPE en_US.UTF-8
set -x LANGUAGE en_US.UTF-8
'';
shellAbbrs = {
# General aliases
c = "clear";
ll = "ls -lahF --color=always";
e = "$EDITOR";
se = "sudoedit";
"cd.." = "cd ../";
rmrf = "rm -rf";
# overrides of defaults
mkdir = "mkdir -p";
cp = "cp -r";
scp = "scp -r";
apt = "sudo apt";
doc = "sudo docker";
docker = "sudo docker";
sctl = "sudo systemctl";
usctl = "systemctl --user";
doco = "sudo docker-compose";
# z is a weird key to hit frequently, j is much better
j = "z";
# cargoes and rust-s
cg = "cargo";
cr = "cargo run";
cb = "cargo build";
ct = "cargo test";
cwr = "cargo watch -x run";
# rubies
be = "bundle exec";
# cd into a temp directory, very useful!
mkt = "cd (mktemp -d)";
# tmux aliases
tx = "tmux";
txls = "tmux list-sessions";
txa = "tmux attach";
# git aliases
lg = "lazygit";
g = "git";
ga = "git add";
gs = "git status --short";
gl = "git log --color --graph --abbrev-commit --oneline";
gqp = "git add --all; and git commit; and git push";
gqc = "git add --all; and git commit";
gpl = "git pull";
gps = "git push";
gc = "git commit";
gb = "git branch";
gaa = "git add --all";
gco = "git checkout";
editorigin = "git remote set-url origin";
# nix aliases
n = "nix";
nd = "nix develop";
ns = "nix shell";
np = "nix profile";
ngc = "nix-collect-garbage";
hm = "home-manager";
hmreload = "cd ~/nix-config && home-manager switch --flake .#(whoami)@(hostname) && cd -";
hminplace = "home-manager switch --flake .#(whoami)@(hostname)";
nmreload = "cd ~/nix-config && sudo nixos-rebuild switch --flake .";
nminplace = "sudo nixos-rebuild switch --flake .";
};
plugins = [
{
name = "done";
src = pkgs.fishPlugins.done.src;
}
{
name = "pisces";
src = pkgs.fishPlugins.pisces.src;
}
{
name = "plugin-foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "7f0cf099ae1e1e4ab38f46350ed6757d54471de7";
sha256 = "0d16mdgjdwln41zk44qa5vcilmlia4w15r8z2rc3p49i5ankksg3";
};
}
];
};
programs.starship = {
enable = true;
enableFishIntegration = true;
settings = {
character = {
success_symbol = "[~](green)";
error_symbol = "[~](red)";
};
};
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
}