How do I enable line numbers in Kakoune?

On latest Kakoune versions, you can enable line numbers for every buffers by putting the number_lines highlighter inside the global scope, with the following command:

add-highlighter global number_lines

If you want more control, another solution is to use a hook to add the number_lines highlighter on specific windows, for example if you line numbering only on buffers whose names do not contains * (as these are usually internal buffers), you can add a hook that does just that:

hook global WinCreate ^[^*]+$ %{ add-highlighter window number_lines }


As of 2020-11,

Kakoune v2020.09.01

the following is working:

add-highlighter global/ number-lines

Make sure you're typing spaces exactly as in the snippet above.

Originally provided by Nate on Dec 7 '18 at 18:59 for Kakoune v2018.10.27.