Support nano syntax for open at line
Ref
@@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"runtime"
+ "strings"
"time"
"github.com/go-errors/errors"
@@ -95,6 +96,16 @@ func LoadInput() []*Buffer {
// Option 1
// We go through each file and load it
for i := 0; i < len(args); i++ {
+ if strings.HasPrefix(args[i], "+") {
+ if strings.Contains(args[i], ":") {
+ split := strings.Split(args[i], ":")
+ *flagStartPos = split[0][1:] + "," + split[1]
+ } else {
+ *flagStartPos = args[i][1:] + ",0"
+ }
+ continue
+ }
+
buf, err := NewBufferFromFile(args[i])
if err != nil {
TermMessage(err)
@@ -275,7 +286,9 @@ func main() {
fmt.Println("-config-dir dir")
fmt.Println(" \tSpecify a custom location for the configuration directory")
fmt.Println("-startpos LINE,COL")
+ fmt.Println("+LINE:COL")
fmt.Println(" \tSpecify a line and column to start the cursor at when opening a buffer")
+ fmt.Println(" \tThis can also be done by opening file:LINE:COL")
fmt.Println("-options")
fmt.Println(" \tShow all option help")
fmt.Println("-version")
