I currently display the percent cursor position in my modeline:
## position of the cursor in the buffer, in percent
declare-option str modeline_pos_percent
declare-option str modeline_modified
set global modelinefmt '%val{cursor_line}:%val{cursor_char_column} {{mode_info}} %opt{filetype} [%val{session}] %sh{test $kak_modified = true && echo M} %opt{modeline_pos_percent}%% {{context_info}}'
hook global WinCreate .* %{
hook window NormalIdle .* %{ evaluate-commands %sh{
echo "set window modeline_pos_percent '$(($kak_cursor_line * 100 / $kak_buf_line_count))'"
} }
}
However, this does not update when I scroll the buffer, as the cursor does not move automatically to be visible in newer version of Kakoune. The percent indicator only updates when I e.g. click with the mouse in the window.
This is a degradation in usability as I can’t tell where I am in the file or how big the file is when scrolling up and down with the mouse wheel.
Is there any way to get the displayed position rather than the cursor position? I looked at the value expansions in “:doc expansions
” but none looked appropriate.