..
This commit is contained in:
@@ -69,7 +69,7 @@ source ~/.bash_alias
|
|||||||
## source custom functions for specific purposes
|
## source custom functions for specific purposes
|
||||||
script_path=${HOME}/dotfiles/scripts/
|
script_path=${HOME}/dotfiles/scripts/
|
||||||
source_list=()
|
source_list=()
|
||||||
source_list+=("${script_path}/navigate_bash_setup.sh")
|
source_list+=("${script_path}/navigate_bash_setup")
|
||||||
source_list+=("${script_path}/fzf-bash-history")
|
source_list+=("${script_path}/fzf-bash-history")
|
||||||
source_list+=("${script_path}/colors.sh")
|
source_list+=("${script_path}/colors.sh")
|
||||||
source_list+=("${script_path}/dunst.sh")
|
source_list+=("${script_path}/dunst.sh")
|
||||||
|
|||||||
52
scripts/navigate_bash_setup
Normal file
52
scripts/navigate_bash_setup
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
__call_navigate() {
|
||||||
|
arg_pid=" --pid $$ "
|
||||||
|
eval "$(navigate ${arg_pid} $@)"
|
||||||
|
}
|
||||||
|
|
||||||
|
function push {
|
||||||
|
__call_navigate "push $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function pop {
|
||||||
|
__call_navigate "pop $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function stack {
|
||||||
|
__call_navigate "stack $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function book {
|
||||||
|
__call_navigate "bookmark $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# completion function for `book`
|
||||||
|
function _book {
|
||||||
|
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
if [[ COMP_CWORD -eq 1 ]]; then
|
||||||
|
BOOKMARKS="add remove $(__call_navigate bookmark names)"
|
||||||
|
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
|
||||||
|
elif [[ COMP_CWORD -eq 2 ]]; then
|
||||||
|
if [[ COMP_WORDS[1] -eq "remove" ]]; then
|
||||||
|
BOOKMARKS="$(__call_navigate bookmark names)"
|
||||||
|
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
|
||||||
|
fi
|
||||||
|
elif [[ COMP_CWORD -eq 3 ]]; then
|
||||||
|
if [[ COMP_WORDS[1] -eq "add" ]]; then
|
||||||
|
COMPREPLY=($(compgen -o dirnames -- $CURRENT_WORD))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# completion function for `pop`
|
||||||
|
function _pop {
|
||||||
|
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
if [[ COMP_CWORD -eq 1 ]]; then
|
||||||
|
COMPREPLY=($(compgen -W "all <number>"))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -o dirnames push
|
||||||
|
complete -F _pop pop
|
||||||
|
complete -F _book book
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
__call_navigate() {
|
|
||||||
arg_pid=" --pid $$ "
|
|
||||||
eval "$(navigate ${arg_pid} $@)"
|
|
||||||
}
|
|
||||||
|
|
||||||
function push {
|
|
||||||
__call_navigate "push $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function pop {
|
|
||||||
__call_navigate "pop $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function stack {
|
|
||||||
__call_navigate "stack $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function book {
|
|
||||||
__call_navigate "bookmark $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# completion for `book`
|
|
||||||
function _book {
|
|
||||||
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
BOOKMARKS="$(__call_navigate bookmark names)"
|
|
||||||
COMPREPLY=($(compgen -W "${BOOKMARKS}" -- $CURRENT_WORD))
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o dirnames push
|
|
||||||
complete -F _book book
|
|
||||||
Reference in New Issue
Block a user