I spend a lot of time copying the paths output by grep, and pasting them after a command that opens a visual editor.

Is there a way of programming a terminal emulator to open selected text in a specific editor? Perhaps a middle-click on selected text, or an addition to the context menu?

Is this perhaps a feature of some terminal I don't know?