jump: use gum
This commit is contained in:
parent
4336b974a4
commit
75d95fe20e
|
@ -36,26 +36,31 @@ in {
|
|||
programs = let
|
||||
rcScript = ''
|
||||
function jump {
|
||||
pushd . > /dev/null
|
||||
cd -P "$_JUMP_MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
|
||||
if test -z "$1"; then
|
||||
test -n "$_JUMP_RECURSE" && return 1
|
||||
_JUMP_RECURSE=1 jump "$(${lib.getExe pkgs.fd} . "$_JUMP_MARKPATH" --type l -X ${lib.getExe pkgs.gum} choose --ordered {/})"
|
||||
else
|
||||
pushd . > /dev/null
|
||||
cd -P "$_JUMP_MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
|
||||
fi
|
||||
}
|
||||
function mark {
|
||||
mkdir -p "$_JUMP_MARKPATH" &&
|
||||
test ! -L "$_JUMP_MARKPATH/$1" \
|
||||
&& ln -s "$(pwd)" "$_JUMP_MARKPATH/$1" \
|
||||
|| echo "mark already exists!"
|
||||
mkdir -p "$_JUMP_MARKPATH" &&
|
||||
test ! -L "$_JUMP_MARKPATH/$1" \
|
||||
&& ln -s "$(pwd)" "$_JUMP_MARKPATH/$1" \
|
||||
|| echo "mark already exists!"
|
||||
}
|
||||
function unmark {
|
||||
test ! -z "$1" \
|
||||
&& rm -i "$_JUMP_MARKPATH/$1"
|
||||
}
|
||||
function marks {
|
||||
#ls -l "$_JUMP_MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
|
||||
command ls --color=always -l "$_JUMP_MARKPATH" | tr -s ' ' | cut -d' ' -f9- | sed -e 's/ -> /§/g' | column -t -s '§' -o ' -> '
|
||||
#ls -l "$_JUMP_MARKPATH" | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
|
||||
command ls --color=always -l "$_JUMP_MARKPATH" | tr -s ' ' | cut -d' ' -f9- | sed -e 's/ -> /§/g' | column -t -s '§' -o ' -> '
|
||||
}
|
||||
_complete_jump_marks() {
|
||||
local curw=''${COMP_WORDS[COMP_CWORD]}
|
||||
local wordlist=$(find $_JUMP_MARKPATH -type l -printf "%f\n")
|
||||
local wordlist=$(find "$_JUMP_MARKPATH" -type l -printf "%f\n")
|
||||
COMPREPLY=($(compgen -W ''\'''${wordlist[@]}' -- "$curw"))
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue