parent
dd0b684dc5
commit
35fd6ce31a
2 changed files with 361 additions and 70 deletions
303
init.org
303
init.org
|
@ -189,13 +189,25 @@ then load it.
|
|||
(load custom-file nil :nomessage))
|
||||
#+END_SRC
|
||||
|
||||
*** Load the General
|
||||
|
||||
Needs to load early so the ~:general~ keyword is available for ~use-package~.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package general :ensure t :demand t)
|
||||
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
*** Enable Undo Tree
|
||||
undo-tree is my preferred way of undoing and redoing stuff. The main reason is it doesn’t create a linear undo/redo history, but rather a complete tree you can navigate to see your complete editing history. One of the two obvious things to do are to tell Emacs to save all its undo history fies in a dedicated directory, otherwise we’d risk littering all of our directories. The second thing is to simply globally enable its mode.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package undo-tree
|
||||
:defer t
|
||||
:ensure t
|
||||
:straight (:build t)
|
||||
:custom
|
||||
(undo-tree-history-directory-alist
|
||||
`(("." . ,(expand-file-name (file-name-as-directory "undo-tree-hist")
|
||||
|
@ -439,6 +451,19 @@ It provides a minor-mode
|
|||
: [nil 26383 36877 803383 nil elpaca-process-queues nil nil 768000 nil]
|
||||
|
||||
|
||||
** Collect visible URLs to open in browser
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package fancy-ffap-menu
|
||||
:ensure (:host "codeberg.org" :repo "kakafarm/emacs-fancy-ffap-menu"
|
||||
:main "fancy-ffap-menu.el")
|
||||
:commands (fancy-ffap-menu-list-urls)
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: [nil 26432 21940 582674 nil elpaca-process-queues nil nil 547000 nil]
|
||||
|
||||
* Editor Features
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -708,6 +733,84 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
|
|||
: [nil 26434 3705 536018 nil elpaca-process-queues nil nil 266000 nil]
|
||||
|
||||
|
||||
** Evil Vim Keybindings
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; load evil
|
||||
(use-package evil
|
||||
:ensure t ;; install the evil package if not installed
|
||||
:init ;; tweak evil's configuration before loading it
|
||||
(setq evil-search-module 'evil-search)
|
||||
(setq evil-ex-complete-emacs-commands nil)
|
||||
(setq evil-vsplit-window-right t)
|
||||
(setq evil-split-window-below t)
|
||||
(setq evil-shift-round nil)
|
||||
(setq evil-want-C-u-scroll nil)
|
||||
:config
|
||||
(evil-mode)
|
||||
;; set leader keys
|
||||
(evil-set-leader nil (kbd "C-SPC"))
|
||||
(evil-set-leader 'normal (kbd "SPC"))
|
||||
(evil-set-leader 'normal "," t) ;; set localleader
|
||||
|
||||
;; make vc commands available via leader key
|
||||
(evil-define-key 'normal 'global
|
||||
(kbd "<leader>v") vc-prefix-map)
|
||||
(keymap-global-set "C-c v" vc-prefix-map)
|
||||
;; make project commands available via leader key
|
||||
(evil-define-key 'normal 'global
|
||||
(kbd "<leader>p") project-prefix-map)
|
||||
(keymap-global-set "C-c p" project-prefix-map)
|
||||
|
||||
(evil-define-key 'normal 'global
|
||||
(kbd "<leader>ff") #'find-file
|
||||
(kbd "<leader>fo") #'recentf
|
||||
(kbd "<leader>fr") #'revert-buffer
|
||||
(kbd "<leader>fd") #'diff-buffer-with-file)
|
||||
(keymap-global-set "C-c f f" #'find-file)
|
||||
(keymap-global-set "C-c f o" #'recentf)
|
||||
(keymap-global-set "C-c f r" #'revert-buffer)
|
||||
(keymap-global-set "C-c f d" #'diff-buffer-with-file)
|
||||
)
|
||||
|
||||
#+END_SRC
|
||||
|
||||
** Load Evil Collection for comprehensive evil support
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package evil-collection
|
||||
:ensure t
|
||||
:after evil
|
||||
:init
|
||||
(evil-collection-init))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
** Harpoon configuration
|
||||
|
||||
#+BEGIN_SRC emacs-lisp :tangle no
|
||||
(use-package harpoon
|
||||
:ensure t
|
||||
:init
|
||||
(setq pti-harpoon-map (make-sparse-keymap))
|
||||
(keymap-set pti-harpoon-map (kbd "h") 'harpoon-toggle-quick-menu)
|
||||
(keymap-set pti-harpoon-map (kbd "a") 'harpoon-add-file)
|
||||
(keymap-set pti-harpoon-map (kbd "f") 'harpoon-toggle-file)
|
||||
(keymap-set pti-harpoon-map (kbd "j") 'harpoon-go-to-1)
|
||||
(keymap-set pti-harpoon-map (kbd "k") 'harpoon-go-to-2)
|
||||
(keymap-set pti-harpoon-map (kbd "l") 'harpoon-go-to-3)
|
||||
(keymap-set pti-harpoon-map (kbd ";") 'harpoon-go-to-4)
|
||||
(keymap-set pti-harpoon-map (kbd "h") 'harpoon-toggle-quick-menu)
|
||||
:bind
|
||||
(("<leader>h" . 'pti-harpoon-map)
|
||||
("C-c h" . 'pti-harpoon-map)))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: [nil 26284 54919 318035 nil elpaca-process-queues nil nil 339000 nil]
|
||||
|
||||
|
||||
** User Interface
|
||||
*** Display startup time
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -1465,6 +1568,125 @@ exporter manual.]]
|
|||
|
||||
#+RESULTS:
|
||||
: t
|
||||
*** Evil Support for Org
|
||||
|
||||
Better keybinding for evil mode from [[https://github.com/Somelauw/evil-org-mode][the evil-org github repo]].
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package evil-org
|
||||
:ensure t
|
||||
:after org
|
||||
:hook
|
||||
(org-mode . evil-org-mode)
|
||||
:config
|
||||
(require 'evil-org-agenda)
|
||||
(evil-org-agenda-set-keys))
|
||||
#+END_SRC
|
||||
|
||||
Here is a snapshot of the keybindings dd <2024-07-30 Tue>.
|
||||
|
||||
**** Quick overview
|
||||
|
||||
|----------------+---------------------------|
|
||||
| key | explanation |
|
||||
|----------------+---------------------------|
|
||||
| gh, gj, gk, gl | navigate between elements |
|
||||
| vae | select an element |
|
||||
|----------------+---------------------------|
|
||||
|
||||
**** Headings and items
|
||||
|
||||
|--------------+------------------------|
|
||||
| key | explanation |
|
||||
|--------------+------------------------|
|
||||
| M-ret | insert heading |
|
||||
| <tab>, g TAB | fold / unfold headings |
|
||||
| M-h or << | promote a heading |
|
||||
| M-l or >> | demote a heading |
|
||||
| M-k | move subtree up |
|
||||
| M-j | move subtree down |
|
||||
| M-S-h or <aR | promote a subtree |
|
||||
| M-S-l or >aR | demote a subtree |
|
||||
| vaR | select a subtree |
|
||||
|--------------+------------------------|
|
||||
|
||||
**** Tables
|
||||
|
||||
|-----------+--------------------------------|
|
||||
| key | explanation |
|
||||
|-----------+--------------------------------|
|
||||
| ( | previous table cell |
|
||||
| ) | next table cell |
|
||||
| { | beginning of table |
|
||||
| } | end of table |
|
||||
| M-h / M-l | move table column left / right |
|
||||
| M-k / M-j | move table column up / down |
|
||||
| vae | select table cell |
|
||||
| vaE | select table row |
|
||||
| var | select whole table |
|
||||
|-----------+--------------------------------|
|
||||
|
||||
**** Agenda
|
||||
|
||||
|-------------------------+-------------------------+-----------------------------------------------------------------------------------|
|
||||
| Evil key | Emacs key | explanation |
|
||||
|-------------------------+-------------------------+-----------------------------------------------------------------------------------|
|
||||
| gH | | Move cursor to the top of window |
|
||||
| gM | | Move cursor to the middle of window |
|
||||
| gL | | Move cursor to the bottom of window |
|
||||
| <tab>, S-<return> | <tab> | go to the corresponding entry at point |
|
||||
| g TAB | <tab> | go to the corresponding entry at point |
|
||||
| <return> | <return> | go to the Org mode file which contains the item at point |
|
||||
| M-<return> | L | Display Org file and center around the item |
|
||||
| <space> | <space> | scroll up |
|
||||
| <delete> or <backspace> | <delete> or <backspace> | scroll down |
|
||||
| j, k | n, p | next, previous line |
|
||||
| gj, gk, C-j, C-k | N, P | next, previous item |
|
||||
| [, ] | b, f | previous, next week |
|
||||
| J, K | -, +, S-down, S-up | down, up priority |
|
||||
| H, L | S-left, S-right | modify date to earlier, later |
|
||||
| t | t | cycle TODO keywords |
|
||||
| M-j, M-k | M-down, M-up | drag line forward, backward |
|
||||
| C-S-h, C-S-l | C-S-left, C-S-right | previous, next keyword |
|
||||
| u | C-_, C-/ | undo |
|
||||
| dd | C-k | delete item |
|
||||
| da | a | ask and archive item |
|
||||
| dA | $ | archive item |
|
||||
| ct | : | set tags |
|
||||
| ce | e | set effort |
|
||||
| cT | ; | set timer |
|
||||
| i | i | insert entry in diary |
|
||||
| a | z | add note |
|
||||
| A | A | append to agenda |
|
||||
| C | k | capture |
|
||||
| m | m | mark |
|
||||
| * | * | toggle all marks |
|
||||
| % | % | mark regexp |
|
||||
| M | U | remove all marks |
|
||||
| x | B | execute action on marks |
|
||||
| gr | r | refresh agenda |
|
||||
| gR | g | refresh all agendas |
|
||||
| ZQ | x | exit agenda |
|
||||
| ZZ | Q | quit agenda |
|
||||
| gD | v | tweak display (deadlines, diary, follow/log-mode, entry text, grid, day/week/year |
|
||||
| ZD | # | dim blocked tasks |
|
||||
| sc, sr, se, st, s^ | <, =, _, /, ^ | filter by category, regexp, effort, tag, top headline |
|
||||
| S | \vert | remove all filters |
|
||||
| ss | ~ | filter/limit interactively |
|
||||
| I | I | clock in |
|
||||
| O | O | clock out |
|
||||
| cg | J | jump to the currently clocked in task within the agenda |
|
||||
| cc | X | cancel the current running clock |
|
||||
| cr | R | toggle clocktable mode in an agenda buffer |
|
||||
| . | . | go to today's date |
|
||||
| gc | c | pop up calendar |
|
||||
| gC | C | pop up date converter |
|
||||
| p | > | pop up date selector |
|
||||
| gh | H | pop up holiday calendar |
|
||||
| gm | M | pop up phases of the moon |
|
||||
| gs | S | pop up sunrise/sunset times |
|
||||
| gt | T | pop up tag list |
|
||||
| +, - | [, ] | manipulate the query by adding a search term with positive or negative selection |
|
||||
|-------------------------+-------------------------+-----------------------------------------------------------------------------------|
|
||||
|
||||
*** Org GCal Support
|
||||
|
||||
|
@ -1709,6 +1931,22 @@ We can add a list of queries
|
|||
;; configure eglot-mode
|
||||
(use-package eglot
|
||||
:config
|
||||
(evil-define-key 'normal eglot-mode-map
|
||||
(kbd "<leader>c a") 'eglot-code-actions
|
||||
(kbd "<leader>c d") 'eglot-find-declaration
|
||||
(kbd "<leader>c i") 'eglot-find-implementation
|
||||
(kbd "<leader>c k") 'eglot-find-typeDefinition
|
||||
(kbd "<leader>c f") 'eglot-format
|
||||
(kbd "<leader>c F") 'eglot-format-buffer
|
||||
(kbd "<leader>c r") 'eglot-rename
|
||||
(kbd "<leader>c Q") 'eglot-shutdown
|
||||
(kbd "<leader>c q") 'eglot-reconnect
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") 'flymake-goto-prev-error
|
||||
(kbd "]d") #'flymake-goto-next-error
|
||||
(kbd "[d") #'flymake-goto-prev-error
|
||||
)
|
||||
|
||||
;; Shutdown server when last managed buffer is killed
|
||||
(setq eglot-autoshutdown t)
|
||||
|
||||
|
@ -1730,6 +1968,19 @@ We can add a list of queries
|
|||
|
||||
#+END_SRC
|
||||
|
||||
*** Flymake Support
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun pti-flymake-evil-keybindings ()
|
||||
"Map flymake error navigation to easier key sequences."
|
||||
(evil-define-key 'normal flymake-mode-map
|
||||
(kbd "]d") #'flymake-goto-next-error
|
||||
(kbd "[d") #'flymake-goto-prev-error))
|
||||
|
||||
(add-hook 'flymake-mode-hook #'pti-flymake-evil-keybindings)
|
||||
#+END_SRC
|
||||
|
||||
|
||||
*** Use Treesitter parser support
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
||||
|
@ -1985,12 +2236,36 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
|
|||
lisp-mode-hook
|
||||
scheme-mode-hook))
|
||||
(add-hook mode #'enable-paredit-mode)))
|
||||
|
||||
(use-package evil-paredit
|
||||
:ensure t
|
||||
:commands (evil-paredit-mode)
|
||||
:init
|
||||
(dolist (mode '(emacs-lisp-mode-hook
|
||||
lisp-interaction-mode-hook
|
||||
lisp-mode-hook
|
||||
scheme-mode-hook))
|
||||
(add-hook mode #'evil-paredit-mode)))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
***** TODO FIx paredit bug related to obsolete macro
|
||||
|
||||
evil-paredit relies on an obsolete (and no longer available method)
|
||||
`evil-called-interactively-p`. So I define it here till evil-paredit
|
||||
has implemented the new method.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defmacro evil-called-interactively-p ()
|
||||
"Wrapper for `called-interactively-p'.
|
||||
In older versions of Emacs, `called-interactively-p' takes
|
||||
no arguments. In Emacs 23.2 and newer, it takes one argument."
|
||||
(called-interactively-p 'any))
|
||||
(make-obsolete 'evil-called-interactively-p
|
||||
"please use (called-interactively-p 'any) instead."
|
||||
"Git commit 222b791")
|
||||
|
||||
#+END_SRC
|
||||
**** Rainbow Parentheses
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
@ -2129,7 +2404,7 @@ Configure Geiser and Scheme
|
|||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
| | geiser-mode | enable-paredit-mode | aggressive-indent-mode | geiser-mode--maybe-activate |
|
||||
| evil-paredit-mode | geiser-mode | enable-paredit-mode | aggressive-indent-mode | geiser-mode--maybe-activate |
|
||||
|
||||
**** Enable Cider for Clojure mode
|
||||
|
||||
|
@ -2222,7 +2497,15 @@ This function has to be called in the *sly-inferior-lisp*
|
|||
:config
|
||||
(setq
|
||||
terraform-indent-level 2
|
||||
terraform-format-on-save t))
|
||||
terraform-format-on-save t)
|
||||
(evil-define-key 'normal terraform-mode-map
|
||||
(kbd "<leader>c k") #'terraform-open-doc
|
||||
(kbd "<leader>c f") #'terraform-format
|
||||
(kbd "<leader>c F") #'terraform-format-buffer
|
||||
(kbd "<leader>c n") 'flymake-goto-next-error
|
||||
(kbd "<leader>c p") 'flymake-goto-prev-error
|
||||
(kbd "]d") #'flymake-goto-next-error
|
||||
(kbd "[d") #'flymake-goto-prev-error))
|
||||
#+END_SRC
|
||||
|
||||
Map the keymap consistently to the eglot mappings.
|
||||
|
@ -2288,7 +2571,8 @@ Map the keymap consistently to the eglot mappings.
|
|||
;; (setq dape-repl-use-shorthand t)
|
||||
|
||||
;; By default dape uses gdb keybinding prefix
|
||||
(setq dape-key-prefix "<space>d")
|
||||
;; (setq dape-key-prefix "<space>d")
|
||||
(evil-define-key 'normal 'global (kbd "<leader>d") dape-global-map)
|
||||
|
||||
;; Kill compile buffer on build success
|
||||
;; (add-hook 'dape-compile-compile-hooks 'kill-buffer)
|
||||
|
@ -2375,7 +2659,8 @@ Map the keymap consistently to the eglot mappings.
|
|||
:branch "main"
|
||||
:files ("dist" "*.el"))
|
||||
:bind
|
||||
("C-y" . copilot-accept-completion)
|
||||
(:map evil-insert-state-map
|
||||
("C-y" . copilot-accept-completion))
|
||||
:config
|
||||
(add-to-list 'copilot-indentation-alist '(scheme-mode . 2))
|
||||
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode . 2))
|
||||
|
@ -2642,6 +2927,12 @@ Indicates the ~init.el~ file is provided by and ends here:
|
|||
(report-time-since-load "Future")
|
||||
#+END_SRC
|
||||
|
||||
** TODO Decide about general keybindings.
|
||||
The *general* package offers enhanced support for *evil* keybindings,
|
||||
notably it integrates with *use-package* to define keybindings which
|
||||
will load the package if not loaded yet.
|
||||
It considerably streamlines managing evil bindings so it should offer
|
||||
enough value but I just removed it, so it'll have to wait a bit.
|
||||
** NEXT Add support for zola blogposts writing in org-mode
|
||||
:LOGBOOK:
|
||||
CLOCK: [2024-08-15 Thu 13:47]--[2024-08-16 Fri 00:57] => 11:10
|
||||
|
|
Loading…
Reference in a new issue