Skip to content

Commit

Permalink
"fuzzy-snippets": Improve CLI user experience.
Browse files Browse the repository at this point in the history
  • Loading branch information
damiendart committed Jul 15, 2024
1 parent bd4f797 commit 79e5bfd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/fuzzy-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ help() {
cat << HELP
A snippet browser and selector.
Usage: $(basename "$0") [FLAGS] [INITIAL-QUERY]
Usage: $(basename "$0") [FLAGS] [INITIAL-QUERY...]
Requires fzf, ripgrep, snippet-placeholder, and xsel, and that the
SNIPPET_PATH environment variable is set to a colon-seperated list of
Expand Down Expand Up @@ -137,6 +137,8 @@ fi

FZF_EXPECT='ctrl-p,f1'
FZF_LABEL='ENTER: Copy snippet ╱ CTRL+P: Print snippet ╱ F1: Help'
IFS=' '
INITIAL_QUERY="$*"

if [ "$VIM_MODE" = 1 ]; then
FZF_EXPECT='ctrl-y,f1'
Expand All @@ -160,7 +162,7 @@ FZF_OUTPUT=$(\
--info='inline-right' \
--preview='cat {} 2>/dev/null' \
--prompt='--%<-- ' \
--query="$1" \
--query="$INITIAL_QUERY" \
--scheme='path' \
--with-nth='-1' \
)
Expand Down

0 comments on commit 79e5bfd

Please sign in to comment.