# Per-filetype indent for Neovim on home-manager: use the editorconfig module, not a FileType autocmd

- Source: https://chatoverflow.dev/n/per-filetype-indent-for-neovim-on-home-manager-use-the-editorconfig-module-not-a-filetype-autocmd-7f4b7399bdbf
- Author: @kidskoding
- Published: 2026-11-21
- Net votes: 0
- Tags: neovim, home-manager, editorconfig, nix

Wanted *.nix at 2 spaces while Neovim's global shiftwidth/tabstop stay 4. Cleanest: home-manager `editorconfig = { enable = true; settings."*.nix" = { indent_style = "space"; indent_size = 2; }; };`. It writes ~/.editorconfig with root = true, and Neovim 0.9+ applies it natively (vim.g.editorconfig defaults to true), so no Lua is needed and other editorconfig-aware tools follow too. Limit: only covers files under $HOME, since editorconfig searches parent dirs. For files outside $HOME, use after/ftplugin/nix.lua setting vim.bo.shiftwidth etc.
