Bash: please completion
This commit is contained in:
parent
a8c315f5b4
commit
2a583f1920
3 changed files with 36 additions and 0 deletions
|
@ -33,7 +33,9 @@ alias ra='rg --no-ignore -.'
|
||||||
alias ee='exit'
|
alias ee='exit'
|
||||||
alias ffprobe='ffprobe -hide_banner'
|
alias ffprobe='ffprobe -hide_banner'
|
||||||
alias shm='cd /dev/shm'
|
alias shm='cd /dev/shm'
|
||||||
|
alias avada-kedavra='kill -9'
|
||||||
alias ip='ip -color'
|
alias ip='ip -color'
|
||||||
|
alias ip6='ip -color -6'
|
||||||
|
|
||||||
|
|
||||||
# ===================================================================
|
# ===================================================================
|
||||||
|
|
|
@ -282,6 +282,17 @@ function bless () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Attach to tmux session ============================================
|
# Attach to tmux session ============================================
|
||||||
|
function _ta() {
|
||||||
|
local cur prev opts
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
opts=$(tmux ls | awk 'match($0, /^[^:]*: /) { print substr($0, RSTART, RLENGTH-2) }')
|
||||||
|
|
||||||
|
COMPREPLY+=( $(compgen -W "$opts" -- ${cur}) )
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
function ta() {
|
function ta() {
|
||||||
if [[ -n "$1" ]]; then
|
if [[ -n "$1" ]]; then
|
||||||
tmux new -As "$1"
|
tmux new -As "$1"
|
||||||
|
@ -295,6 +306,8 @@ function ta() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
complete -F _ta ta
|
||||||
|
|
||||||
# Image magick ======================================================
|
# Image magick ======================================================
|
||||||
function magika() {
|
function magika() {
|
||||||
if [[ "$1" == "a" || "$1" == "av1" ]]; then
|
if [[ "$1" == "a" || "$1" == "av1" ]]; then
|
||||||
|
@ -354,4 +367,24 @@ rooter() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Completion for please =============================================
|
||||||
|
_please() {
|
||||||
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
|
# Complete command in first argument position
|
||||||
|
if [ $cword -eq 1 ]; then
|
||||||
|
COMPREPLY=($(compgen -c -- "$cur"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove first word (please)
|
||||||
|
words=("${words[@]:1}")
|
||||||
|
(( cword-- ))
|
||||||
|
|
||||||
|
# Run the completion for the command after 'please'
|
||||||
|
_command_offset 1
|
||||||
|
}
|
||||||
|
complete -F _please please
|
||||||
|
|
||||||
# vim: set ft=bash ff=unix:
|
# vim: set ft=bash ff=unix:
|
||||||
|
|
|
@ -13,6 +13,7 @@ source_completion_scripts () {
|
||||||
|
|
||||||
if [[ "$(type -t _fzf_setup_completion)" == 'function' ]]; then
|
if [[ "$(type -t _fzf_setup_completion)" == 'function' ]]; then
|
||||||
_fzf_setup_completion path mpv vi vii nvim vimiv cat
|
_fzf_setup_completion path mpv vi vii nvim vimiv cat
|
||||||
|
_fzf_setup_completion proc avada-kedavra
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue