//go:build !windows && !plan9package editorimport ()// ErrStart indicates that the command to start the editor failed.varErrStart = errors.New("failed to start editor")// EditBuffer starts the system editor and opens the given buffer in it.// If the filename is specified, the file will be created in the system// temp directory under this name.// If the filetype is not empty and if the system editor supports it, the// file will be opened with the specified filetype passed to the editor.func ( *Buffers) ( []rune, , string, bool) ([]rune, error) { , := writeToFile([]byte(string()), )if != nil {return , } := getSystemEditor() := []string{}if != "" { = append(, fmt.Sprintf("-c 'set filetype=%s", )) } = append(, ) := exec.Command(, ...) .Stdin = os.Stdin .Stdout = os.Stdout .Stderr = os.Stderrif = .Start(); != nil {return , fmt.Errorf("%w: %s", ErrStart, .Error()) }if = .Wait(); != nil {return , fmt.Errorf("%w: %s", ErrStart, .Error()) } , := readTempFile()return []rune(string()), }
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.