https://github.com/42paris/42header adapted to be used in Kate
  • C++ 91.8%
  • Shell 4.3%
  • CMake 3.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
kontebria 036a8ab0f8
All checks were successful
CI / build-and-test (opensuse/leap:16.0) (push) Successful in 2m45s
CI / build-and-test (fedora:latest) (push) Successful in 3m7s
CI / build-and-test (debian:stable) (push) Successful in 4m36s
CI / build-and-test (ubuntu:26.04) (push) Successful in 4m4s
CI / build-and-test (opensuse/tumbleweed:latest) (push) Successful in 16m58s
CI: fix openSUSE Tumbleweed after splitting the git install
Installing git on its own first pulls in BusyBox's awk on Tumbleweed,
which conflicts with the real awk (gawk) that the KDE development
packages need in the next step. Install gawk together with git.

scripts/container-test.sh now installs git in a separate first step,
exactly like the CI job, so local runs catch differences like this.
2026-11-18 12:26:37 +00:00
.forgejo/workflows CI: fix openSUSE Tumbleweed after splitting the git install 2026-11-18 12:26:37 +00:00
docs Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
scripts CI: fix openSUSE Tumbleweed after splitting the git install 2026-11-18 12:26:37 +00:00
src Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
tests Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
.gitattributes Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
.gitignore Clean up repo: untrack build/, restore metadata, verified multi-distro CI 2026-10-21 18:41:31 +01:00
CHANGELOG.md Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
CMakeLists.txt Fix delimiter equality, tracking and conflict bugs; test the real plugin code 2026-11-18 07:44:21 +00:00
CREDITS.md Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00
LICENSE Switch project license to MIT; bump to 0.43.1 2026-10-22 04:19:32 +01:00
README.md Clean up code, CI and docs; license everything under MIT 2026-11-18 11:59:11 +00:00

kate-42header

The 42 school header, for the Kate text editor.

At 42, every source file you hand in starts with the same signed ASCII-art block: your login, your email, when you created the file and when you last changed it. Vim and VS Code users get it from a plugin. This project gives Kate (KDE's editor) users the same thing, so you can code in Kate without typing or patching headers by hand.

/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.c                                             :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: kontebria <kontebria@student.42.fr>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2026/10/22 14:30:00 by kontebria         #+#    #+#             */
/*   Updated: 2026/10/22 14:30:00 by kontebria        ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

The header it writes is identical, byte for byte, to the one the official 42 vim plugin (42paris/42header) produces, so it passes the same checks and looks the same in your classmates' editors.

What it does for you

  • Adds the header in one keystroke. Press Ctrl+Alt+H (or Tools → Insert 42 Header) and the header appears at the top of the file.
  • Keeps it up to date. Every time you save, the Updated: line gets the current date and time, so the file on disk always carries the right header. Only the file you save is touched, and only if it already has a header. Nothing is ever added behind your back.
  • Never rewrites your authorship. The By: and Created: lines stay as they were. Pressing Ctrl+Alt+H on a file that already has a header just refreshes the file name and the Updated: line.
  • Fixes the classic git merge conflict. Two people saving the same file means two different Updated: lines and a conflict in the header. When you open such a file, the conflict is cleaned up automatically.
  • Stays out of the way during a rebase. While git rebase is running, headers are left alone, so you don't create extra conflicts.
  • Works with any language. C and C++ get /* */, Python and shell get #, HTML gets <!-- -->, Lua gets --, and so on. Files it doesn't recognise (Makefile, Dockerfile, ...) get # comments.

Install

You need Kate 24.02 or newer (the KDE 6 generation, which current Linux distributions ship). On openSUSE, Fedora, Debian or Ubuntu:

git clone https://git.asidia.com/kontebria/kate-42header.git
cd kate-42header
sudo scripts/install-deps.sh    # the compiler, CMake and KDE development packages
scripts/build-and-test.sh       # builds into build/ and runs the tests
sudo cmake --install build

On other distributions, install the packages listed in docs/BUILDING.md instead of running install-deps.sh.

Then switch it on in Kate: Settings → Configure Kate → Plugins, tick 42 Header and click Apply.

Set your name and email

By default the header uses your system login ($USER) and the $MAIL environment variable. On 42 machines these are usually already right.

To use something else, open Settings → Configure Kate → 42 Header and fill in your login and your email (<login>@student.42.fr). Leave a field empty to go back to the default. You can also turn off the automatic update on save there.

Is it reliable?

The project has an automated test suite. It checks the output against headers produced by the original vim plugin, and it drives the real plugin code on real Kate documents: inserting, saving, merge conflicts, rebases, undo, the settings page, and loading the plugin the way Kate does. Every change is built and tested on openSUSE (Tumbleweed and Leap 16), Fedora, Debian and Ubuntu.

More details

  • docs/BUILDING.md: requirements, packages for other distributions, how the code is organised, and how CI works.
  • docs/FIDELITY.md: how the header matches the original plugin exactly, and the precise refresh, conflict and rebase rules.
  • CHANGELOG.md: what changed in each version.

License

MIT. See LICENSE. The notices of the projects this is based on, 42paris/42header and kube/vscode-42header, are kept in CREDITS.md.