diff --git a/helper/git_query.sh b/helper/git_query.sh index 25ce9c3..06322de 100644 --- a/helper/git_query.sh +++ b/helper/git_query.sh @@ -202,11 +202,12 @@ function get_stash() { ####################################### function grep_words() { local header="${1:-select matches to edit}" + local delimiter="${2:-3}" set_fzf_multi "$2" cd "${DOTBARE_TREE}" || exit git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" \ grep --line-number -- . \ - | fzf --delimiter : --nth 3.. --header="${header}" \ + | fzf --delimiter : --nth "${delimiter}".. --header="${header}" \ --preview "${mydir}/../helper/preview.sh ${DOTBARE_TREE}/{}" \ | awk -F ":" -v home="${DOTBARE_TREE}" '{ print home "/" $1 ":" $2 diff --git a/scripts/fgrep b/scripts/fgrep index ebe2e29..b44d3bf 100755 --- a/scripts/fgrep +++ b/scripts/fgrep @@ -26,9 +26,19 @@ Optional arguments: } selected_lines=() +fzf_search_delimiter=3 while [[ "$#" -gt 0 ]]; do case "$1" in + -d|--delimiter) + fzf_search_delimiter="$2" + shift + shift + ;; + -f|--full) + fzf_search_delimiter=1 + shift + ;; -h|--help) usage exit 0 @@ -52,7 +62,7 @@ while IFS= read -r line; do selected_lines+=("${line}") ;; esac -done < <(grep_words) +done < <(grep_words "select matches to edit" "${fzf_search_delimiter}") [[ "${#selected_lines[@]}" -eq 0 ]] && exit 1