From f4672b499fa42b19ae82235f73e8b9d5b7e18212 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 22 Apr 2025 11:59:14 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-22 11:59:14 --- .config/fish/conf.d/fish-ssh-agent.fish | 7 ++++++ .config/fish/fish_plugins | 1 + .config/fish/fish_variables | 3 ++- .../functions/__ssh_agent_is_started.fish | 23 +++++++++++++++++++ .config/fish/functions/__ssh_agent_start.fish | 5 ++++ 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 .config/fish/conf.d/fish-ssh-agent.fish create mode 100644 .config/fish/functions/__ssh_agent_is_started.fish create mode 100644 .config/fish/functions/__ssh_agent_start.fish diff --git a/.config/fish/conf.d/fish-ssh-agent.fish b/.config/fish/conf.d/fish-ssh-agent.fish new file mode 100644 index 00000000..719087a1 --- /dev/null +++ b/.config/fish/conf.d/fish-ssh-agent.fish @@ -0,0 +1,7 @@ +if test -z "$SSH_ENV" + set -xg SSH_ENV $HOME/.ssh/environment +end + +if not __ssh_agent_is_started + __ssh_agent_start +end diff --git a/.config/fish/fish_plugins b/.config/fish/fish_plugins index 8a6ded8e..0da6fc9c 100644 --- a/.config/fish/fish_plugins +++ b/.config/fish/fish_plugins @@ -10,3 +10,4 @@ nickeb96/puffer-fish paldepind/projectdo wfxr/forgit jorgebucaran/nvm.fish +danhper/fish-ssh-agent diff --git a/.config/fish/fish_variables b/.config/fish/fish_variables index 1010f179..6ef58e63 100644 --- a/.config/fish/fish_variables +++ b/.config/fish/fish_variables @@ -4,6 +4,7 @@ SETUVAR EDITOR:hx SETUVAR --export XDG_CONFIG_HOME:/home/fic/\x2econfig SETUVAR Z_DATA_DIR:/home/fic/\x2elocal/share/z SETUVAR __fish_initialized:3800 +SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:\x7e/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e\x7e/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish SETUVAR _fisher_franciscolourenco_2F_done_files:\x7e/\x2econfig/fish/conf\x2ed/done\x2efish SETUVAR _fisher_jorgebucaran_2F_autopair_2E_fish_files:\x7e/\x2econfig/fish/functions/_autopair_backspace\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_left\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_right\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_same\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_tab\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/autopair\x2efish SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish @@ -15,7 +16,7 @@ SETUVAR _fisher_meaningful_2D_ooo_2F_sponge_files:\x7e/\x2econfig/fish/functions SETUVAR _fisher_nickeb96_2F_puffer_2D_fish_files:\x7e/\x2econfig/fish/functions/_puffer_fish_expand_bang\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_dots\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_lastarg\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/puffer_fish_key_bindings\x2efish SETUVAR _fisher_paldepind_2F_projectdo_files:\x7e/\x2econfig/fish/functions/projectdo_build\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_run\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_test\x2efish\x1e\x7e/\x2econfig/fish/functions/projectdo_tool\x2efish\x1e\x7e/\x2econfig/fish/completions/projectdo\x2efish SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish -SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1efranciscolourenco/done\x1ejorgebucaran/replay\x2efish\x1ejorgebucaran/spark\x2efish\x1ejoseluisq/gitnow\x402\x2e12\x2e0\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1enickeb96/puffer\x2dfish\x1epaldepind/projectdo\x1ewfxr/forgit\x1ejorgebucaran/nvm\x2efish +SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1efranciscolourenco/done\x1ejorgebucaran/replay\x2efish\x1ejorgebucaran/spark\x2efish\x1ejoseluisq/gitnow\x402\x2e12\x2e0\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1enickeb96/puffer\x2dfish\x1epaldepind/projectdo\x1ewfxr/forgit\x1ejorgebucaran/nvm\x2efish\x1edanhper/fish\x2dssh\x2dagent SETUVAR _fisher_upgraded_to_4_4:\x1d SETUVAR _fisher_wfxr_2F_forgit_files:\x7e/\x2econfig/fish/conf\x2ed/bin\x1e\x7e/\x2econfig/fish/conf\x2ed/forgit\x2eplugin\x2efish\x1e\x7e/\x2econfig/fish/completions/_git\x2dforgit\x1e\x7e/\x2econfig/fish/completions/git\x2dforgit\x2ebash\x1e\x7e/\x2econfig/fish/completions/git\x2dforgit\x2efish SETUVAR abbr_path:/home/fic/\x2econfig/fish/conf\x2ed/abbr\x2efish diff --git a/.config/fish/functions/__ssh_agent_is_started.fish b/.config/fish/functions/__ssh_agent_is_started.fish new file mode 100644 index 00000000..a9da28a5 --- /dev/null +++ b/.config/fish/functions/__ssh_agent_is_started.fish @@ -0,0 +1,23 @@ +function __ssh_agent_is_started -d "check if ssh agent is already started" + if test -n "$SSH_CONNECTION" + # This is an SSH session + ssh-add -l > /dev/null 2>&1 + if test $status -eq 0 -o $status -eq 1 + # An SSH agent was forwarded + return 0 + end + end + + if begin; test -f "$SSH_ENV"; and test -z "$SSH_AGENT_PID"; end + source $SSH_ENV > /dev/null + end + + if test -z "$SSH_AGENT_PID" + return 1 + end + + ssh-add -l > /dev/null 2>&1 + if test $status -eq 2 + return 1 + end +end diff --git a/.config/fish/functions/__ssh_agent_start.fish b/.config/fish/functions/__ssh_agent_start.fish new file mode 100644 index 00000000..3766fe49 --- /dev/null +++ b/.config/fish/functions/__ssh_agent_start.fish @@ -0,0 +1,5 @@ +function __ssh_agent_start -d "start a new ssh agent" + ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV + chmod 600 $SSH_ENV + source $SSH_ENV > /dev/null +end