Compare commits

...

2 commits

266
init.org
View file

@ -56,7 +56,6 @@ Also immediately set lexical binding mode.
** Global Configuration
#+BEGIN_SRC emacs-lisp
(setq snm-enable-evil nil) ;; enable evil bindings
(setq snm-docker-executable 'podman) ;; use docker or podman
(use-package org
@ -201,20 +200,6 @@ 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
(when snm-enable-evil
(use-package general :ensure t :demand t))
#+END_SRC
#+RESULTS:
*** Wait for initial installations
#+BEGIN_SRC emacs-lisp
@ -736,48 +721,12 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
#+RESULTS:
: [nil 26434 3705 536018 nil elpaca-process-queues nil nil 266000 nil]
** Evil Vim Keybindings
** Frequently used File/Project Operations
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-c v" vc-prefix-map)
(keymap-global-set "C-c p" project-prefix-map)
(when snm-enable-evil
;; 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)
(setq evil-want-keybinding 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)
;; make project commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>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)
))
#+END_SRC
** Frequently used File Operations
#+BEGIN_SRC emacs-lisp
(recentf-mode 1) ;; enable recent file tracking
(keymap-global-set "C-c f f" #'find-file)
(keymap-global-set "C-c f o" #'recentf)
@ -785,18 +734,6 @@ See the excellent documentation on [[https://github.com/minad/consult][Minad's c
(keymap-global-set "C-c f d" #'diff-buffer-with-file)
#+END_SRC
** Load Evil Collection for comprehensive evil support
#+BEGIN_SRC emacs-lisp
(when snm-enable-evil
;; load evil-collection
(use-package evil-collection
:ensure t
:after evil
:init
(evil-collection-init)))
#+END_SRC
** User Interface
*** Display startup time
#+BEGIN_SRC emacs-lisp
@ -1093,22 +1030,6 @@ Enables and configures Yasnippet, a template system for Emacs:
;; configure eglot-mode
(use-package eglot
:config
(if snm-enable-evil
(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)
(progn
(keymap-set eglot-mode-map "C-c c a" #'eglot-code-actions)
(keymap-set eglot-mode-map "C-c c d" #'eglot-find-declaration)
(keymap-set eglot-mode-map "C-c c i" #'eglot-find-implementation)
@ -1119,7 +1040,7 @@ Enables and configures Yasnippet, a template system for Emacs:
(keymap-set eglot-mode-map "C-c c Q" #'eglot-shutdown)
(keymap-set eglot-mode-map "C-c c q" #'eglot-reconnect)
(keymap-set eglot-mode-map "C-c c n" #'flymake-goto-next-error)
(keymap-set eglot-mode-map "C-c c p" #'flymake-goto-prev-error)))
(keymap-set eglot-mode-map "C-c c p" #'flymake-goto-prev-error)
;; Shutdown server when last managed buffer is killed
(setq eglot-autoshutdown t)
@ -1142,20 +1063,6 @@ Enables and configures Yasnippet, a template system for Emacs:
#+END_SRC
*** Flymake Support
#+BEGIN_SRC emacs-lisp
(defun snm-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))
(if snm-enable-evil
(add-hook 'flymake-mode-hook #'snm-flymake-evil-keybindings))
#+END_SRC
*** Use Treesitter parser support
Recently with verion 0.25 the treesitter library changed ABI version
@ -1450,31 +1357,9 @@ 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)))
(if snm-enable-evil
(use-package enhanced-evil-paredit
:ensure (enhanced-evil-paredit :host github :repo "jamescherti/enhanced-evil-paredit.el" :wait t)
:config
(add-hook 'paredit-mode-hook #'enhanced-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
@ -1735,19 +1620,10 @@ This function has to be called in the *sly-inferior-lisp*
(setq
terraform-indent-level 2
terraform-format-on-save t)
(if snm-enable-evil
(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)
(progn
(keymap-set terraform-mode-map "C-c c k" #'terraform-open-doc)
(keymap-set terraform-mode-map "C-c c f" #'terraform-format)
(keymap-set terraform-mode-map "C-c c F" #'terraform-format-buffer))))
(keymap-set terraform-mode-map "C-c c F" #'terraform-format-buffer))
#+END_SRC
Map the keymap consistently to the eglot mappings.
@ -1843,10 +1719,6 @@ Map the keymap consistently to the eglot mappings.
;; Use n for next etc. in REPL
;; (setq dape-repl-use-shorthand t)
;; By default dape uses gdb keybinding prefix
(if snm-enable-evil
(evil-define-key 'normal 'global (kbd "<leader>d") dape-global-map))
;; Projectile users
(add-to-list 'dape-configs
`(vscode-js-node
@ -2338,127 +2210,6 @@ 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
(when snm-enable-evil
(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
#+BEGIN_SRC emacs-lisp
@ -3316,8 +3067,6 @@ behind it.
#+RESULTS:
: [nil 26507 37720 141708 nil elpaca-process-queues nil nil 278000 nil]
Avy is supported by evil and setup in the *evil-integration* package.
#+RESULTS:
** Ace Window Configuration
@ -3639,13 +3388,6 @@ Indicates the ~init.el~ file is provided by and ends here:
(report-time-since-load "Future")
#+END_SRC
** DONE Decide about general keybindings.
SCHEDULED: <2025-02-02 zo>
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.
** DONE Add support for zola blogposts writing in org-mode
CLOSED: [2025-01-20 Mon 10:28]
:LOGBOOK: