diff options
Diffstat (limited to 'home/fish/default.nix')
| -rw-r--r-- | home/fish/default.nix | 110 |
1 files changed, 104 insertions, 6 deletions
diff --git a/home/fish/default.nix b/home/fish/default.nix index af2a377..08bb295 100644 --- a/home/fish/default.nix +++ b/home/fish/default.nix @@ -1,14 +1,112 @@ -{ vars, pkgs, ... }: +{ config, pkgs, ... }: { programs.fish = { enable = true; + shellAliases = { + browser = "${pkgs.chawan}/bin/cha"; + cat = "${pkgs.gat}/bin/gat"; + gmail = "${pkgs.himalaya}/himalaya envelope list --account gmail --folder gmail/Inbox 'not flag Seen'"; + grep = "${pkgs.ripgrep}/bin/rg"; + http = "${pkgs.xh}/bin/xh"; + journalctl = "${pkgs.systemd}/bin/journalctl --output=short-iso"; + l = "${pkgs.eza}/bin/eza -l --icons --git -a"; + llm = "${pkgs.tenere}/bin/tenere"; + ls = "${pkgs.eza}/bin/eza -a --group-directories-first"; + lt = "${pkgs.eza}/bin/eza --tree --level=2 --long --icons --git"; + relesoft = "${pkgs.himalaya}/himalaya envelope list --account relesoft --folder relesoft/Inbox 'not flag Seen'"; + ssh = "TERM=xterm-256color ${pkgs.openssh}/bin/ssh"; + stocks = "${pkgs.ticker}/bin/ticker --config /home/petri/.config/ticker/config.yaml"; + weather = "${pkgs.wthrr}/bin/wthrr --forecast d"; + wifi = "${pkgs.impala}/bin/impala"; + youtube = "${pkgs.pipe-viewer}/bin/pipe-viewer"; + }; + functions = { + doc = '' + ${pkgs.asciidoctor}/bin/asciidoctor --backend xhtml5 --out-file - "$argv[1]"|${pkgs.chawan}/bin/cha -T application/xhtml+xml + ''; + bookmark = '' + set -l Shiori_URL "https://shiori.tammi.cc" + set -l Username "petri" + set -l token (${pkgs.curl}/bin/curl -s -X POST -H "Content-Type: application/json" -d '{"username": "'$Username'", "password": "'$SHIORI_PASSWORD'", "remember": true}' $Shiori_URL/api/v1/auth/login | string match -r '(?<="token":")[^"]*') + ${pkgs.curl}/bin/curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{ "url": "'$argv[1]'", "createArchive": true, "public": 1 }' $Shiori_URL/api/bookmarks + ''; + share = '' + ${pkgs.curl}/bin/curl -X PUT --data-binary @$argv[1] https://bin.tammi.cc >&2 + ''; + import = '' + ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" $argv + ''; + readdoc = "${pkgs.reader}/bin/reader $argv --markdown-output | ${pkgs.moar}/bin/moar --wrap --lang markdown"; + extract = '' + function extract + switch $argv[1] + case "*.tar.bz2" + tar xjf $argv[1] + + case "*.tar.gz" + tar xzf $argv[1] + + case "*.tar.xz" + tar xJf $argv[1] + + case "*.bz2" + bunzip2 $argv[1] + + case "*.rar" + unrar e $argv[1] + + case "*.gz" + gunzip $argv[1] + + case "*.tar" + tar xf $argv[1] + + case "*.tbz2" + tar xjf $argv[1] + + case "*.tgz" + tar xzf $argv[1] + + case "*.zip" + unzip $argv[1] + + case "*.Z" + uncompress $argv[1] + + case "*.7z" + 7z x $argv[1] + + case "*" + echo "unknown extension: $argv[1]" + end + end + ''; + }; interactiveShellInit = '' - function fish_greeting - if status is-interactive - fastfetch - end - end + set -g fish_key_bindings fish_vi_key_bindings + + set -g __fish_git_prompt_show_informative_status 1 + + set -g __fish_git_prompt_color_branch magenta --bold + set -g __fish_git_prompt_showupstream "informative" + set -g __fish_git_prompt_char_upstream_ahead "↑ " + set -g __fish_git_prompt_char_upstream_behind "↓ " + set -g __fish_git_prompt_char_upstream_prefix "" + + set -g __fish_git_prompt_char_stagedstate "● " + set -g __fish_git_prompt_char_dirtystate "✚" + set -g __fish_git_prompt_char_untrackedfiles "…" + set -g __fish_git_prompt_char_conflictedstate "✖" + set -g __fish_git_prompt_char_cleanstate "✔" + + set -g __fish_git_prompt_color_dirtystate blue + set -g __fish_git_prompt_color_stagedstate yellow + set -g __fish_git_prompt_color_invalidstate red + set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal + set -g __fish_git_prompt_color_cleanstate green --bold + + ${pkgs.fastfetch}/bin/fastfetch ''; }; } |
