launch_editor
Open file with line numbers in editor from Go.
Usage
package main
import (
"log"
. "github.com/Binbiubiubiu/launch_editor"
)
func main() {
err := LaunchEditorWithName("guess.go:59:20", "code")
if err != nil {
log.Fatalln(err)
}
}
Supported editors
Value | Editor | Linux | Windows | OSX |
---|---|---|---|---|
appcode |
AppCode | ✓ | ||
atom |
Atom | ✓ | ✓ | ✓ |
atom-beta |
Atom Beta | ✓ | ||
brackets |
Brackets | ✓ | ✓ | ✓ |
clion |
Clion | ✓ | ✓ | |
code |
Visual Studio Code | ✓ | ✓ | ✓ |
code-insiders |
Visual Studio Code Insiders | ✓ | ✓ | ✓ |
codium |
VSCodium | ✓ | ✓ | ✓ |
emacs |
Emacs | ✓ | ||
idea |
IDEA | ✓ | ✓ | ✓ |
notepad++ |
Notepad++ | ✓ | ||
pycharm |
PyCharm | ✓ | ✓ | ✓ |
phpstorm |
PhpStorm | ✓ | ✓ | ✓ |
rubymine |
RubyMine | ✓ | ✓ | ✓ |
sublime |
Sublime Text | ✓ | ✓ | ✓ |
vim |
Vim | ✓ | ||
visualstudio |
Visual Studio | ✓ | ||
webstorm |
WebStorm | ✓ | ✓ | ✓ |
Custom editor support
You can use the LAUNCH_EDITOR
environment variable
to force a specific supported editor
LAUNCH_EDITOR=codium
to run a custom launch script
LAUNCH_EDITOR=my-editor-launcher.sh
# gets called with 3 args: filename, line, column
filename=$1
line=$2
column=$3
# call your editor with whatever args it expects
my-editor -l $line -c $column -f $filename
Thanks
launch-editor Open file in editor from Node.js.