Skip to content

Commit

Permalink
Use separate arguments for grep and git grep with --tags.
Browse files Browse the repository at this point in the history
refs gh-324
  • Loading branch information
xwmx committed Jun 27, 2024
1 parent 0d73002 commit 0f3d43d
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -16980,13 +16980,26 @@ _search() {
_use_git_grep=1
fi

local _grep_arguments=(
"-P"
"-I"
"--ignore-case"
"--only-matching"
-e '(^|\s)#[A-Za-z0-9_-]+'
)
if ((_use_git_grep))
then
local _grep_arguments=(
"-P"
"-I"
"--ignore-case"
"--only-matching"
-e '(^|[[:space:]])#[A-Za-z0-9_-]+'
)
else
local _grep_arguments=(
"--extended-regexp"
"-I"
"--ignore-case"
"--only-matching"
-e '[[:space:]]#[A-Za-z0-9_-]+'
-e '^#[A-Za-z0-9_-]+'
)
fi

{
local __target_path=
for __target_path in "${_target_paths[@]:-}"
Expand Down

0 comments on commit 0f3d43d

Please sign in to comment.