1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 08:10:43 +01:00

feat: differentiate between fish aliases and abbrs

This commit is contained in:
Ryan Cao 2023-07-21 17:13:54 +08:00
parent f024302352
commit d96f478fa2
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E
3 changed files with 30 additions and 15 deletions

View file

@ -1,17 +1,26 @@
{ {
"vim" = "hx"; "vim".command = "hx";
"ls" = "exa --all --icons"; "ls" = {
"dig" = "doggo"; command = "exa --all --icons";
fishAlias = true;
};
"dig".command = "doggo";
"glol" = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"; "glol" = {
"ghrvw" = "gh repo view --web"; command = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'";
fishAlias = true;
};
"ghrvw".command = "gh repo view --web";
"opr" = "op run --env-file=.env.1password --"; "opr".command = "op run --env-file=.env.1password --";
"dr" = "doppler run --"; "dr".command = "doppler run --";
"dequarantine" = "xattr -d com.apple.quarantine"; "dequarantine".command = "xattr -d com.apple.quarantine";
"bcpa" = "brew cleanup --prune=all"; "bcpa".command = "brew cleanup --prune=all";
"puil" = "pnpm update --interactive --latest"; "puil".command = "pnpm update --interactive --latest";
"pip-upgrade-all" = "pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U"; "pip-upgrade-all" = {
command = "pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U";
fishAlias = true;
};
} }

View file

@ -1,7 +1,11 @@
{...}: { {lib, ...}: let
aliases = import ./aliases.nix;
shellAbbrs = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: !(b.fishAlias or false)) aliases);
shellAliases = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: builtins.hasAttr "fishAlias" b && b.fishAlias) aliases);
in {
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAbbrs = import ./aliases.nix; inherit shellAbbrs shellAliases;
}; };
home.file.".config/fish/conf.d" = { home.file.".config/fish/conf.d" = {

View file

@ -1,4 +1,6 @@
{pkgs, ...}: { {pkgs, ...}: let
shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ./aliases.nix);
in {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
enableAutosuggestions = true; enableAutosuggestions = true;
@ -11,7 +13,7 @@
initExtraBeforeCompInit = builtins.readFile ./zsh/initExtraBeforeCompInit.zsh; initExtraBeforeCompInit = builtins.readFile ./zsh/initExtraBeforeCompInit.zsh;
initExtra = builtins.readFile ./zsh/initExtra.zsh; initExtra = builtins.readFile ./zsh/initExtra.zsh;
shellAliases = import ./aliases.nix; inherit shellAliases;
localVariables = { localVariables = {
vivid_theme = "catppuccin-macchiato"; vivid_theme = "catppuccin-macchiato";