Skip to content

Instantly share code, notes, and snippets.

@ttscoff ttscoff/tm.fish
Created Dec 17, 2019

Embed
What would you like to do?
Fish completion for tm.bash
# ~/.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
You can’t perform that action at this time.