Start editorconfig module
Change-Id: I06729a68b7618050563563a8123821e363f958c9
Reviewed-on: https://git.clicks.codes/c/Chimera/NixFiles/+/579
Tested-by: Samuel Shuert <coded@clicks.codes>
Reviewed-by: Skyler Grey <minion@clicks.codes>
diff --git a/homes/x86_64-linux/coded@shorthair/default.nix b/homes/x86_64-linux/coded@shorthair/default.nix
index 36a2858..35ede1e 100644
--- a/homes/x86_64-linux/coded@shorthair/default.nix
+++ b/homes/x86_64-linux/coded@shorthair/default.nix
@@ -101,6 +101,7 @@
games.minecraft.enable = true;
editor.neovim.enable = true;
+ editor.editorconfig.enable = true;
theme.font.nerdFontGlyphs.enable = true;
theme.wallpaper = ./wallpaper.png;
diff --git a/homes/x86_64-linux/minion@greylag/default.nix b/homes/x86_64-linux/minion@greylag/default.nix
index 6e31828..e01db43 100644
--- a/homes/x86_64-linux/minion@greylag/default.nix
+++ b/homes/x86_64-linux/minion@greylag/default.nix
@@ -141,6 +141,7 @@
};
editor.emacs.enable = true;
+ editor.editorconfig.enable = true;
input.keyboard = {
layout = "us";
diff --git a/homes/x86_64-linux/pinea@saurosuchus/default.nix b/homes/x86_64-linux/pinea@saurosuchus/default.nix
index c820a64..3e6512c 100644
--- a/homes/x86_64-linux/pinea@saurosuchus/default.nix
+++ b/homes/x86_64-linux/pinea@saurosuchus/default.nix
@@ -144,6 +144,8 @@
defaultEditor = true;
};
+ editor.editorconfig.enable = true;
+
input.keyboard = {
layout = "gb";
};
diff --git a/modules/home/editor/editorconfig/default.nix b/modules/home/editor/editorconfig/default.nix
new file mode 100644
index 0000000..99cdf2b
--- /dev/null
+++ b/modules/home/editor/editorconfig/default.nix
@@ -0,0 +1,100 @@
+{ config, lib, ... }:
+{
+ options.chimera.editor.editorconfig = {
+ enable = lib.mkEnableOption "Enable default .editorconfig file";
+ };
+
+ config = lib.mkIf config.chimera.editor.editorconfig.enable {
+ editorconfig = {
+ enable = true;
+ settings = {
+ "*" = {
+ charset = "utf-8";
+ end_of_line = "lf";
+ trim_trailing_whitespace = true;
+ insert_final_newline = true;
+ indent_style = "tab";
+ };
+ # JS Files
+ "*.{ts,js,cjs,mjs}" = {
+ indent_size = 4;
+ };
+ "*.{jsx,tsx}" = {
+ indent_size = 2;
+ };
+ # Python
+ "*.py" = {
+ indent_size = 4;
+ };
+ # Nix
+ "*.nix" = {
+ indent_style = "space";
+ indent_size = 2;
+ };
+ # Web Files
+ "*.{htm,html,less,svg,vue}" = {
+ indent_size = 2;
+ };
+ # Rust
+ "*.rs" = {
+ indent_size = 4;
+ };
+ # C Files
+ "*.{c,cpp,cs,h,hpp,C,H,cxx,hxx}" = {
+ indent_size = 4;
+ };
+ "*.{sln,csproj,vbproj,vcxproj.filters,proj,projitems,shproj}" = {
+ indent_size = 2;
+ };
+ # CSS Files
+ "*.{css,sass,scss,less}" = {
+ indent_size = 2;
+ };
+ # Script Files
+ "*.{sh,zsh,bash,bat,cmd,ps1,psm1}" = {
+ indent_size = 4;
+ };
+ # Git Files
+ "*.{diff,patch}" = {
+ end_of_line = "unset";
+ insert_final_newline = "unset";
+ trim_trailing_whitespace = "unset";
+ };
+ ".{gitignore,gitreview,gitmodules}" = {
+ indent_style = "unset";
+ indent_size = 0;
+ };
+ # Key Files
+ "*.{asc,key,ovpn}" = {
+ end_of_line = "unset";
+ insert_final_newline = "unset";
+ trim_trailing_whitespace = "unset";
+ };
+ # Lockfile
+ "*.lock" = {
+ indent_style = "unset";
+ insert_final_newline = "unset";
+ };
+ # Markdown
+ "*.md" = {
+ indent_size = 2;
+ trim_trailing_whitespace = false;
+ };
+ # JSON a/ YAML Files
+ "*.{json,json5,webmanifest,yaml,yml}" = {
+ indent_style = "space";
+ indent_size = 2;
+ };
+ # TOML
+ "*.toml" = {
+ indent_style = "unset";
+ indent_size = 0;
+ };
+ # *RC Files
+ ".*rc" = {
+ indent_size = 2;
+ };
+ };
+ };
+ };
+}