]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/util.go
allow optionally brace matching with the closing brace to the left of the cursor
[micro.git] / cmd / micro / util.go
index b8a8e92a30e54b2daf13d2dcb7c51c37b6f6251f..833562941436689ca668456c41ef51c55c89fe06 100644 (file)
@@ -337,3 +337,12 @@ func ReplaceHome(path string) string {
        }
        return strings.Replace(path, "~", home, 1)
 }
+
+// GetPath returns a filename without everything following a `:`
+// This is used for opening files like util.go:10:5 to specify a line and column
+func GetPath(path string) string {
+       if strings.Contains(path, ":") {
+               path = strings.Split(path, ":")[0]
+       }
+       return path
+}