Editor for Chrome and Firefox – WebExtensions
Open an external editor to edit text inputs.
make chromeOpen the Extensions page by navigating to chrome://extensions, enable Developer mode then Load unpacked to select the extension directory: target/chrome.
make firefox- Open
about:config, changexpinstall.signatures.requiredtofalse. - Open
about:addons❯ Extensions, click Install add-on from file and select the package file:target/firefox/package.zip.
Open chrome://extensions/configureCommands to configure the keyboard shortcuts.
Open about:addons ❯ Extensions and click Manage extension shortcuts in the menu.
Press Control + i to edit the last used text input with your favorite editor.
Edit the last used text input with your favorite editor. Default: Control + i.
Sets the editor to be used.
Parameters:
fileanchor_lineanchor_columncursor_linecursor_column
Default: xterm -e "$EDITOR" "${file}".
Example – Open Kakoune in Alacritty:
alacritty --class 'popup' --command \
kak "${file}" -e "
select ${anchor_line}.${anchor_column},${cursor_line}.${cursor_column}
"// Environment variables
switch (true) {
case (typeof browser !== 'undefined'):
var PLATFORM = 'firefox'
var EDITOR_EXTENSION_ID = 'editor@alexherbo2.github.com'
break
case (typeof chrome !== 'undefined'):
var PLATFORM = 'chrome'
var EDITOR_EXTENSION_ID = 'oaagifcpibmdpajhjfcdjliekffjcnnk'
break
}
// Initialization
const editor = {}
editor.port = chrome.runtime.connect(EDITOR_EXTENSION_ID)
editor.send = (command, ...arguments) => {
editor.port.postMessage({ command, arguments })
}
// Usage
editor.send('edit')You can find some examples in Krabby.
See the source for a complete reference.