Reputation: 513
Why does Atom always unselect the regex option in the find-and-replace menu? I know I can use a shortcut to re-enable it but it only seems to stick for the current session. If I close and then reopen Atom, the find-and-replace menu once again defaults to having regex unselected. Who are these coders who don't search using regex?!? I assume there's an undocumented setting I can use in config.json but I didn't see anything in the GUI settings.
Upvotes: 1
Views: 81
Reputation: 513
Well after I accepted @netizen's answer I did some research and looked at the atom/find-and-replace package itself and specifically it's settings file: https://github.com/atom/find-and-replace/blob/master/lib/find-options.coffee
There's a setting find-and-replace.useRegex
noted there which seemed to be a boolean, so I modified my Atom config.cson (Command Palette or Settings > Open Your Config > edit config.cson) like so:
"*":
"find-and-replace":
useRegex: true
This had the desired effect—regex is turned on by default when I use find/replace now. Note that, since find-and-replace is an additional package, settings changes to it don't go under "core" in your config.cson.
There are other boolean settings for caseSensitive, wholeWord, and inCurrentSelection, too.
Upvotes: 1
Reputation: 1083
It will always start that way. What I do is to assign easy shortcuts that only apply in the search editor. This is in my .atom/keymap.cson (open by wenu, edit, keymap, or select "Application: Open your keymap" from the command palette:
'.platform-linux .find-and-replace':
'ctrl-/': 'find-and-replace:toggle-regex-option'
'ctrl-*': 'find-and-replace:toggle-selection-option'
'ctrl--': 'find-and-replace:toggle-case-option'
'ctrl-+': 'find-and-replace:toggle-whole-word-option'
Upvotes: 1