However, people cannot seem to agree on whether to use tabs or spaces (and if the latter, how many spaces) to use for indentation. This is unfortunate, because the obviously correct way of doing it is with tabs. The only reason why many people believe spaces are superior is because
- they want their indentation to look shorter than 8 fixed-width characters, the tab-width was not configurable back in the computing stone age, and people in general are incredibly conservative; and
- they fundamentally misunderstand the difference between indentation and alignment, and generally overuse alignment.
So what is a user of the Kate editor (like myself, who uses it as part of KDevelop) to do when faced with working in different projects with different styles? I recently discovered a feature of Kate that is not documented widely enough: It will search the full hierarchy of parent directories for a file named
.kateconfig
. So just put a .kateconfig
file in the root directory of each project you're working on, containing a single line like the following:
kate: space-indent off; indent-width 4; replace-tabs off; tab-width 4; indent-mode cstyle;And voilà, you're good to go!
Keine Kommentare:
Kommentar veröffentlichen