aboutsummaryrefslogtreecommitdiff
path: root/emacs/settings/init-edit.el
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2016-11-17 12:50:00 +0100
committerMiquel Sabaté Solà <msabate@suse.com>2016-11-17 12:50:00 +0100
commit44a504dc3c8e6171dc066b2c19b7769525388896 (patch)
treedba04234c2268a094c6a1ce8d33e0abc24218788 /emacs/settings/init-edit.el
parent3e5d6e81072b11c6d7a719cb3f3e484dc61d4c7e (diff)
downloaddotfiles-44a504dc3c8e6171dc066b2c19b7769525388896.tar.gz
dotfiles-44a504dc3c8e6171dc066b2c19b7769525388896.zip
emacs: split init.el into different files
The init.el was about to surpass the 1000 LoC threshold, and it was no longer easy to structure the code. Thus, I've moved the different pieces into new files. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'emacs/settings/init-edit.el')
-rw-r--r--emacs/settings/init-edit.el89
1 files changed, 89 insertions, 0 deletions
diff --git a/emacs/settings/init-edit.el b/emacs/settings/init-edit.el
new file mode 100644
index 0000000..5d8dd7f
--- /dev/null
+++ b/emacs/settings/init-edit.el
@@ -0,0 +1,89 @@
+;;; init-edit.el --- Packages for improving the editing experience
+
+;; Copyright (C) 2016 Miquel Sabaté Solà <mikisabate@gmail.com>
+;;
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;;; Commentary:
+;;
+;; Set of packages for improving the editing experience.
+
+;;; Code:
+
+(require 'use-package)
+
+;; Flycheck
+
+(use-package let-alist
+ :ensure t)
+
+(use-package flycheck
+ :ensure t
+ :config
+ (add-hook 'after-init-hook 'global-flycheck-mode)
+
+ ;; Only show the errors buffer if it isn't there and if I'm saving the
+ ;; buffer.
+ (setq flycheck-emacs-lisp-load-path 'inherit)
+ (setq flycheck-check-syntax-automatically '(mode-enabled save))
+ (setq flycheck-display-errors-function
+ #'flycheck-display-error-messages-unless-error-list))
+
+;; Let's increase fonts with C-+ and C--
+
+(use-package default-text-scale
+ :ensure t
+ :config
+ (global-set-key (kbd "C-+") 'default-text-scale-increase)
+ (global-set-key (kbd "C--") 'default-text-scale-decrease))
+
+;; We will add this manually to the desired modes.
+(use-package rainbow-delimiters
+ :ensure t)
+
+;; Disable all mouse interactions
+(use-package disable-mouse
+ :ensure t
+ :config
+ (global-disable-mouse-mode))
+
+;; Shows a popup with the available commands for the current chords. Helpful
+;; when you don't remember a specific combination.
+(use-package which-key
+ :ensure t)
+
+; Even though this is not entirely needed because Evil already covers most of
+; it, sometimes it's convenient to use it.
+(use-package expand-region
+ :ensure t
+ :config
+
+ ; Set C-e as the expand command (mnemonic: expand). This command will
+ ; supercede the evil binding for "move one line", which I never use anyways.
+ (global-set-key (kbd "\C-e") 'er/expand-region)
+ (eval-after-load 'evil
+ '(progn
+ (define-key evil-normal-state-map (kbd "\C-e") 'er/expand-region)
+ (define-key evil-visual-state-map (kbd "\C-e") 'er/expand-region))))
+
+; Directly taken from: https://github.com/magnars/expand-region.el. This way we
+; can also expand the region into paragraphs and pages in text mode.
+(defun er/add-text-mode-expansions ()
+ (make-variable-buffer-local 'er/try-expand-list)
+ (setq er/try-expand-list (append
+ er/try-expand-list
+ '(mark-paragraph
+ mark-page))))
+
+(add-hook 'text-mode-hook 'er/add-text-mode-expansions)
+
+(provide 'init-edit)
+;;; init-edit.el ends here