diff --git a/README.org b/README.org index 2c28e46..20f3270 100644 --- a/README.org +++ b/README.org @@ -1,3 +1,4 @@ +it #+TITLE: luxicks Emacs Configuration This is my configuration for the emacs editor. @@ -8,24 +9,21 @@ Points of intrest: - When Exporting HTML from ~org-mode~ the style from the ~org-theme.css~ file is inlined automatically. * Set Up use-package -State that we will need package support and define a macro for adding package repos to the archives +Throughout this configuration I will use =use-package= to configure packages from melpa and other sources. +[[https://github.com/jwiegley/use-package][Link to GitHub page]] #+BEGIN_SRC emacs-lisp - (require 'package) - (defmacro append-to-list (target suffix) - "Append SUFFIX to TARGET in place." - `(setq ,target (append ,target ,suffix))) + ;; Add melpa to the package repos + (add-to-list 'package-archives + '("melpa" . "http://melpa.org/packages/")) - ;; add to the package repos - (append-to-list package-archives - '(("melpa" . "http://melpa.org/packages/"))) (package-initialize) + + ;; Install use-package (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) - (require 'use-package) (setq use-package-always-ensure t) - (use-package gnu-elpa-keyring-update) #+END_SRC Packages that are manually installed should be saved under =.emacs.d/packages= @@ -77,6 +75,7 @@ Emacs sure loves to clutter directories with backup files. cursor-type 'bar indent-tabs-mode nil cursor-in-non-selected-windows nil) + (blink-cursor-mode 0) ;; Default column with (set-fill-column 95) @@ -187,6 +186,49 @@ This custom version of =variable-pitch-mode= allows to mix variable and fixed fo (variable-pitch-mode -1)))) #+end_src +** Focused Mode +This is a special minor mode that allows focus reading of longer texts. It is a combination of other useful modes to create a distraction free reading environment. + +This is a minor mode for keeping the cursor at the center of the screen while scrolling +#+begin_src emacs-lisp + (setq-default scroll-preserve-screen-position t) + (setq-default scroll-conservatively 1) + (setq-default scroll-margin 0) + + (define-minor-mode lux/center-scroll-mode + "Toggle centred cursor scrolling behaviour." + :init-value nil + :lighter " S=" + :global nil + (if lux/center-scroll-mode + (setq-local scroll-margin (* (frame-height) 2) + scroll-conservatively 0 + maximum-scroll-margin 0.5) + (dolist (local '(scroll-preserve-screen-position + scroll-conservatively + maximum-scroll-margin + scroll-margin)) + (kill-local-variable `,local)))) + + (bind-key "C-c l" 'lux/center-scroll-mode) +#+end_src + +#+begin_src emacs-lisp + (define-minor-mode lux/focus-mode + "Creates a distraction free reading environment in the current buffer" + :init-value nil + :global nil + (if lux/focus-mode + (progn + (olivetti-mode 1) + (lux/center-scroll-mode 1)) + (progn + (olivetti-mode -1) + (lux/center-scroll-mode -1)))) + + (bind-key "C-c o" 'lux/focus-mode) +#+end_src + * Fonts Set up the fonts to use #+begin_src emacs-lisp @@ -701,18 +743,13 @@ A simple Emacs minor mode for a nice writing environment. [[https://github.com/rnkn/olivetti][Gihub Link]] #+BEGIN_SRC emacs-lisp (use-package olivetti + :diminish :config - (setq-default - olivetti-hide-mode-line t - olivetti-body-width 90)) + (setq olivetti-minimum-body-width 72) + (setq olivetti-body-width 0.65) + (setq olivetti-recall-visual-line-mode-entry-state t)) #+END_SRC -Auto enable it in text modes - -#+BEGIN_SRC emacs-lisp - ;; Do not use for now - ;;(add-hook 'text-mode-hook 'olivetti-mode) -#+END_SRC ** Ag Ag.el allows you to search using ~ag~ from inside Emacs. You can filter by file type, edit results inline, or find files.