From cb0167c4fc636e89328f078b8edf3bd35c214a02 Mon Sep 17 00:00:00 2001 From: Cheri Date: Sat, 10 Apr 2021 18:26:01 +0300 Subject: [PATCH] emacs indent b --- .doom.d/config.el | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.doom.d/config.el b/.doom.d/config.el index aee509f..27a1ec2 100644 --- a/.doom.d/config.el +++ b/.doom.d/config.el @@ -54,3 +54,33 @@ ;; ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. +;; + +; START TABS CONFIG +;; Create a variable for our preferred tab width +(setq custom-tab-width 2) + +;; Two callable functions for enabling/disabling tabs in Emacs +(defun disable-tabs () (setq indent-tabs-mode nil)) +(defun enable-tabs () + (local-set-key (kbd "TAB") 'tab-to-tab-stop) + (setq indent-tabs-mode t) + (setq tab-width custom-tab-width)) + +;; Hooks to Enable Tabs +(add-hook 'prog-mode-hook 'enable-tabs) +;; Hooks to Disable Tabs +(add-hook 'lisp-mode-hook 'disable-tabs) +(add-hook 'emacs-lisp-mode-hook 'disable-tabs) + +;; Language-Specific Tweaks +(setq-default python-indent-offset custom-tab-width) ;; Python +(setq-default js-indent-level custom-tab-width) ;; Javascript + +;; Making electric-indent behave sanely +(setq-default electric-indent-inhibit t) + +;; Make the backspace properly erase the tab instead of +;; removing 1 space at a time. +(setq backward-delete-char-untabify-method 'hungry) +; END TABS CONFIG