diff options
| -rwxr-xr-x | bin/common/askpass | 13 | ||||
| -rwxr-xr-x | bin/menuscripts/mpass | 2 | ||||
| -rw-r--r-- | config/essentials/shell/functions.sh | 14 | ||||
| -rw-r--r-- | config/essentials/vis/visrc.lua | 21 | ||||
| -rw-r--r-- | config/home/.zshenv | 3 | 
5 files changed, 37 insertions, 16 deletions
diff --git a/bin/common/askpass b/bin/common/askpass new file mode 100755 index 0000000..2725dbf --- /dev/null +++ b/bin/common/askpass @@ -0,0 +1,13 @@ +#!/bin/sh + +# We can figure out the password for the key based on $1 +# which is in the following form: +#	Enter passphrase for key 'path/to/key': +# The point is to retrieve the path and use the final name of the key +# find the according password. +key="$(printf '%s\n' "$1" | +	cut -f 2 -d \' | +	awk -F '/' '{print $NF}')" +pass="keys/$(hostname)/ssh/$key" + +pass show "$pass" | head -n 1 diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass index 7348321..f513b16 100755 --- a/bin/menuscripts/mpass +++ b/bin/menuscripts/mpass @@ -14,7 +14,7 @@ list_pswds()  while [ -d "$store/$file" ]  do -	choice="$(list_pswds "$store/$file" | dmenu -c -g 4 -l 4)" +	choice="$(list_pswds "$store/$file" | commander -c)"  	[ "$choice" ] || exit 1  	[ -z "$file" ] && file="$choice" || file="$file/$choice"  done diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1b69fbd..27eb33e 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -364,17 +364,3 @@ ffconcat () {  	ffmpeg -y -f concat -safe 0 -i $tmp -c copy "$1"  	rm $tmp  } - -# wrap ssh and add key if exists -ssh() { -	if [ "$#" -gt 1 ]  -	then -		/usr/bin/ssh $@ -		return -	fi - -	grep -E "Host\s+$1" $HOME/.ssh/config > /dev/null 2>&1 && -		keyadd "$1" > /dev/null 2>&1 -	/usr/bin/ssh "$1" -} - diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index 7847784..e35b436 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -125,9 +125,28 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused a  	if win.syntax == "bash" then  		map_keys(  			m.NORMAL, -			" v", +			";p",  			"V:x/^(\\s*)(.+)$/ c/\\1>\\&2 printf '\\2: %s\\\\n' \"$\\2\"/<Enter><Escape>",  			"Print variable"  		) +		map_keys( +			m.NORMAL, +			";v", +			"V:x/^(\\s*)(.+)$/ c/\\1\"$(\\2)\"/<Enter><Escape>", +			"Surround in variable" +		) +		map_keys( +			m.NORMAL, +			";|", +			"V:x/\\| / c/|\n\t/<Enter><Escape>", +			"Wrap one-line multi pipe command" +		) +		map_keys( +			m.NORMAL, +			";e", +			"V:x/^(\\s*)(.+)$/ c/\\1[ \"\\2\" ] || exit 1/<Enter><Escape>", +			"Condition exit if empty" +		) +  	end  end) diff --git a/config/home/.zshenv b/config/home/.zshenv index a87f01d..34a7c2f 100644 --- a/config/home/.zshenv +++ b/config/home/.zshenv @@ -96,3 +96,6 @@ export PATH="$PATH:$GOPATH/bin"  export PLAN9=/usr/lib/plan9  export PATH="$PATH:$PLAN9/bin" + +export SSH_ASKPASS=askpass +export SSH_ASKPASS_REQUIRE=prefer  | 
