counsel-ag: Search and match the whole word

Published on Sep 15, 2021, by Junji Zhi

ag supports the option `-w` to match the whole word. We could find a way to pass this command option in as a prefix argument.

As mentioned in searching and filtering by file name, I like to bind (counsel-projectile-ag) to a common shortcut, Super + f (or s-f), so that I can pass the universal argument with C-u to filter results.

Example: To search the word coffee I would do:

  1. Press C-u s-f
  2. Type -w
  3. Type search string coffee and press enter