summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
authorAlan Pearce2024-05-02 19:43:34 +0200
committerAlan Pearce2024-05-02 19:43:34 +0200
commit2c5665edeb0c5546e5e60d6ccb85731fe06bc83b (patch)
tree771ee5a965a4d93fe14f87200e516280d83e6bfc /user
parentd3990a89701ad0cb33a6912ebf8c2698076e0212 (diff)
downloadnixfiles-2c5665edeb0c5546e5e60d6ccb85731fe06bc83b.tar.lz
nixfiles-2c5665edeb0c5546e5e60d6ccb85731fe06bc83b.tar.zst
nixfiles-2c5665edeb0c5546e5e60d6ccb85731fe06bc83b.zip
replace editor-specific indentation settings with editorconfig
Diffstat (limited to 'user')
-rw-r--r--user/emacs/init.el24
-rw-r--r--user/nvim/init.lua3
-rw-r--r--user/settings/development/base.nix25
3 files changed, 29 insertions, 23 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 335ae410..3cd6f853 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -717,9 +717,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 
 ;;; Editing
 
-(setq-default indent-tabs-mode nil
-              tab-width 2
-              tab-always-indent 'complete)
+(setq-default tab-always-indent 'complete)
 
 (electric-pair-mode +1)
 
@@ -747,8 +745,6 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
             (treesit-auto-add-to-auto-mode-alist)))
 
 ;;;; golang
-(setq go-mode-indent-offset tab-width
-      go-ts-mode-indent-offset tab-width)
 (with-eval-after-load 'project
   (add-to-list 'project-vc-extra-root-markers "go.mod"))
 
@@ -760,8 +756,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
                          '(nim-mode "nimlsp"))))
 
 ;;;; js
-(setq js-indent-level 2
-      js-enabled-frameworks '(javascript))
+(setq js-enabled-frameworks '(javascript))
 
 ;;;; typescript
 
@@ -783,8 +778,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 (add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode))
 (add-to-list 'auto-mode-alist '("zshenv\\'" . shell-script-mode))
 (add-to-list 'auto-mode-alist '("zshrc\\'"  . shell-script-mode))
-(setq sh-shell-file "/usr/bin/env zsh"
-      sh-basic-offset 2)
+(setq sh-shell-file "/usr/bin/env zsh")
 
 (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
 
@@ -796,11 +790,6 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :config (progn
             (setq fish-enable-auto-indent t)))
 
-;;;; make
-(general-add-hook 'makefile-mode-hook
-                  (lambda ()
-                    (setq-local indent-tabs-mode t)))
-
 ;;;; nix
 (with-eval-after-load 'nix-mode
   (setq nix-mode-use-smie t
@@ -856,16 +845,11 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 ;;;; web modes (html)
 
 (use-package css-mode
-  :defer t
-  :config (progn
-            (setq css-indent-offset 2)))
+  :defer t)
 
 (use-package web-mode
   :mode (("\\.html?.erb\\'" . web-mode))
   :config (setq web-mode-enable-auto-pairing nil
-                web-mode-code-indent-offset 2
-                web-mode-markup-indent-offset 2
-                web-mode-css-indent-offset 2
                 web-mode-style-padding 2
                 web-mode-script-padding 2
                 web-mode-engines-alist '(("go" . "\\.html?\\'"))))
diff --git a/user/nvim/init.lua b/user/nvim/init.lua
index faf6ca5b..f7bb020a 100644
--- a/user/nvim/init.lua
+++ b/user/nvim/init.lua
@@ -1,9 +1,6 @@
 vim.opt.autoindent = true
 
 vim.opt.background = "light"
-vim.opt.shiftwidth = 2
-vim.opt.tabstop = 2
-vim.opt.expandtab = false
 vim.opt.number = true
 
 vim.g.mapleader = ","
diff --git a/user/settings/development/base.nix b/user/settings/development/base.nix
index cd5755f6..96c8a42f 100644
--- a/user/settings/development/base.nix
+++ b/user/settings/development/base.nix
@@ -46,6 +46,31 @@
     LIMA_INSTANCE = "nixos";
   };
 
+  editorconfig = {
+    enable = true;
+    settings = {
+      "*" = {
+        charset = "utf-8";
+        end_of_line = "lf";
+        trim_trailing_whitespace = true;
+        insert_final_newline = true;
+        indent_style = "space";
+        indent_size = 2;
+      };
+      justfile = {
+        indent_style = "tab";
+        tab_width = 4;
+      };
+      Makefile = {
+        indent_style = "tab";
+        tab_width = 4;
+      };
+      "*.{yaml,yml}" = {
+        indent_size = 4;
+      }
+    };
+  };
+
   home.shellAliases = {
     er = "direnv reload";
     ea = "direnv allow";