diff options
Diffstat (limited to 'configs')
-rw-r--r-- | configs/rcs/emacs.d/init.el | 129 |
1 files changed, 72 insertions, 57 deletions
diff --git a/configs/rcs/emacs.d/init.el b/configs/rcs/emacs.d/init.el index 8ae9d7e..cce1320 100644 --- a/configs/rcs/emacs.d/init.el +++ b/configs/rcs/emacs.d/init.el @@ -1,4 +1,4 @@ -;; Initialise the package system first of all. +;; Initialize the package system first of all. (require 'package) (setq package-archives @@ -106,6 +106,27 @@ :bind (("M-j" . join-line) ("C-c m m" . emacs-toggle-size))) +;;; emacs hygiene + +(use-package midnight + :config + (midnight-mode t)) + +(use-package server + :no-require + :hook (after-init . server-start)) + +(use-package exec-path-from-shell + :if (memq window-system '(mac ns)) + :config + (exec-path-from-shell-initialize) + (if (fc/check-work-machine-p) + (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME")) + (unless (getenv var) + (exec-path-from-shell-copy-env var))))) + +;;; general editing + (use-package recentf :commands (recentf-mode recentf-add-file @@ -115,6 +136,14 @@ (setq recentf-max-saved-items 500 recentf-save-file (expand-file-name "var/recentf" user-emacs-directory))) +(use-package autorevert + :config + (setq global-auto-revert-non-file-buffers t) + (setq auto-revert-verbose nil) + (global-auto-revert-mode t)) + +;;; packages management + (use-package auto-package-update :custom (auto-package-update-delete-old-versions t) @@ -123,24 +152,14 @@ :hook (after-init . auto-package-update-maybe)) -(use-package midnight - :config - (midnight-mode t)) - -(use-package autorevert - :config - (setq global-auto-revert-non-file-buffers t) - (setq auto-revert-verbose nil) - (global-auto-revert-mode t)) - -(use-package server - :no-require - :hook (after-init . server-start)) +;;; visual (use-package hl-line :config (global-hl-line-mode t)) +;;; files navigation + (use-package ag :bind (:map ag-mode-map ("p" . compilation-previous-error) @@ -165,43 +184,52 @@ (let ((gls (executable-find "/opt/twitter/bin/gls"))) (when gls (setq insert-directory-program gls)))) -(use-package dired-toggle - :bind ("C-c ~" . dired-toggle) - :preface - (defun my-dired-toggle-mode-hook () - (interactive) - (visual-line-mode 1) - (setq-local visual-line-fringe-indicators '(nil right-curly-arrow)) - (setq-local word-wrap nil)) - :hook (dired-toggle-mode . my-dired-toggle-mode-hook)) - (use-package ibuffer :bind ("C-x C-b" . ibuffer)) -(use-package magit - :bind (("C-x g" . magit-status)) - :hook (magit-mode . hl-line-mode)) +;;; general text editing -(use-package ispell +(use-package flyspell + :hook ((text-mode . flyspell-mode) + (prog-mode . flyspell-prog-mode)) :config + (setq ispell-dictionary "en_US") (when (executable-find "aspell") (setq ispell-program-name "aspell" ispell-list-command "--list"))) -(use-package flyspell-correct) +(use-package flyspell-correct + :after (flyspell)) -(use-package flyspell - :hook ((text-mode-hook . flyspell-mode) - (prog-mode-hook . flyspell-prog-mode))) +(use-package whitespace + :custom + (whitespace-style '(face trailing)) + (show-trailing-whitespace t) + :hook (whitespace-mode)) -(use-package exec-path-from-shell - :if (memq window-system '(mac ns)) +(use-package electric-pair-mode + :ensure nil + :commands electric-pair-mode + :init (add-hook 'prog-mode-hook 'electric-pair-mode)) + +(use-package paren + :custom + (show-paren-delay 0) :config - (exec-path-from-shell-initialize) - (if (fc/check-work-machine-p) - (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME")) - (unless (getenv var) - (exec-path-from-shell-copy-env var))))) + (show-paren-mode 1)) + +;;; source control + +(use-package magit + :after (flyspell) + :hook ((magit-mode . hl-line-mode)) + :bind (("C-x g" . magit-status)) + :config + (setq git-commit-summary-max-length 50) + (setq git-commit-fill-column 72) + (setq git-commit-turn-on-auto-fill t)) + +;;; project management (use-package counsel :after (projectile ivy) @@ -236,6 +264,8 @@ projectile-globally-ignored-directories) projectile-globally-ignored-files (append projectile-globally-ignored-files))) +;;; prog mode + (use-package lisp-mode :ensure nil :bind @@ -270,6 +300,8 @@ (add-hook 'sh-mode-hook 'set-sh-mode-indent) (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)) +;;; configurations + (use-package docker :bind ("C-c d" . docker) :diminish) @@ -305,24 +337,7 @@ :after (flyspell) :hook ((protobuf-mode . flyspell-prog-mode))) -(use-package whitespace - :custom - (whitespace-style '(face trailing)) - (show-trailing-whitespace t) - :hook (whitespace-mode)) - -(use-package electric-pair-mode - :ensure nil - :commands electric-pair-mode - :init (add-hook 'prog-mode-hook 'electric-pair-mode)) - -(use-package paren - :custom - (show-paren-delay 0) - :config - (show-paren-mode 1)) - -;; layout +;;; layout ;; when using darwin, I don't want to use the native fullscreen mode (it opens a new workspace) (when (eq system-type 'darwin) (setq ns-use-native-fullscreen nil)) |