forked from daviwil/emacs-from-scratch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add show notes for the first 10 Emacs From Scratch episodes
- Loading branch information
Showing
11 changed files
with
1,222 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#+title: Emacs from Scratch #1 | ||
|
||
* The plan | ||
We're going to walk through a configuration of Emacs from scratch, starting with the most obvious improvements and then working our way to the more specialized changes as we proceed. | ||
|
||
* Brief demo of my config | ||
* Starting off with empty config, make the UI more minimal | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package command-log-mode) | ||
|
||
#+end_src | ||
|
||
* Set a theme | ||
* Set up Ivy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
* Check out the GitHub repo | ||
|
||
https://github.com/daviwil/runemacs | ||
|
||
* General Improvements | ||
|
||
** Line Numbers | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(column-number-mode) | ||
(global-display-line-numbers-mode t) | ||
|
||
;; Disable line numbers for some modes | ||
(dolist (mode '(org-mode-hook | ||
term-mode-hook | ||
eshell-mode-hook)) | ||
(add-hook mode (lambda () (display-line-numbers-mode 0)))) | ||
|
||
#+end_src | ||
|
||
** Rainbow Delimiters | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package rainbow-delimiters | ||
:hook (prog-mode . rainbow-delimiters-mode)) | ||
|
||
#+end_src | ||
|
||
* Packages | ||
|
||
** which-key | ||
|
||
https://github.com/justbur/emacs-which-key | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package which-key | ||
:init (which-key-mode) | ||
:diminish which-key-mode | ||
:config | ||
(setq which-key-idle-delay 0.3)) | ||
|
||
#+end_src | ||
|
||
** ivy-rich | ||
|
||
https://github.com/Yevgnen/ivy-rich | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package ivy-rich | ||
:init | ||
(ivy-rich-mode 1) | ||
:config | ||
(setq ivy-format-function #'ivy-format-function-line) | ||
(setq ivy-rich--display-transformers-list | ||
(plist-put ivy-rich--display-transformers-list | ||
'ivy-switch-buffer | ||
'(:columns | ||
((ivy-rich-candidate (:width 40)) | ||
(ivy-rich-switch-buffer-indicators (:width 4 :face error :align right)); return the buffer indicators | ||
(ivy-rich-switch-buffer-major-mode (:width 12 :face warning)) ; return the major mode info | ||
(ivy-rich-switch-buffer-project (:width 15 :face success)) ; return project name using `projectile' | ||
(ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.3)))))) ; return file path relative to project root or `default-directory' if project is nil | ||
:predicate | ||
(lambda (cand) | ||
(if-let ((buffer (get-buffer cand))) | ||
;; Don't mess with EXWM buffers | ||
(with-current-buffer buffer | ||
(not (derived-mode-p 'exwm-mode))))))))) | ||
|
||
#+end_src | ||
|
||
** helpful | ||
|
||
https://github.com/Wilfred/helpful | ||
|
||
** doom-themes | ||
https://github.com/hlissner/emacs-doom-themes | ||
|
||
- doom theme | ||
- which-key | ||
- Line numbers (hooks) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
* Check out the GitHub repo | ||
|
||
https://github.com/daviwil/runemacs | ||
|
||
* Notes from previous streams | ||
|
||
We need to update the =load-theme= call to avoid a prompt at startup, =(load-theme 'doom-dracula t)= | ||
|
||
Thanks to Kyle Sexton and Nathan Chen for pointing out that all-the-icons is needed for doom-modeline to display correctly! | ||
|
||
* Basic Key Bindings | ||
|
||
=define-key= and =global-set-key= | ||
|
||
* Bindings with general.el | ||
|
||
https://github.com/noctuid/general.el#general-examples | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package general | ||
:config | ||
(general-evil-setup t) | ||
|
||
(general-create-definer rune/leader-keys | ||
:keymaps '(normal insert visual emacs) | ||
:prefix "SPC" | ||
:global-prefix "C-SPC")) | ||
|
||
(rune/leader-keys | ||
"t" '(:ignore t :which-key "toggles") | ||
"tt" '(counsel-load-theme :which-key "choose theme")) | ||
|
||
#+end_src | ||
|
||
* Becoming Evil | ||
|
||
https://github.com/emacs-evil/evil | ||
https://github.com/emacs-evil/evil-collection | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(defun rune/evil-hook () | ||
(dolist (mode '(custom-mode | ||
eshell-mode | ||
git-rebase-mode | ||
erc-mode | ||
circe-server-mode | ||
circe-chat-mode | ||
circe-query-mode | ||
sauron-mode | ||
term-mode)) | ||
(add-to-list 'evil-emacs-state-modes mode))) | ||
|
||
(use-package evil | ||
:init | ||
(setq evil-want-integration t) | ||
(setq evil-want-keybinding nil) | ||
(setq evil-want-C-u-scroll t) | ||
(setq evil-want-C-i-jump nil) | ||
:hook (evil-mode . rune/evil-hook) | ||
:config | ||
(evil-mode 1) | ||
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) | ||
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) | ||
|
||
;; Use visual line motions even outside of visual-line-mode buffers | ||
(evil-global-set-key 'motion "j" 'evil-next-visual-line) | ||
(evil-global-set-key 'motion "k" 'evil-previous-visual-line) | ||
|
||
(evil-set-initial-state 'messages-buffer-mode 'normal) | ||
(evil-set-initial-state 'dashboard-mode 'normal)) | ||
|
||
(use-package evil-collection | ||
:after evil | ||
:config | ||
(evil-collection-init)) | ||
|
||
;; Mention evil-collection-mode-list | ||
|
||
#+end_src | ||
|
||
https://github.com/emacs-evil/evil-collection#configuration | ||
|
||
If we want to be hardcore... | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(defun rune/dont-arrow-me-bro () | ||
(interactive) | ||
(message "Arrow keys are bad, you know?")) | ||
|
||
;; Disable arrow keys in normal and visual modes | ||
(define-key evil-normal-state-map (kbd "<left>") 'rune/dont-arrow-me-bro) | ||
(define-key evil-normal-state-map (kbd "<right>") 'rune/dont-arrow-me-bro) | ||
(define-key evil-normal-state-map (kbd "<down>") 'rune/dont-arrow-me-bro) | ||
(define-key evil-normal-state-map (kbd "<up>") 'rune/dont-arrow-me-bro) | ||
(evil-global-set-key 'motion (kbd "<left>") 'rune/dont-arrow-me-bro) | ||
(evil-global-set-key 'motion (kbd "<right>") 'rune/dont-arrow-me-bro) | ||
(evil-global-set-key 'motion (kbd "<down>") 'rune/dont-arrow-me-bro) | ||
(evil-global-set-key 'motion (kbd "<up>") 'rune/dont-arrow-me-bro) | ||
|
||
#+end_src | ||
|
||
* Hydra | ||
|
||
https://github.com/abo-abo/hydra | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package hydra) | ||
|
||
(defhydra hydra-text-scale (:timeout 4) | ||
"scale text" | ||
("j" text-scale-increase "in") | ||
("k" text-scale-decrease "out")) | ||
("f" nil "finished" :exit t)) | ||
|
||
(rune/leader-keys | ||
"ts" '(hydra-text-scale/body :which-key "scale text")) | ||
|
||
#+end_src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
* Check out the GitHub repo | ||
|
||
https://github.com/daviwil/runemacs | ||
|
||
* Projectile | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package projectile | ||
:diminish projectile-mode | ||
:config (projectile-mode) | ||
:bind-keymap | ||
("C-c p" . projectile-command-map) | ||
:init | ||
(when (file-directory-p "~/Projects/Code") | ||
(setq projectile-project-search-path '("~/Projects/Code"))) | ||
(setq projectile-switch-project-action #'projectile-dired)) | ||
|
||
#+end_src | ||
|
||
https://github.com/bbatsov/projectile | ||
https://docs.projectile.mx/projectile/index.html | ||
https://docs.projectile.mx/projectile/projects.html#storing-project-settings | ||
https://www.gnu.org/software/emacs/manual/html_node/elisp/Directory-Local-Variables.html | ||
|
||
- Run project =C-c p u= | ||
- Run tests: =C-c p P= | ||
- Edit dir-locals: =C-c p E= (reload with =hack-dir-local-variables-non-file-buffer=) | ||
|
||
** counsel-projectile | ||
|
||
https://github.com/ericdanan/counsel-projectile | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package counsel-projectile | ||
:after projectile | ||
:config | ||
(counsel-projectile-mode 1)) | ||
|
||
#+end_src | ||
|
||
- Advanced project switching: =C-c p p= | ||
- Quick searching with =counsel-projectile-rg= - =C-c p s r= | ||
- Results to buffer with =C-c C-o= | ||
|
||
* Magit | ||
|
||
https://github.com/magit/magit | ||
ttps://magit.vc/ | ||
https://magit.vc/manual/magit/ | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package magit | ||
:commands (magit-status magit-get-current-branch) | ||
:custom | ||
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) | ||
|
||
(use-package evil-magit | ||
:after magit) | ||
|
||
#+end_src | ||
|
||
*Operations* | ||
|
||
Run =magit-status= in buffer from Git repo, press =?= for command panel. | ||
|
||
Refresh buffer with =g r= | ||
|
||
- Diffs | ||
- Commit log | ||
- Blame | ||
- Stashes | ||
- Branches | ||
- Rebase | ||
- Pull/push | ||
|
||
** Forge | ||
|
||
https://github.com/magit/forge | ||
https://magit.vc/manual/forge | ||
|
||
Important: https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started | ||
|
||
#+begin_src emacs-lisp | ||
|
||
(use-package forge) | ||
|
||
#+end_src |
Oops, something went wrong.