diff options
-rw-r--r-- | commands/cd.go | 1 | ||||
-rw-r--r-- | doc/aerc-config.5.scd | 2 | ||||
-rw-r--r-- | lib/statusline/renderer.go | 11 |
3 files changed, 14 insertions, 0 deletions
diff --git a/commands/cd.go b/commands/cd.go index d856a060..dc05adbb 100644 --- a/commands/cd.go +++ b/commands/cd.go @@ -60,6 +60,7 @@ func (ChangeDirectory) Execute(aerc *widgets.Aerc, args []string) error { } if err := os.Chdir(target); err == nil { previousDir = cwd + aerc.UpdateStatus() } return err } diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index 943c6c80..55f82ccb 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -376,6 +376,8 @@ These options are configured in the *[statusline]* section of aerc.conf. : active directory name | %c : connection state +| %p +: current path | %m : mute statusline and show only push notifications | %S diff --git a/lib/statusline/renderer.go b/lib/statusline/renderer.go index 26c95c24..f128e6a2 100644 --- a/lib/statusline/renderer.go +++ b/lib/statusline/renderer.go @@ -3,6 +3,7 @@ package statusline import ( "errors" "fmt" + "os" "strings" "unicode" @@ -171,6 +172,16 @@ func parseStatuslineFormat(format string, texter Texter, r renderParams) (string } retval = append(retval, 's') args = append(args, strings.Join(tray, r.sep)) + case 'p': + path, err := os.Getwd() + if err == nil { + home, _ := os.UserHomeDir() + if strings.HasPrefix(path, home) { + path = strings.Replace(path, home, "~", 1) + } + retval = append(retval, 's') + args = append(args, path) + } default: // Just ignore it and print as is // so %k in index format becomes %%k to Printf |