diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index a3041473..5e4b0c44 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -13,6 +13,8 @@ import ( "strings" "time" "unicode/utf8" + + "github.com/mitchellh/go-homedir" ) // Buffer stores the text for files that are loaded into the text editor @@ -279,7 +281,8 @@ func (b *Buffer) Serialize() error { func (b *Buffer) SaveAs(filename string) error { b.FindFileType() b.UpdateRules() - b.Path = filename + dir, _ := homedir.Dir() + b.Path = strings.Replace(filename, "~", dir, 1) str := b.String() if b.Settings["eofnewline"].(bool) { end := b.End()