How would you set "find backwards" to keybinding F1 but to also work on the text editor as the F3 works?


#1

in my keymap.cson i tried :

'atom-workspace':
    'f1': 'find-and-replace:show-previous'
'atom-text-editor':
    'f1': 'find-and-replace:show-previous 

but this is not doing it


#2

I’m not sure I understand what you’re trying to achieve. How does F3 work in the editor? Have you tried using the Keybinding Resolver (Cmd+. on OS X and Ctrl+. on other platforms)? It will show you what key Atom saw you press and the command that was triggered because of it.

(It is also mentioned in the Debugging section of the Atom Flight Manual.)


#3

What i am trying to achieve is actually bind find backwards to F1 (but to also work when the text editor is in focus)
F3 works like clicking the next (in the find and replace) even the focus is set on the text editor and not on the search and replace panel…
Now with the code i posted above… F1 works but only if the search and replace panel is in focus

Though i tried using the Keybinding resolver… i clicked on the file (that lead me to an empty file… or it was {} )


#4

Try the following:

'atom-workspace':
  'f1': 'find-and-replace:show-previous'
'.platform-win32 atom-text-editor, .platform-linux atom-text-editor':
  'f1': 'find-and-replace:show-previous'

#5

@leedohm

Thanks, but that’s not working ;(


#6

What shows up in the Keybinding Resolver when you press F1 in the editor?


#7

@leedohm sorry i should tell you earlier… that it dose work but as usually only in the search and replace panel… not in the text editor.

though in the keybind resolver shows what you’d expect:

find-and-replace:show-previous .platform-linux atom-text-editor


#8

Can you post a screenshot of the Keybinding Resolver? If that is the only line, then things should be working.


#9

Sure


Have you tried it? Works for you?


#10

I haven’t tried it because I’m running on macOS and I wouldn’t have the same keybinding conflicts that you would.

According to that screenshot, that command is being executed.


#11

@leedohm Yeah, though it’s not working as expected…
However if there are no keybinding conflicts for you on macOS, would it work for you? (cause i don’t have)… maybe we stumbled on a bug here?


#12

I found what the problem is. The command that works when the focus is outside of the find-and-replace panel is find-and-replace:find-previous not show-previous. Changing the command name should work for you.


#13

Thank you! It works :slight_smile: