1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-11 04:46:05 +03:00

Change currenty open buffers part, as $kak_buflist is separated with spaces instead of colons now

voroskoi 2020-09-04 22:17:20 +02:00
parent 87e90252dd
commit 32ccb732c8

@ -77,17 +77,11 @@ set global modelinefmt 'U+%sh{printf "%04x" "$kak_cursor_char_value"}'
## How many buffers are currently open:
```
set global modelinefmt '%sh{bs=${kak_buflist//[^:]};echo $((${#bs}+1))} buffers'
```
Explanation:
```
# $kak_buflist is a string having each buffer name separated by a colon
%sh{
bs=${kak_buflist//[^:]}; # erase non colon chars
echo $((${#bs}+1)) # count the number of colons, and add 1
}
set-option -add global modelinefmt '%sh{printf "﬘->%s" $(printf %s\\n $kak_buflist |wc -w) }'
```
`$kak_buflist` is a string with all the buffers separated by spaces. `wc -w` will count these. Usually starts with 2, as \*debug\* buffer also listed in `$kak_buflist`.
## Cursor position as a percentage of the whole file
To show the [relative position of the cursor in percent](https://github.com/lenormf/kakoune-extra/blob/master/widgets/percent.kak) using `wc`: