coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.37k stars 431 forks source link

Search Window automatically pastes Selected Text #1558

Closed Kalopsia-dev closed 9 months ago

Kalopsia-dev commented 10 months ago

Is your feature request related to a problem? Please describe. I often find myself opening the search window, then closing it again just to copy my currently selected text, open the search window again and paste it. It'd be a big quality of life improvement if this was done automatically.

Describe the solution you'd like I'd like the currently selected text to automatically be pasted into the search text box when opening the search window (via cmd+F). Other code editors like VS Code or Notepad++ (on Windows) also do this and it really helps speed things up.

1024jp commented 9 months ago

Hmmm. That's not the manner in macOS. So, CotEditor won't adopt it. Sorry.

FYI, you can use the "Use Selection for Find" command (Command+E) to use the selection for search text even among applications (if another application implements it correctly).

Screenshot 2023-12-10 at 17 07 51
Kalopsia-dev commented 9 months ago

Thanks, I didn't know the cmd+E shortcut existed. This actually solved the issue for me, as I was able to use Karabiner-Elements to map cmd+F to a cmd+F -> cmd+E sequence while CotEditor is in the foreground.

Here's the corresponding json snippet, if anyone needs it:

{
    "description": "CotEditor: Search window automatically pastes selection",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "com.coteditor.CotEditor"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "f",
                "modifiers": {
                    "mandatory": [
                        "command"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "f",
                    "modifiers": [
                        "left_command"
                    ]
                },
                {
                    "key_code": "e",
                    "modifiers": [
                        "left_command"
                    ]
                }
            ],
            "type": "basic"
        }
    ]
}