diff --git a/helper/git_query.sh b/helper/git_query.sh index 06322de..92520ae 100644 --- a/helper/git_query.sh +++ b/helper/git_query.sh @@ -195,7 +195,8 @@ function get_stash() { # all tracked files in the bare repo. # Arguments: # $1: the help message to display in header -# $2: if exists, don't do multi select, only allow single selection +# $2: the fzf delimiter to start searching, default is 3 +# $3: if exists, don't do multi select, only allow single selection # Outputs: # the selected file name with it's line number and line, seperated by ":" # e.g. .bash_profile:1:echo hello diff --git a/scripts/fgrep b/scripts/fgrep index b44d3bf..6760287 100755 --- a/scripts/fgrep +++ b/scripts/fgrep @@ -6,8 +6,11 @@ # Globals # mydir: path to this current script # selected_lines: selected lines to edit +# fzf_search_delimiter: the col to start searching in fzf # Arguments # -h|--help: show help message and exit +# -c COL| --col COL: use a different delimiter in fzf search +# -f|--full: include file name in fzf searching, as if using --col 1 set -e set -f @@ -21,8 +24,12 @@ function usage() { Grep words within tracked files and select to edit matches. +Default: start searching from 3rd column (excluding the file name during search). + Optional arguments: - -h, --help\t\tshow this help message and exit." + -h, --help\t\tshow this help message and exit. + -c COL, --col COL\tspecify the column number to start searching. + -f, --full\t\tinclude all column during search, as if using '--col 1'." } selected_lines=() @@ -30,7 +37,7 @@ fzf_search_delimiter=3 while [[ "$#" -gt 0 ]]; do case "$1" in - -d|--delimiter) + -c|--col) fzf_search_delimiter="$2" shift shift