mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 14:47:16 +09:00
Added lines and percentage statusbar directives (#2055)
- "lines" for the number of lines in the buffer - "percentage" for the percentage of the file at the current line Fixes zyedidia#2049
This commit is contained in:
@@ -47,6 +47,12 @@ var statusInfo = map[string]func(*buffer.Buffer) string{
|
|||||||
}
|
}
|
||||||
return ""
|
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) {
|
func SetStatusInfoFnLua(fn string) {
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ Here are the available options:
|
|||||||
|
|
||||||
* `statusformatl`: format string definition for the left-justified part of the
|
* `statusformatl`: format string definition for the left-justified part of the
|
||||||
statusline. Special directives should be placed inside `$()`. Special
|
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
|
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.
|
and fill in the value of the option or the key bound to the action.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user