Get ssh-agent working properly with fish
This commit is contained in:
parent
2dc212d04f
commit
a631177116
@ -73,3 +73,5 @@ function fish_prompt --description 'Write out the prompt; do not replace this. I
|
|||||||
printf "%b" (string join " \n" (vterm_old_fish_prompt))
|
printf "%b" (string join " \n" (vterm_old_fish_prompt))
|
||||||
vterm_prompt_end
|
vterm_prompt_end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fish_ssh_agent
|
@ -6,6 +6,7 @@ SETUVAR --export LC_COLLATE:C
|
|||||||
SETUVAR --export --path LD_LIBRARY_PATH:/usr/local/lib
|
SETUVAR --export --path LD_LIBRARY_PATH:/usr/local/lib
|
||||||
SETUVAR --export PYTHONSTARTUP:/etc/python/pythonrc
|
SETUVAR --export PYTHONSTARTUP:/etc/python/pythonrc
|
||||||
SETUVAR --export RUSTUP_HOME:/home/joe/\x2elocal/share/rustup/
|
SETUVAR --export RUSTUP_HOME:/home/joe/\x2elocal/share/rustup/
|
||||||
|
SETUVAR SSH_AUTH_SOCK:/run/user/1000/ssh\x2dagent\x2esocket
|
||||||
SETUVAR XDG_CACHE_HOME:/home/joe/\x2ecache
|
SETUVAR XDG_CACHE_HOME:/home/joe/\x2ecache
|
||||||
SETUVAR XDG_CONFIG_HOME:/home/joe/\x2econfig
|
SETUVAR XDG_CONFIG_HOME:/home/joe/\x2econfig
|
||||||
SETUVAR XDG_DATA_HOME:/home/joe/\x2elocal/share
|
SETUVAR XDG_DATA_HOME:/home/joe/\x2elocal/share
|
||||||
@ -40,4 +41,4 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
|||||||
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_selected_background:\x2dr
|
||||||
SETUVAR fish_user_paths:/home/joe/\x2elocal/share/JetBrains/Toolbox/scripts\x1e/home/joe/\x2elocal/bin/elm\x1e/home/joe/\x2elocal/share/bin/cargo/bin\x1e\x1e/home/joe/\x2elocal/bin
|
SETUVAR --export fish_user_paths:/home/joe/\x2elocal/share/bin/cargo/bin\x1e/home/joe/\x2elocal/bin\x1e/home/joe/\x2enimble/bin
|
||||||
|
32
.config/fish/functions/fish_ssh_agent.fish
Normal file
32
.config/fish/functions/fish_ssh_agent.fish
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
function __ssh_agent_is_started -d "check if ssh agent is already started"
|
||||||
|
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
|
||||||
|
|
||||||
|
ps -ef | grep $SSH_AGENT_PID | grep -v grep | grep -q ssh-agent
|
||||||
|
#pgrep ssh-agent
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
true # suppress errors from setenv, i.e. set -gx
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function fish_ssh_agent --description "Start ssh-agent if not started yet, or uses already started ssh-agent."
|
||||||
|
if test -z "$SSH_ENV"
|
||||||
|
set -xg SSH_ENV $HOME/.ssh/environment
|
||||||
|
end
|
||||||
|
|
||||||
|
if not __ssh_agent_is_started
|
||||||
|
__ssh_agent_start
|
||||||
|
end
|
||||||
|
end
|
3
.config/fish/functions/vim.fish
Normal file
3
.config/fish/functions/vim.fish
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function vim --wraps=nvim --description 'alias vim nvim'
|
||||||
|
nvim $argv
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user