diff --git a/internal/display/statusline.go b/internal/display/statusline.go index 947a3ee7..be808eee 100644 --- a/internal/display/statusline.go +++ b/internal/display/statusline.go @@ -47,6 +47,12 @@ var statusInfo = map[string]func(*buffer.Buffer) string{ } return "" }, + "lines": func(b *buffer.Buffer) string { + return strconv.Itoa(b.LinesNum()) + }, + "percentage": func(b *buffer.Buffer) string { + return strconv.Itoa((b.GetActiveCursor().Y + 1) * 100 / b.LinesNum()) + }, } func SetStatusInfoFnLua(fn string) { diff --git a/runtime/help/options.md b/runtime/help/options.md index 4d12687a..89d85396 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -333,7 +333,7 @@ Here are the available options: * `statusformatl`: format string definition for the left-justified part of the statusline. Special directives should be placed inside `$()`. Special - directives include: `filename`, `modified`, `line`, `col`, `opt`, `bind`. + directives include: `filename`, `modified`, `line`, `col`, `lines`, `percentage`, `opt`, `bind`. The `opt` and `bind` directives take either an option or an action afterward and fill in the value of the option or the key bound to the action.