Compare commits

...

2 commits

Author SHA1 Message Date
5f4ac03485
Added ssh-agent to fish 2023-10-25 01:02:22 -06:00
4697e21c0d
Themed fish 2023-10-24 23:46:40 -06:00
3 changed files with 135 additions and 19 deletions

View file

@ -1,3 +1,75 @@
function sshagent_findsockets
find /tmp -uid (id -u) -type s -name agent.\* 2>/dev/null
end
function sshagent_testsocket
if [ ! -x (command which ssh-add) ] ;
echo "ssh-add is not available"
return 1
end
if [ X"$argv[1]" != X ] ;
set -xg SSH_AUTH_SOCK $argv[1]
end
if [ X"$SSH_AUTH_SOCK" = X ]
return 2
end
if [ -S $SSH_AUTH_SOCK ] ;
ssh-add -l > /dev/null
if [ $status = 2 ] ;
echo "Socket $SSH_AUTH_SOCK is dead! Deleting!"
rm -f $SSH_AUTH_SOCK
return 4
else ;
#echo "Found ssh-agent $SSH_AUTH_SOCK"
return 0
end
else ;
echo "$SSH_AUTH_SOCK is not a socket!"
return 3
end
end
function ssh_agent_init
# ssh agent sockets can be attached to a ssh daemon process or an
# ssh-agent process.
set -l AGENTFOUND 0
# Attempt to find and use the ssh-agent in the current environment
if sshagent_testsocket ;
set AGENTFOUND 1
end
# If there is no agent in the environment, search /tmp for
# possible agents to reuse before starting a fresh ssh-agent
# process.
if [ $AGENTFOUND = 0 ];
for agentsocket in (sshagent_findsockets)
if [ $AGENTFOUND != 0 ] ;
break
end
if sshagent_testsocket $agentsocket ;
set AGENTFOUND 1
end
end
end
# If at this point we still haven't located an agent, it's time to
# start a new one
if [ $AGENTFOUND = 0 ] ;
echo need to start a new agent
eval (ssh-agent -c)
end
# Finally, show what keys are currently in the agent
# ssh-add -l
end
if status is-interactive if status is-interactive
set -gx EDITOR nvim set -gx EDITOR nvim
set -gx VISUAL nvim set -gx VISUAL nvim
@ -5,4 +77,6 @@ if status is-interactive
set -gx TERMINAL foot set -gx TERMINAL foot
set -gx MOZ_ENABLE_WAYLAND 1 set -gx MOZ_ENABLE_WAYLAND 1
set -gx _JAVA_AWT_WM_NONREPARENTING 1 set -gx _JAVA_AWT_WM_NONREPARENTING 1
ssh_agent_init
end end

View file

@ -1,33 +1,44 @@
# This file contains fish universal variable definitions. # This file contains fish universal variable definitions.
# VERSION: 3.0 # VERSION: 3.0
SETUVAR __fish_initialized:3400 SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:555\x1ebrblack SETUVAR fish_color_autosuggestion:4D5566
SETUVAR fish_color_cancel:\x2dr SETUVAR fish_color_cancel:\x2d\x2dreverse
SETUVAR fish_color_command:brblue SETUVAR fish_color_command:39BAE6
SETUVAR fish_color_comment:red SETUVAR fish_color_comment:626A73
SETUVAR fish_color_cwd:green SETUVAR fish_color_cwd:59C2FF
SETUVAR fish_color_cwd_root:red SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:green SETUVAR fish_color_end:F29668
SETUVAR fish_color_error:brred SETUVAR fish_color_error:FF3333
SETUVAR fish_color_escape:brcyan SETUVAR fish_color_escape:95E6CB
SETUVAR fish_color_history_current:\x2d\x2dbold SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow SETUVAR fish_color_host_remote:\x1d
SETUVAR fish_color_normal:normal SETUVAR fish_color_keyword:\x1d
SETUVAR fish_color_operator:brcyan SETUVAR fish_color_match:F07178
SETUVAR fish_color_param:cyan SETUVAR fish_color_normal:B3B1AD
SETUVAR fish_color_quote:yellow SETUVAR fish_color_operator:E6B450
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold SETUVAR fish_color_option:\x1d
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_param:B3B1AD
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack SETUVAR fish_color_quote:C2D94C
SETUVAR fish_color_redirection:FFEE99
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3dE6B450
SETUVAR fish_color_selection:\x2d\x2dbackground\x3dE6B450
SETUVAR fish_color_status:red SETUVAR fish_color_status:red
SETUVAR fish_color_user:yellow SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:\x1d SETUVAR fish_greeting:\x1d
SETUVAR fish_key_bindings:fish_default_key_bindings SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:normal SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow\x1e\x2di SETUVAR fish_pager_color_description:B3A06D
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dE6B450
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR fish_user_paths:/home/logan/\x2elocal/bin SETUVAR fish_user_paths:/home/logan/\x2elocal/bin

View file

@ -0,0 +1,31 @@
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l normal (set_color normal)
set -l status_color (set_color brgreen)
set -l cwd_color (set_color $fish_color_cwd)
set -l vcs_color (set_color brpurple)
set -l prompt_status ""
# Since we display the prompt on a new line allow the directory names to be longer.
set -q fish_prompt_pwd_dir_length
or set -lx fish_prompt_pwd_dir_length 0
# Color the prompt differently when we're root
set -l suffix ''
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set cwd_color (set_color $fish_color_cwd_root)
end
set suffix '#'
end
# Color the prompt in red on error
if test $last_status -ne 0
set status_color (set_color $fish_color_error)
set prompt_status $status_color "[" $last_status "]" $normal
end
#echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
echo -s (prompt_login) ' ' $cwd_color $PWD $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
echo -n -s $status_color $suffix ' ' $normal
end