Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created December 17, 2019 08:49
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttscoff/64836c69bccc3fb6cdb09160e9860972 to your computer and use it in GitHub Desktop.
Save ttscoff/64836c69bccc3fb6cdb09160e9860972 to your computer and use it in GitHub Desktop.
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