feat(statusview): make a separate item for doc position percent (#1579)
* feat(statusview): make a separate item for doc position percent * chore: remove unused variable * fix(statusview): remove command for percent doc item * fix(statusview): change doc percent tooltip * fix(statusview): change percent tooltip message
This commit is contained in:
parent
215b8daef7
commit
5f68e8b7a9
|
@ -232,15 +232,27 @@ function StatusView:register_docview_items()
|
||||||
return {
|
return {
|
||||||
style.text, line, ":",
|
style.text, line, ":",
|
||||||
col > config.line_limit and style.accent or style.text, col,
|
col > config.line_limit and style.accent or style.text, col,
|
||||||
style.text,
|
style.text
|
||||||
self.separator,
|
|
||||||
string.format("%.f%%", line / #dv.doc.lines * 100)
|
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
command = "doc:go-to-line",
|
command = "doc:go-to-line",
|
||||||
tooltip = "line : column"
|
tooltip = "line : column"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self:add_item({
|
||||||
|
predicate = predicate_docview,
|
||||||
|
name = "doc:position-percent",
|
||||||
|
alignment = StatusView.Item.LEFT,
|
||||||
|
get_item = function()
|
||||||
|
local dv = core.active_view
|
||||||
|
local line = dv.doc:get_selection()
|
||||||
|
return {
|
||||||
|
string.format("%.f%%", line / #dv.doc.lines * 100)
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
tooltip = "caret position"
|
||||||
|
})
|
||||||
|
|
||||||
self:add_item({
|
self:add_item({
|
||||||
predicate = predicate_docview,
|
predicate = predicate_docview,
|
||||||
name = "doc:selections",
|
name = "doc:selections",
|
||||||
|
|
Loading…
Reference in New Issue