Skip to content

Configuration

Configure dogshitnorm through your plugin manager:

require("dogshitnorm").setup({
active_dirs = { "~/coding/42" },
})

With lazy.nvim, put the same table in opts.

Use these when you want the Python generator to match a specific subject or local project style:

require("dogshitnorm").setup({
project_type = "auto",
python_scaffold = "full",
python_dirs = { "*python*", "*py*" },
c_dirs = {},
python_version = "3.10",
python_main = "main.py",
python_package = nil,
python_formatter = "ruff",
python_typechecker = "ty",
})

python_version controls .python-version, requires-python, Ruff target-version, and mypy python_version in generated config. Set it to the subject requirement when it changes:

python_version = "3.12"

python_package = nil means infer from the project folder. Set it when the folder name is not the import package:

python_package = "push_swap_checker"

python_main changes the generated Makefile MAIN value and the scaffolded entrypoint:

python_main = "app.py"

project_type controls what :Makegen does:

  • "auto": detect per project
  • "python": always generate Python Makefiles
  • "c": always keep the current C behavior

Auto-detection checks in this order:

  1. explicit project_type = "c" or "python"
  2. Python markers: pyproject.toml, .python-version, uv.lock, top-level *.py
  3. C markers: top-level *.c, top-level *.h, src/*.c, or includes/
  4. folder-name globs from python_dirs and c_dirs
  5. fallback to C

Folder globs are case-insensitive and support *. Keep the defaults generic, then add project names locally when needed:

python_dirs = { "*python*", "*py*", "*your-subject-name*" }

python_scaffold controls which files are created by :Makegen in Python mode and by :Pyprojectgen.

  • "makefile": Makefile only
  • "config": Makefile plus pyproject.toml, .python-version, .gitignore, .editorconfig
  • "full": config mode plus main.py, package directory, cli.py, and tests/

Scaffold files are created only when missing or empty. Existing non-empty files are left untouched.

python_makefile_stub overrides the entire generated Python Makefile body. The default exposes:

  • install
  • install-pip
  • run
  • debug
  • clean
  • lint
  • lint-strict
  • format
  • check-modern

The default lint target is intentionally the 42 peer-evaluation path: flake8 . and mypy with the required flags. Ruff and Ty are kept separate under format and check-modern.

OptionDefaultNotes
cmd{ "norminette" }Command used to invoke norminette.
args{ "--no-colors" }Extra norminette arguments.
norminette_format"json"Request JSON output first.
norminette_use_gitignoretruePass --use-gitignore unless already present.
activetrueMaster switch.
active_dirsnilRestrict behavior to these directories.
pattern{ "*.c", "*.h", "[Mm]akefile" }Lint-on-save patterns. Python files are intentionally not included.
lint_on_savetrueRun diagnostics on save for configured patterns.
lsp_code_actionstrueEnable dogshitnorm LSP code actions.
keybinding"<leader>cn"Run :Norminette.
fix_keybindingnilOptional direct :NormFix binding.
OptionDefaultNotes
auto_42_headertrueInsert 42 headers for C-like files and C Makefiles.
update_42_headertrueRefresh the Updated: line on save.
auto_header_guardtrueInsert/fix C header guards.
header_usernilOverrides vim.g.user42 and environment fallback.
header_emailnilOverrides vim.g.mail42 and environment fallback.
header_keybinding"<leader>42"Run :Stdheader.
guard_keybinding"<leader>ch"Insert/fix header guard.
prototype_header_keybinding"<leader>cp"Add current C prototype to the resolved header.
header_style_enabledtrueEnable visual header styling.
header_style_keybinding"<leader>4h"Toggle visual header styling.
header_hide_enabledfalseHide header display in the current window.
header_hide_keybindingnilOptional hidden-header toggle.
header_line_number_offsetfalseShow line numbers relative to the first non-header line.
header_colorstheme defaultsHighlight colors for the visual header.

Python files and Python-project Makefiles are excluded from header insertion and header refresh.

OptionDefaultNotes
auto_makefiletruePopulate empty Makefile buffers.
makefile_keybinding"<leader>cm"Run :Makegen.
auto_sync_makefiletrueEnable automatic C source syncing.
makesync_keybinding"<leader>cu"Run :Makesync.
src_dir"src"Default C source directory.
notify_on_synctrueNotify after background sync changes.
makefile_exclude_dirs{ ".git", ".jj", "tests", "test", "build", "libft", "libprintf" }Ignored by C source sync. Any segment containing tester is also ignored.
makefile_optional_libslibft/printf defaultsOptional C libraries to detect and link.
makefile_stubC templateOverride the C Makefile template.
project_type"auto""auto", "c", or "python".
python_scaffold"full""makefile", "config", or "full".
python_dirs{ "*python*", "*py*" }Python folder globs for auto-detection.
c_dirs{}C folder globs for auto-detection.
python_version"3.10"Generated Python version target.
python_main"main.py"Generated Python entrypoint.
python_packagenilPackage name, inferred from folder when unset.
python_formatter"ruff"Documented formatter preference.
python_typechecker"ty"Documented modern typechecker preference.
python_makefile_stubPython templateOverride the Python Makefile template.
OptionDefaultNotes
auto_sort_includesfalseSort contiguous include blocks before saving C/header files.
auto_sort_definesfalseSort simple define blocks before saving C/header files.
auto_sort_prototypesfalseSort prototype blocks before saving headers.
line_count_enabledfalseEnable C function line-count overlays.
line_count_keybinding"<leader>cl"Toggle line counts.
line_count_limit25Maximum C function body line count.
line_count_formatternilOptional (count, limit) formatter.
line_saver_diagnosticstrueEmit hint diagnostics for line-saving code actions.
line_saver_alwaystrueEmit line-saver hints even before a function is too long.
line_saver_max_width80Maximum generated width for line-saver rewrites.
OptionDefaultNotes
debug_logfalseWrite troubleshooting logs.
debug_log_pathnilDefaults to stdpath("cache") .. "/dogshitnorm.log".