replace editor-specific indentation settings with editorconfig
Alan Pearce alan@alanpearce.eu
Thu, 02 May 2024 19:43:34 +0200
3 files changed, 29 insertions(+), 23 deletions(-)
M user/emacs/init.el → user/emacs/init.el
@@ -717,9 +717,7 @@ "C-c C-l" #'counsel-shell-history)) ;;; 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 @@ (global-treesit-auto-mode) (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 @@ (add-to-list 'eglot-server-programs '(nim-mode "nimlsp")))) ;;;; js -(setq js-indent-level 2 - js-enabled-frameworks '(javascript)) +(setq js-enabled-frameworks '(javascript)) ;;;; typescript @@ -783,8 +778,7 @@ (add-to-list 'auto-mode-alist '("\\.env\\'" . conf-unix-mode)) (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 @@ :mode (("\\.fish\\'" . fish-mode)) :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 @@ ;;;; 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?\\'"))))
M user/nvim/init.lua → 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 = ","
M user/settings/development/base.nix → user/settings/development/base.nix
@@ -46,6 +46,31 @@ FLY_NO_UPDATE_CHECK = "1"; 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";