2023-08-04 19:20:13 +00:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib) mkIf;
|
|
|
|
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages;
|
|
|
|
hasKubectl = hasPackage "kubectl";
|
|
|
|
in
|
|
|
|
{
|
2023-07-28 23:03:24 +00:00
|
|
|
programs.fish = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
shellAbbrs = rec {
|
2023-08-04 13:48:38 +00:00
|
|
|
ccat = "egrep -v '^\s*(#|$)'";
|
2023-08-04 20:47:34 +00:00
|
|
|
ga = "git add";
|
2023-08-08 14:35:27 +00:00
|
|
|
gc = "git commit"; # interactive commit
|
2023-08-18 16:11:29 +00:00
|
|
|
gg = "git graph";
|
2023-08-08 14:35:27 +00:00
|
|
|
gcm = "git commit -m"; # quick commit
|
2023-08-04 20:47:34 +00:00
|
|
|
gp = "git push";
|
|
|
|
gs = "git status";
|
2023-07-28 23:03:24 +00:00
|
|
|
jqless = "jq -C | less -r";
|
2023-08-04 19:20:13 +00:00
|
|
|
k = mkIf hasKubectl "kubectl";
|
2023-08-01 18:46:11 +00:00
|
|
|
n = "nix";
|
2023-08-04 18:29:05 +00:00
|
|
|
sshpass = "ssh -o PubkeyAuthentication=no";
|
2023-08-02 16:37:52 +00:00
|
|
|
tf = "terraform";
|
|
|
|
tfyolo = "terraform apply -auto-approve";
|
2023-07-28 23:03:24 +00:00
|
|
|
vi = "vim";
|
|
|
|
v = "vim";
|
|
|
|
};
|
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
};
|
|
|
|
|
|
|
|
functions = {
|
|
|
|
# Disable greeting
|
|
|
|
fish_greeting = "";
|
2023-08-04 15:28:43 +00:00
|
|
|
ssh = "TERM=xterm command ssh $argv";
|
2023-07-28 23:03:24 +00:00
|
|
|
# Rebuild home-manager
|
|
|
|
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
|
|
|
|
};
|
|
|
|
|
|
|
|
interactiveShellInit =
|
|
|
|
# Open command buffer in vim when alt+e is pressed
|
|
|
|
''
|
|
|
|
bind \ee edit_command_buffer
|
|
|
|
'' +
|
|
|
|
# Use vim bindings and cursors
|
|
|
|
''
|
|
|
|
fish_vi_key_bindings
|
|
|
|
set fish_cursor_default block blink
|
|
|
|
set fish_cursor_insert line blink
|
|
|
|
set fish_cursor_replace_one underscore blink
|
|
|
|
set fish_cursor_visual block
|
|
|
|
'' +
|
2023-07-29 01:08:31 +00:00
|
|
|
# Restore ctrl+f to accept suggestions
|
|
|
|
''
|
|
|
|
bind -M insert \cf forward-char
|
|
|
|
bind -M default \cf forward-char
|
|
|
|
bind -M visual \cf forward-char
|
|
|
|
'' +
|
2023-07-28 23:03:24 +00:00
|
|
|
# Use terminal colors
|
|
|
|
''
|
|
|
|
set -U fish_color_autosuggestion brblack
|
|
|
|
set -U fish_color_cancel -r
|
|
|
|
set -U fish_color_command brgreen
|
|
|
|
set -U fish_color_comment brmagenta
|
|
|
|
set -U fish_color_cwd green
|
|
|
|
set -U fish_color_cwd_root red
|
|
|
|
set -U fish_color_end brmagenta
|
|
|
|
set -U fish_color_error brred
|
|
|
|
set -U fish_color_escape brcyan
|
|
|
|
set -U fish_color_history_current --bold
|
|
|
|
set -U fish_color_host normal
|
|
|
|
set -U fish_color_match --background=brblue
|
|
|
|
set -U fish_color_normal normal
|
|
|
|
set -U fish_color_operator cyan
|
|
|
|
set -U fish_color_param brblue
|
|
|
|
set -U fish_color_quote yellow
|
|
|
|
set -U fish_color_redirection bryellow
|
|
|
|
set -U fish_color_search_match 'bryellow' '--background=brblack'
|
|
|
|
set -U fish_color_selection 'white' '--bold' '--background=brblack'
|
|
|
|
set -U fish_color_status red
|
|
|
|
set -U fish_color_user brgreen
|
|
|
|
set -U fish_color_valid_path --underline
|
|
|
|
set -U fish_pager_color_completion normal
|
|
|
|
set -U fish_pager_color_description yellow
|
|
|
|
set -U fish_pager_color_prefix 'white' '--bold' '--underline'
|
|
|
|
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|