flake/home/applications/fish/default.nix

96 lines
2.2 KiB
Nix
Raw Permalink Normal View History

2024-08-27 21:44:22 +00:00
{ lib, pkgs, ... }:
{
2023-11-05 09:21:37 +00:00
programs.fish = {
enable = true;
2024-08-27 21:44:22 +00:00
2023-11-05 09:21:37 +00:00
interactiveShellInit = ''
set fish_greeting
2024-09-16 05:07:58 +00:00
set fish_cursor_default block
set fish_cursor_insert line
set fish_cursor_replace_one underscore
set fish_cursor_replace underscore
set fish_cursor_external line
set fish_cursor_visual block
function fish_user_key_bindings
fish_default_key_bindings -M insert
fish_vi_key_bindings --no-erase insert
end
2023-11-05 09:21:37 +00:00
'';
2024-08-27 21:44:22 +00:00
2024-09-20 17:33:24 +00:00
plugins =
lib.map
(f: {
name = f.pname;
inherit (f) src;
})
(
with pkgs.fishPlugins;
[
autopair
done
puffer
tide
2024-09-20 17:33:24 +00:00
]
);
shellAbbrs =
let
cursor = f: {
setCursor = true;
expansion = f;
};
in
2023-11-05 09:21:37 +00:00
{
2024-09-27 10:17:31 +00:00
gi = "lazygit";
2024-09-20 17:33:24 +00:00
p = "powerprofilesctl";
s = "nh os switch";
v = "nvim";
2024-10-12 16:10:05 +00:00
t = "tmux";
ta = "tmux attach";
2024-08-27 21:44:22 +00:00
2024-09-20 17:33:24 +00:00
# TODO: maybe fishPlugins.fish-git-abbr?
g = "git";
ga = "git add";
gac = cursor "git commit -am '%'";
gc = cursor "git commit -m '%'";
gca = "git commit --amend";
gd = "git diff";
gds = "git diff --staged";
gl = "git log";
gp = "git pull";
gpu = "git push";
gr = "git rebase -i --autosquash";
2024-09-16 05:30:23 +00:00
2024-09-20 17:33:24 +00:00
n = "nix";
nb = cursor "nix build nixpkgs#%";
nr = cursor "nix run nixpkgs#%";
ns = cursor "nix shell nixpkgs#%";
nbb = "nix-build -A";
nf = "nix fmt";
nu = "nix flake update";
nv = "nix eval";
};
2024-09-15 17:21:00 +00:00
2024-08-27 21:44:22 +00:00
functions =
let
jq = lib.getExe pkgs.jq;
nix = lib.getExe pkgs.nix;
curl = lib.getExe pkgs.curl;
in
{
"pb" = ''
${jq} -Rns '{text: inputs}' | \
${curl} -s -H 'Content-Type: application/json' --data-binary @- https://pb.ny4.dev | \
${jq} -r '. | "https://pb.ny4.dev\(.path)"'
'';
"getmnter" = ''
${nix} eval nixpkgs#{$argv}.meta.maintainers --json | \
${jq} '.[].github | "@" + .' -r
'';
};
2023-11-05 09:21:37 +00:00
};
}