Created
December 17, 2019 08:49
-
-
Save ttscoff/64836c69bccc3fb6cdb09160e9860972 to your computer and use it in GitHub Desktop.
Fish completion for tm.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.config/fish/completions/tm.fish | |
function __tm_has_no_args | |
set -l cmd (commandline -opc) | |
echo $cmd | |
return (test (count $cmd) -eq 1) | |
end | |
function __tm_has_windows | |
set -l cmd (commandline -opc) | |
set -l res (tmux list-windows -t $cmd[-1] 2>/dev/null >/dev/null) | |
return $status | |
end | |
function __tm_list_windows | |
set -l cmd (commandline -opc) | |
tmux list-windows -t $cmd[-1] -F "#W" 2>/dev/null | |
end | |
complete -x -c tm -n '__tm_has_windows' -a '(__tm_list_windows)' | |
complete -x -c tm -n '__tm_has_no_args' -a "(tmux -q list-sessions -F '#S' 2> /dev/null)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment