Skip to content

ernestrc/sensible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sensible

Utilities to find and spawn a sensible editor.

EDITOR and VISUAL environment variables are used first to find the user's preferred editor. If these are not set, a list of commonly installed editors is used.

Usage

Find a sensible editor

package main

import (
	"fmt"

	"github.com/ernestrc/sensible/editor"
)

func main() {
	e, err := editor.FindEditor()

	if err != nil {
		panic(err)
	}

	fmt.Println(e.GetPath())
}

Edit a file

package main

import (
	"io/ioutil"

	"github.com/ernestrc/sensible/editor"
)

func main() {
	f1, _ := ioutil.TempFile("/tmp", "")
	if err := editor.Edit(f1); err != nil {
		panic(err)
	}
}

go run some of the examples to see more advanced use-cases.

Documentation

http://godoc.org/github.com/ernestrc/sensible/editor

About

Utilities to find and spawn a sensible editor

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages