Window_height value expansion


#1

I’ve read somewhere that the lookup order is window, buffer,global.
And I know that I can specify on the terminal of choice, a height and width accordingly, but is there a way that I could define a command, expanding the value of window_height with %val{window_height} on the config file, so every time kak is invoked, it does so with the specified dimensions.
I want the terminal to fall back to default values., e.g uxterm, rxvt-unicode, terminator, etc.
Similarly, vim already does this - not recommended - by setting a number of lines on the initialization file with set lines


#2

In general, the terminal emulator tells the application running inside how big it is, rather than the application telling the terminal emulator how big to be. However, some terminals support a “please resize” escape sequence, which is probably what Vim does when you try to assign to lines or columns.

You probably want something like:

define-command \
    -docstring "resize-term <width> <height>: Ask the current terminal to resize itself to <width> by <height> character cells" \
    -params 2 \
resize-term %{
        nop %sh{ printf '\e[8;%d;%dt' "$2" "$1" > /dev/tty }
}

EDIT: Actually, probably an even cleaner way to do it would be to launch Kakoune via a wrapper script like:

#!/bin/sh
resize -s 25 80 > /dev/null
kak "$@"

Then you don’t have to worry about Kakoune messing with the controlling terminal or interfering with Kakoune’s output.


#3

Thanks. The code above should be implemented upstream