save last state

This commit is contained in:
2024-12-30 13:14:54 +01:00
parent 54f891fc65
commit 4ad01591aa
24 changed files with 1120 additions and 155 deletions

View File

@@ -0,0 +1,113 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
inherit (lib.meta) getExe;
inherit (pkgs) eza bat;
cfg = config.home.programs.fish;
in {
# imports = [./tide.nix];
options = {
home.programs.fish.enable = mkEnableOption "Enables fish home configuration";
};
config = mkIf cfg.enable {
programs.fish = {
enable = true;
plugins = [
{
name = "hydro";
src = pkgs.fishPlugins.hydro;
}
];
shellAbbrs = {
extract = "extract.sh";
homemodules = "$EDITOR /home/$USER/.nix-config/users/$USER/modules.nix";
hmod = "$EDITOR /home/$USER/.nix-config/users/$USER/modules.nix";
nixosmodules = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
nmod = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
nixcleanboot = "sudo nix run /home/$USER/.nix-config#cleanup-boot";
nixclean = "nh clean all --keep 3";
nixdev = "nix develop ~/.nix-config -c $SHELL";
nixconfig = "cd /home/$USER/.nix-config/";
nixup = "nh os switch -H $hostname";
nixupv = "nh os switch -v -H $hostname";
flakeup = "nix flake update";
};
shellAliases = {
".." = "cd ..";
"..." = "cd ../../";
"...." = "cd ../../../";
"....." = "cd ../../../../";
"......" = "cd ../../../../../";
tree = "${getExe eza} --tree --icons=always";
cat = "${getExe bat} --style=plain";
ls = "${getExe eza} -h --git --icons --color=auto --group-directories-first -s extension";
ll = "${getExe eza} -l --git --icons --color=auto --group-directories-first -s extension";
la = "${getExe eza} -lah --tree";
# Clear screen and scrollback
clear = "printf '\\033[2J\\033[3J\\033[1;1H'";
};
functions = {
# Disable greeting
fish_greeting = "";
# Merge history when pressing up
up-or-search = lib.readFile ./up-or-search.fish;
# Check stuff in PATH
nix-inspect =
/*
fish
*/
''
set -s PATH | grep "PATH\[.*/nix/store" | cut -d '|' -f2 | grep -v -e "-man" -e "-terminfo" | perl -pe 's:^/nix/store/\w{32}-([^/]*)/bin$:\1:' | sort | uniq
'';
};
interactiveShellInit =
/*
fish
*/
''
# 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
# Use terminal colors
set -x fish_color_autosuggestion brblack
set -x fish_color_cancel -r
set -x fish_color_command brgreen
set -x fish_color_comment brmagenta
set -x fish_color_cwd green
set -x fish_color_cwd_root red
set -x fish_color_end brmagenta
set -x fish_color_error brred
set -x fish_color_escape brcyan
set -x fish_color_history_current --bold
set -x fish_color_host normal
set -x fish_color_host_remote yellow
set -x fish_color_match --background=brblue
set -x fish_color_normal normal
set -x fish_color_operator cyan
set -x fish_color_param brblue
set -x fish_color_quote yellow
set -x fish_color_redirection bryellow
set -x fish_color_search_match 'bryellow' '--background=brblack'
set -x fish_color_selection 'white' '--bold' '--background=brblack'
set -x fish_color_status red
set -x fish_color_user brgreen
set -x fish_color_valid_path --underline
set -x fish_pager_color_completion normal
set -x fish_pager_color_description yellow
set -x fish_pager_color_prefix 'white' '--bold' '--underline'
set -x fish_pager_color_progress 'brwhite' '--background=cyan'
'';
};
};
}

View File

@@ -0,0 +1,221 @@
{pkgs, ...}: {
programs.fish = {
plugins = [
{
name = "hydro";
src = pkgs.fetchFromGitHub {
owner = "jorgebucaran";
repo = "hydro";
rev = "75ab7168a35358b3d08eeefad4ff0dd306bd80d4";
hash = "sha256-85iU1QzcZmZYGhK30/ZaKwJNLTsx+j3w6St8bFiQWxc=";
};
}
];
interactiveShellInit =
/*
fish
*/
''
set -x tide_character_color "brgreen"
set -x tide_character_color_failure "brred"
set -x tide_character_icon ">"
set -x tide_character_vi_icon_default "<"
set -x tide_character_vi_icon_replace "|"
set -x tide_character_vi_icon_visual "V"
set -x tide_status_bg_color "normal"
set -x tide_status_bg_color_failure "normal"
set -x tide_status_color "green"
set -x tide_status_color_failure "red"
set -x tide_status_icon ""
set -x tide_status_icon_failure " "
set -x tide_vi_mode_bg_color_default "normal"
set -x tide_vi_mode_bg_color_insert "normal"
set -x tide_vi_mode_bg_color_replace "normal"
set -x tide_vi_mode_bg_color_visual "normal"
set -x tide_vi_mode_color_default "white"
set -x tide_vi_mode_color_insert "cyan"
set -x tide_vi_mode_color_replace "green"
set -x tide_vi_mode_color_visual "yellow"
set -x tide_vi_mode_icon_default "D"
set -x tide_vi_mode_icon_insert "I"
set -x tide_vi_mode_icon_replace "R"
set -x tide_vi_mode_icon_visual "V"
set -x tide_prompt_add_newline_before "true"
set -x tide_prompt_color_frame_and_connection "brblack"
set -x tide_prompt_color_separator_same_color "brblack"
set -x tide_prompt_icon_connection " "
set -x tide_prompt_min_cols "34"
set -x tide_prompt_pad_items "false"
set -x tide_prompt_transient_enabled "false"
set -x tide_left_prompt_frame_enabled "false"
set -x tide_left_prompt_items pwd git newline character
set -x tide_left_prompt_prefix ""
set -x tide_left_prompt_separator_diff_color " "
set -x tide_left_prompt_separator_same_color " "
set -x tide_left_prompt_suffix " "
set -x tide_right_prompt_frame_enabled "false"
set -x tide_right_prompt_items status cmd_duration context jobs direnv time newline bun node python rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform crystal elixir zig
set -x tide_right_prompt_prefix " "
set -x tide_right_prompt_separator_diff_color " "
set -x tide_right_prompt_separator_same_color " "
set -x tide_right_prompt_suffix ""
set -x tide_pwd_bg_color "normal"
set -x tide_pwd_color_anchors "brcyan"
set -x tide_pwd_color_dirs "cyan"
set -x tide_pwd_color_truncated_dirs "magenta"
set -x tide_pwd_icon ""
set -x tide_pwd_icon_home ""
set -x tide_pwd_icon_unwritable ""
set -x tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform bun.lockb Cargo.toml composer.json CVS go.mod package.json build.zig
set -x tide_cmd_duration_bg_color "normal"
set -x tide_cmd_duration_color "brblack"
set -x tide_cmd_duration_decimals "0"
set -x tide_cmd_duration_icon ""
set -x tide_cmd_duration_threshold "3000"
set -x tide_context_always_display "false"
set -x tide_context_bg_color "normal"
set -x tide_context_color_default "yellow"
set -x tide_context_color_root "bryellow"
set -x tide_context_color_ssh "yellow"
set -x tide_context_hostname_parts "1"
set -x tide_shlvl_bg_color "normal"
set -x tide_shlvl_color "yellow"
set -x tide_shlvl_icon ""
set -x tide_shlvl_threshold "1"
set -x tide_git_bg_color "normal"
set -x tide_git_bg_color_unstable "normal"
set -x tide_git_bg_color_urgent "normal"
set -x tide_git_color_branch "brgreen"
set -x tide_git_color_conflicted "brred"
set -x tide_git_color_dirty "bryellow"
set -x tide_git_color_operation "brred"
set -x tide_git_color_staged "bryellow"
set -x tide_git_color_stash "brgreen"
set -x tide_git_color_untracked "brblue"
set -x tide_git_color_upstream "brgreen"
set -x tide_git_icon ""
set -x tide_git_truncation_length "24"
set -x tide_git_truncation_strategy ""
set -x tide_direnv_bg_color "normal"
set -x tide_direnv_bg_color_denied "normal"
set -x tide_direnv_color "bryellow"
set -x tide_direnv_color_denied "brred"
set -x tide_direnv_icon ""
set -x tide_private_mode_bg_color "normal"
set -x tide_private_mode_color "brwhite"
set -x tide_private_mode_icon "󰗹"
# Langs, tools
set -x tide_aws_bg_color "normal"
set -x tide_aws_color "yellow"
set -x tide_aws_icon ""
set -x tide_bun_bg_color "normal"
set -x tide_bun_color "white"
set -x tide_bun_icon "󰳓"
set -x tide_crystal_bg_color "normal"
set -x tide_crystal_color "brwhite"
set -x tide_crystal_icon ""
set -x tide_distrobox_bg_color "normal"
set -x tide_distrobox_color "brmagenta"
set -x tide_distrobox_icon "󰆧"
set -x tide_docker_bg_color "normal"
set -x tide_docker_color "blue"
set -x tide_docker_default_contexts default colima
set -x tide_docker_icon ""
set -x tide_elixir_bg_color "normal"
set -x tide_elixir_color "magenta"
set -x tide_elixir_icon ""
set -x tide_gcloud_bg_color "normal"
set -x tide_gcloud_color "blue"
set -x tide_gcloud_icon "󰊭"
set -x tide_go_bg_color "normal"
set -x tide_go_color "brcyan"
set -x tide_go_icon ""
set -x tide_java_bg_color "normal"
set -x tide_java_color "yellow"
set -x tide_java_icon ""
set -x tide_jobs_bg_color "normal"
set -x tide_jobs_color "green"
set -x tide_jobs_icon ""
set -x tide_jobs_number_threshold "1000"
set -x tide_kubectl_bg_color "normal"
set -x tide_kubectl_color "blue"
set -x tide_kubectl_icon "󱃾"
set -x tide_nix3_shell_bg_color "normal"
set -x tide_nix3_shell_color "brblue"
set -x tide_nix3_shell_icon ""
set -x tide_juju_bg_color "normal"
set -x tide_juju_color "yellow"
set -x tide_juju_icon ""
set -x tide_node_bg_color "normal"
set -x tide_node_color "green"
set -x tide_node_icon ""
set -x tide_os_bg_color "normal"
set -x tide_os_color "brwhite"
set -x tide_os_icon ""
set -x tide_php_bg_color "normal"
set -x tide_php_color "blue"
set -x tide_php_icon ""
set -x tide_pulumi_bg_color "normal"
set -x tide_pulumi_color "yellow"
set -x tide_pulumi_icon ""
set -x tide_python_bg_color "normal"
set -x tide_python_color "cyan"
set -x tide_python_icon "󰌠"
set -x tide_ruby_bg_color "normal"
set -x tide_ruby_color "red"
set -x tide_ruby_icon ""
set -x tide_rustc_bg_color "normal"
set -x tide_rustc_color "red"
set -x tide_rustc_icon ""
set -x tide_terraform_bg_color "normal"
set -x tide_terraform_color "magenta"
set -x tide_terraform_icon "󱁢"
set -x tide_time_bg_color "normal"
set -x tide_time_color "brblack"
set -x tide_time_format "%T"
set -x tide_toolbox_bg_color "normal"
set -x tide_toolbox_color "magenta"
set -x tide_toolbox_icon ""
set -x tide_zig_bg_color "normal"
set -x tide_zig_color "yellow"
set -x tide_zig_icon ""
'';
};
}

View File

@@ -0,0 +1,22 @@
# Taken from Misterio77 https://github.com/Misterio77/nix-config/blob/main/home/gabriel/features/cli/fish/up-or-search.fish
# Merge history upon doing up-or-search
# This lets multiple fish instances share history
if commandline --search-mode
commandline -f history-search-backward
return
end
if commandline --paging-mode
commandline -f up-line
return
end
set -l lineno (commandline -L)
switch $lineno
case 1
commandline -f history-search-backward
# Here we go
history merge
case '*'
commandline -f up-line
end