How to search for whole words in Atom?


#1

Hi,

Just trying to do a search and replace using Atom.

I could not able to search for the whole words alone. Looks like currently there are 3 options to fine tune the search.

  1. Using Regex. ( I am not a Regex expert to use it)
  2. Case Sensitive search
  3. Only in Selection.

Just wondering how to perform my search for whole words. Any ideas??

Thanks in advance!


Whole word search
#2

Using Regex search, you can wrap your search in \b to match word boundaries. For example, searching for \belse\b will match ‘else’ but not ‘elseif’.


#3

Cool! Regex works. Thanks for educating me.

For a non Regex user like me, Atom’s search feature need to include an “Whole word” option for the user to check when doing the search. Just like “Case Sensitive” option and “Only in Selection” Option

Thanks!


#4

It is also a bit silly to have to type four extra characters. Also I usually search from a selection which means I have to do a lot extra clicking and typing.

This is one of those de facto features that every other editor on the planet has and atom should have also.


#5

If you feel this strongly about this missing feature, I recommend you send a pull request that implements it. Benefits both you and everyone else that wants the feature, and leaves the core team to focus on more important tasks.


#6

There is an Issue open on this here:


#7

So you are assuming this is less important. The whole purpose of this kind of discussion is to argue that it is important.

It would take the original author much less time to do this and what guarantee would I have that the request would be accepted?


#8

This is most certainly less important than solving e.g. performance issues when working with large files (and similar pressing issues). And especially so considering there exists a workaround, even though it is not ideal.

Why do you need a guarantee that it’ll be accepted?


#9

Don’t get me wrong, I’m not saying this isn’t important to you, but seeing how busy the core team is right now with the move to React and what not, I wouldn’t expect this feature to be prioritized anytime soon. But if you implement it and open a pull request, you’re much more likely to have this feature added very soon.

This is the whole point of Atom being open source; you see some feature that is missing, you should open an issue/feature request for it. And then ideally, you implement the feature yourself and open a pull request.

None of us are in any position to demand anything from the core Atom team (nor any other open source project), so if we desire some feature that is missing, it is our responsibility to help implement it. That’s the “manifesto” I try to follow at least.


#10

For those interested in this feature, I just submitted a PR that add the whole-word option:

If you have a preference for a button label or a key binding this is the right time to make hear your voice :).


#11

Awesome stuff @abe :smiley:


#12

This is totally off-topic but I’d like to make a minor point …

None of us are in any position to demand anything from the core Atom team (nor any other open source project

There is a slight difference between an open-source project with volunteer developers and one where the core team is employed by a for-profit company. Github will clearly make money from Atom because of it’s enforced integration with Github. I love Github and Atom and plan on devoting a lot of my energy to helping it. But I won’t feel guilty for feeling some entitlement just as Github is entitled to any ancillary profit.