Coding Style


Kakoune is written in C++14, here are the main coding style points:

  • Avoid external dependencies besides posix/stdc++/ncurses

  • 4 spaces for indentation, no tabs

  • public interface before private methods/data when defining a class

  • use override keyword for overridden virtual methods

  • opening brackets on their own lines by default, except when
    declaring an object where the opening bracket follows the equal

  • use alternative logical operator names (and, or, not instead of &&,
    ||, !)

int func()
    if (condition)

int array[] = {
  • End lines with an operator when continuing on the next line
if (condition1 or
  • Try to keep under 80 columns, even though this is not a strict

  • CamelCase for types, snake_case for variables/function names

  • prefix fields with m_, static ones with ms_ except for dumb
    structs (struct with every field public) where these prefixes can be

  • use const and constexpr liberally