aboutsummaryrefslogtreecommitdiff
path: root/fzf-exec/fzf-exec.sh
blob: 3085831b54dae373ab934dd86716e65da957bfc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env bash
all_cmds() {
  tmux list-commands -F $'#{command_list_name}#{?command_list_alias,\n#{command_list_alias},}'
}

selected_cmd=$(all_cmds | fzf \
  --prompt : \
  --bind 'enter:accept-or-print-query,tab:replace-query,alt-backspace:clear-query' \
  --preview "tmux-doc.sh $(printf '{}' | cut -d' ' -f1)"
)

tmux $(echo "$selected_cmd" | sed "s@~@$HOME@g")