Misc changes and cleanup.
This commit is contained in:
180
README.org
180
README.org
@@ -140,21 +140,23 @@ And it should be accessible with a quick keystroke:
|
||||
(mapc load-it (directory-files dir nil "\\.el$"))))
|
||||
#+END_SRC
|
||||
* Theming
|
||||
Load font from file. See [[https://github.com/rougier/elegant-emacs]] for more.
|
||||
Apply a nice looking theme.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; Light Theme
|
||||
(use-package modus-operandi-theme)
|
||||
(load-theme 'modus-operandi t)
|
||||
|
||||
;; Dark Theme
|
||||
;(use-package modus-vivendi-theme)
|
||||
;(load-theme 'modus-vivendi t)
|
||||
;; Syntax highlighing
|
||||
(setq modus-operandi-theme-faint-syntax t)
|
||||
|
||||
(setq modus-operandi-theme-org-blocks "greyscale")
|
||||
|
||||
(setq default-frame-alist
|
||||
(append (list '(width . 90) '(height . 50)
|
||||
'(vertical-scroll-bars . nil)
|
||||
'(internal-border-width . 10)
|
||||
'(font . "Roboto Mono Light 10"))))
|
||||
'(font . "Roboto Mono Light 11"))))
|
||||
#+END_SRC
|
||||
|
||||
Use a nice looking modeline package
|
||||
@@ -167,84 +169,53 @@ Use a nice looking modeline package
|
||||
Use Ivy to make minibuf promts better. Adds the ability to sort and filter.
|
||||
** Use Ivy
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package ivy
|
||||
:init
|
||||
(ivy-mode 1)
|
||||
(unbind-key "S-SPC" ivy-minibuffer-map)
|
||||
(setq ivy-height 30
|
||||
ivy-use-virtual-buffers t
|
||||
ivy-use-selectable-prompt t)
|
||||
(defun swiper-at-point ()
|
||||
(interactive)
|
||||
(swiper (thing-at-point 'word)))
|
||||
:bind (("C-x b" . ivy-switch-buffer)
|
||||
("C-c C-r" . ivy-resume)
|
||||
("C-c s" . swiper-at-point)
|
||||
("C-s" . swiper))
|
||||
:diminish)
|
||||
(use-package ivy
|
||||
:diminish
|
||||
:init
|
||||
(ivy-mode 1)
|
||||
(unbind-key "S-SPC" ivy-minibuffer-map)
|
||||
(setq ivy-height 30
|
||||
ivy-use-virtual-buffers t
|
||||
ivy-use-selectable-prompt t)
|
||||
:bind (("C-x b" . ivy-switch-buffer)
|
||||
("C-c C-r" . ivy-resume)
|
||||
("C-s" . swiper)))
|
||||
|
||||
;; ivy-rich makes Ivy look a little bit more like Helm.
|
||||
(use-package ivy-rich
|
||||
:after counsel
|
||||
:custom
|
||||
(ivy-virtual-abbreviate 'full
|
||||
ivy-rich-switch-buffer-align-virtual-buffer t
|
||||
ivy-rich-path-style 'abbrev)
|
||||
:init
|
||||
(ivy-rich-mode))
|
||||
;; ivy-rich makes Ivy look a little bit more like Helm.
|
||||
(use-package ivy-rich
|
||||
:after counsel
|
||||
:custom
|
||||
(ivy-virtual-abbreviate 'full
|
||||
ivy-rich-switch-buffer-align-virtual-buffer t
|
||||
ivy-rich-path-style 'abbrev)
|
||||
:init
|
||||
(ivy-rich-mode))
|
||||
|
||||
(use-package ivy-hydra)
|
||||
(use-package ivy-hydra)
|
||||
#+END_SRC
|
||||
|
||||
** Smex
|
||||
Sort commands by recency in ivy windows
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package smex)
|
||||
(use-package smex)
|
||||
#+END_SRC
|
||||
|
||||
* Counsel
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package counsel
|
||||
:ensure t
|
||||
:after ivy
|
||||
:init
|
||||
(counsel-mode 1)
|
||||
|
||||
:bind (("C-c ;" . counsel-M-x)
|
||||
("C-c U" . counsel-unicode-char)
|
||||
("C-c i" . counsel-imenu)
|
||||
("C-x f" . counsel-find-file)
|
||||
("C-c y" . counsel-yank-pop)
|
||||
("C-c r" . counsel-recentf)
|
||||
:map ivy-minibuffer-map
|
||||
("C-r" . counsel-minibuffer-history))
|
||||
:diminish)
|
||||
(use-package counsel
|
||||
:after ivy
|
||||
:init (counsel-mode 1)
|
||||
:bind (("C-c ;" . counsel-M-x)
|
||||
("C-c U" . counsel-unicode-char)
|
||||
("C-c i" . counsel-imenu)
|
||||
("C-x f" . counsel-find-file)
|
||||
("C-c y" . counsel-yank-pop)
|
||||
("C-c r" . counsel-recentf)
|
||||
:map ivy-minibuffer-map
|
||||
("C-r" . counsel-minibuffer-history))
|
||||
:diminish)
|
||||
#+END_SRC
|
||||
|
||||
* Undo Tree
|
||||
Using the beauty that is undo-tree, we can easily navigate through history of a buffer.
|
||||
This includes obviously going back in edit history, but also branching of end returning to previous states.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package undo-tree
|
||||
:bind (("C-x u" . undo-tree-visualize)
|
||||
("C-z" . undo-tree-undo)
|
||||
("C-S-z" . undo-tree-redo))
|
||||
:config
|
||||
(global-undo-tree-mode +1)
|
||||
(unbind-key "M-_" undo-tree-map)
|
||||
:diminish)
|
||||
|
||||
;; Trying undo-propose, which seems to offer a better experience, as
|
||||
;; undo tree is prone to losing data.
|
||||
(use-package undo-propose
|
||||
:disabled
|
||||
:bind (("C-c _" . undo-propose)
|
||||
:map undo-propose-mode-map
|
||||
("<up>" . undo-only)))
|
||||
#+END_SRC
|
||||
With this we can use ~C-x u~ in any buffer to bring up the tree and navigate it using the arrow key.
|
||||
Once in a state we agree with, just press ~q~ and we are done.
|
||||
|
||||
* Magit
|
||||
Magit is THE go to package for using git in emacs.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@@ -314,7 +285,6 @@ I use a single file to dump all links I plan on viewing later.
|
||||
(interactive)
|
||||
(find-file link-dump))
|
||||
#+END_SRC
|
||||
|
||||
** Configure org-mode
|
||||
This is the main configuration for the infamous org-mode.
|
||||
The most important parts are configuring key bindings to quickly access the files we have defined above.
|
||||
@@ -347,7 +317,6 @@ The most important parts are configuring key bindings to quickly access the file
|
||||
org-startup-with-inline-images t
|
||||
org-pretty-entities t
|
||||
org-indent-mode t
|
||||
org-ellipsis "⤵"
|
||||
org-footnote-section nil
|
||||
org-hide-leading-stars nil
|
||||
org-link-file-path-type 'relative
|
||||
@@ -366,11 +335,10 @@ When archiving items in org files, the default ist to crate a separate file name
|
||||
This clutters up my notes folder quite a bit, as I use a lot of separate files with thier respective archives.
|
||||
All archives should be stored in a single ~.archive~ file per directory.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-archive-location "./.archive::* From %s")
|
||||
(setq org-archive-location "./.archive::* From %s")
|
||||
#+END_SRC
|
||||
|
||||
** Beautify org-mode
|
||||
*** Icons for headline indentation
|
||||
*** Icons
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package org-bullets
|
||||
:init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
||||
@@ -378,7 +346,12 @@ All archives should be stored in a single ~.archive~ file per directory.
|
||||
(setq org-bullets-bullet-list '("◉" "○" "◆" "✿" "✚" "▶"))
|
||||
#+END_SRC
|
||||
|
||||
*** Replace checkmark with unicode icons
|
||||
Ellipsis icon:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-ellipsis "▾")
|
||||
#+END_SRC
|
||||
|
||||
Nice Icons for lists:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package pretty-mode
|
||||
:init (global-pretty-mode t))
|
||||
@@ -417,56 +390,44 @@ We also want them in exported HTML files
|
||||
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
|
||||
#+END_SRC
|
||||
|
||||
** Prettier Timestamps in Exports
|
||||
The default timestamps look pretty unintuitive, with all the angle brackets and all. Let's make them look better.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;;(add-to-list 'org-export-filter-timestamp-functions
|
||||
;; #'endless/filter-timestamp)
|
||||
;;(defun endless/filter-timestamp (trans back _comm)
|
||||
;; (pcase back
|
||||
;; ((or `jekyll `html)
|
||||
;; (replace-regexp-in-string "&[lg]t;" "" trans))
|
||||
;; (`latex
|
||||
;; (replace-regexp-in-string "[<>]" "" trans))))
|
||||
#+END_SRC
|
||||
Removed for now, this somehow breaks emacs
|
||||
|
||||
OK, no more brackets. Now for a better formatted display.
|
||||
|
||||
*** Prettier Timestamps in Exports
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq-default org-display-custom-times t)
|
||||
(setq org-time-stamp-custom-formats
|
||||
'("<%a %d.%m.%Y>" . "<%d.%m.%y %H:%M>"))
|
||||
#+END_SRC
|
||||
|
||||
** Templates
|
||||
*** Babel
|
||||
Here we set custom templates to be used for structure expansion.
|
||||
These are used when we type "<" folowed by the shortcut for a template and hit "TAB".
|
||||
e.g. "<s TAB" expands to ~#+BEGIN_SRC ?\n\n#+END_SRC~
|
||||
|
||||
Use ~org-tempo~ to quickly insert the structures
|
||||
#+begin_src emacs-lisp
|
||||
(require 'org-tempo)
|
||||
#+end_src
|
||||
**** emacs-lisp
|
||||
Shortcut for creating ~emacs-lisp~ code blocks. This is used extensively in this very file.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-to-list 'org-structure-template-alist '("el" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC"))
|
||||
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
||||
#+END_SRC
|
||||
|
||||
*** Capture Support Functions
|
||||
First we define a function to look the subheading under which we want to file captures:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun org-get-target-headline (&optional targets prompt)
|
||||
"Prompt for a location in an org file and jump to it.
|
||||
(defun org-get-target-headline (&optional targets prompt)
|
||||
"Prompt for a location in an org file and jump to it.
|
||||
|
||||
This is for promping for refile targets when doing captures.
|
||||
Targets are selected from `org-refile-targets'. If TARGETS is
|
||||
given it temporarily overrides `org-refile-targets'. PROMPT will
|
||||
replace the default prompt message.
|
||||
This is for promping for refile targets when doing captures.
|
||||
Targets are selected from `org-refile-targets'. If TARGETS is
|
||||
given it temporarily overrides `org-refile-targets'. PROMPT will
|
||||
replace the default prompt message.
|
||||
|
||||
If CAPTURE-LOC is is given, capture to that location instead of
|
||||
prompting."
|
||||
(let ((org-refile-targets (or targets org-refile-targets))
|
||||
(prompt (or prompt "Capture Location")))
|
||||
(org-refile t nil nil prompt))
|
||||
)
|
||||
If CAPTURE-LOC is is given, capture to that location instead of
|
||||
prompting."
|
||||
(let ((org-refile-targets (or targets org-refile-targets))
|
||||
(prompt (or prompt "Capture Location")))
|
||||
(org-refile t nil nil prompt))
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
*** Org Capture
|
||||
@@ -592,24 +553,20 @@ Treemacs makes navigating folders and files much easier. This is the default con
|
||||
(use-package elfeed
|
||||
:bind ("C-x w" . 'elfeed))
|
||||
#+END_SRC
|
||||
|
||||
** Hooks
|
||||
elfeed can be extended with various hooks for ease of used
|
||||
|
||||
*** Auto tag youtube feeds
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'elfeed-new-entry-hook
|
||||
(elfeed-make-tagger :feed-url "youtube\\.com"
|
||||
:add '(video youtube)))
|
||||
#+END_SRC
|
||||
|
||||
*** Do not spam unread tag
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'elfeed-new-entry-hook
|
||||
(elfeed-make-tagger :before "2 weeks ago"
|
||||
:remove 'unread))
|
||||
#+END_SRC
|
||||
|
||||
* Additional Package Imports
|
||||
** All The Icons
|
||||
We want to have some nice looking icons
|
||||
@@ -809,7 +766,6 @@ Some customization for writing elisp
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook 'my-elisp-mode-hook)
|
||||
#+END_SRC
|
||||
|
||||
* Global Key Bindings
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(bind-key "C-x k" 'kill-buffer-with-prejudice)
|
||||
|
||||
Reference in New Issue
Block a user