diff --git a/home/doomemacs/config.org b/home/doomemacs/config.org index 0e91783..513e369 100644 --- a/home/doomemacs/config.org +++ b/home/doomemacs/config.org @@ -1,6 +1,8 @@ #+TITLE: Doom Emacs Configuration File -Execute ~doom sync~ after modifying this file to tangle it to ~config.el~. +* Installation + +Execute ~doom sync~ after modifying this file to tangle it to ~config.el~. Install `lil` The following block of comments is from the default configuration. @@ -221,7 +223,6 @@ numbers are disabled. For relative line numbers, set this to ~relative~. #+begin_src emacs-lisp (setq display-line-numbers-type 'relative) -(global-display-line-numbers-mode) #+end_src ** Indentation Style Hooks @@ -231,21 +232,22 @@ numbers are disabled. For relative line numbers, set this to ~relative~. (setq whitespace-style '(face spaces tabs newline trailing space-mark tab-mark newline-mark) whitespace-line-column 80) + (display-line-numbers-mode) (display-fill-column-indicator-mode) - ;;(whitespace-mode) (setq indent-tabs-mode t indent-line-function 'tab-to-tab-stop tab-width 3) (indent-tabs-mode) (smart-tabs-mode-enable) - ) +) (defun custom/common-richtext-hook () (setq whitespace-style '(face spaces tabs newline trailing space-mark tab-mark newline-mark)) (setq whitespace-line-column nil) - ) + (display-line-numbers-mode) +) -(add-hook 'text-mode-hook #'custom/common-richtext-hook) +(add-hook 'text-mode-hook #'custom/common-richtext-hook) #+end_src * Package-specific Settings @@ -329,6 +331,7 @@ Note that ~onsave~ was intentionally turned off because it messes with version c indent-line-function 'tab-to-tab-stop tab-width 3) (indent-tabs-mode) + (display-line-numbers-mode) ) (add-hook 'lisp-mode-hook #'custom/lisp-family-hook) (add-hook 'lisp-data-mode-hook #'custom/lisp-family-hook) @@ -402,6 +405,9 @@ removed. The target indentation style of ~LaTeX~ is as follows: #+begin_src tex :tangle no +\section{A section} +% No indent here + \begin{enumerate}[1.] \item Some item 1. Note that item is not indented. @@ -455,7 +461,7 @@ introduced. ) #+end_src -*** Lean +*** Lean 4 #+begin_src emacs-lisp :tangle packages.el (package! lean4-mode :recipe ( @@ -488,14 +494,17 @@ introduced. Add the necessary hooks for LilyPond mode. +FIXME: Defer initialisation + #+begin_src emacs-lisp (use-package! lilypond-mode :init - (print! "Initializing LilyPond-mode") - (add-to-list 'auto-mode-alist '("\\.ly\\'" . LilyPond-mode)) + (print! "Initializing LilyPond-mode") + (add-to-list 'auto-mode-alist '("\\.ly\\'" . LilyPond-mode)) + ;:after-call LilyPond-mode :config - (add-hook 'LilyPond-mode-hook #'custom/common-program-hook) - ) + (add-hook 'LilyPond-mode-hook #'custom/common-program-hook) +) #+end_src ** Tools @@ -531,24 +540,118 @@ addition. See [[https://emacs.stackexchange.com/questions/75827/doom-emacs-error #+begin_src emacs-lisp :tangle packages.el (package! transient - :pin "c2bdf7e12c530eb85476d3aef317eb2941ab9440" - :recipe (:host github :repo "magit/transient")) + :pin "c2bdf7e12c530eb85476d3aef317eb2941ab9440" + :recipe (:host github :repo "magit/transient")) (package! with-editor - :pin "bbc60f68ac190f02da8a100b6fb67cf1c27c53ab" - :recipe (:host github :repo "magit/with-editor")) + :pin "bbc60f68ac190f02da8a100b6fb67cf1c27c53ab" + :recipe (:host github :repo "magit/with-editor")) #+end_src *** Emacs IPython Notebook (ein) -WIP +Adapted from [[https://gist.github.com/millejoh/8632402a11384a3a0949fa350a1a271b]] + +Usage: Since ~ein:notebooklist-mode~, ~ein:markdown-mode~, and +~ein:traceback-mode~ are major modes, their hotkeys are triggered by the local +leader ~,~/~SPC m~. However the ~ein:notebook-mode~ and +~ein:notebook-multilang-mode~ are minor modes and they are triggered by ~C-c~ +instead of ~,~. + +FIXME: Delete the emacs-esque keybinding from the maps. #+begin_src emacs-lisp +(defun custom/ein:worksheet-merge-cell-next () + (interactive) + (ein:worksheet-merge-cell (ein:worksheet--get-ws-or-error) (ein:worksheet-get-current-cell) t t)) (map! :after ein :localleader - :map ein:notebook-mode-map - (:prefix ("m" . "move") - :desc "Up" "k" #'ein-markdown-move-up - :desc "Down" "j" #'ein-markdown-move-down - ) + :map ein:notebooklist-mode-map ; Major mode + :desc "Reload" "r" #'ein:notebooklist-reload + :desc "Open" "o" #'ein:notebooklist-open + :desc "Prev item" "k" #'ein:notebooklist-prev-item + :desc "Next item" "j" #'ein:notebooklist-next-item + :desc "New notebook" "n" #'ein:notebooklist-new-notebook + :desc "New notebook with name" "N" #'ein:notebooklist-new-notebook-with-name +) +(map! :after ein + :localleader + :map ein:markdown-mode-map ; Major mode + :desc "Up" "K" #'ein:markdown-move-up + :desc "Down" "J" #'ein:markdown-move-down + :desc "Promote" "H" #'ein:markdown-move-up + :desc "Demote" "L" #'ein:markdown-move-down + :desc "Do" "e" #'ein:markdown-do + :desc "Cycle" "c" #'ein:markdown-cycle +) +(map! :after ein + :localleader + :map ein:traceback-mode-map ; Major mode + "RET" 'ein:tb-jump-to-source-at-point-command + "n" 'ein:tb-next-item + "p" 'ein:tb-prev-item + "q" 'bury-buffer +) +(map! :after ein + :map ein:notebook-mode-map ; Minor mode + :prefix "C-c" + ;; Cell + :desc "Copy cell" "y" #'ein:worksheet-copy-cell + :desc "Yank cell" "p" #'ein:worksheet-yank-cell + :desc "kill cell" "d" #'ein:worksheet-kill-cell + :desc "Insert below" "i" #'ein:worksheet-insert-cell-below + :desc "Insert above" "I" #'ein:worksheet-insert-cell-above + :desc "Goto next input" "j" #'ein:worksheet-goto-next-input + :desc "Goto prev input" "k" #'ein:worksheet-goto-prev-input + :desc "Move cell down" "J" #'ein:worksheet-move-cell-down + :desc "Move cell up" "K" #'ein:worksheet-move-cell-up + :desc "Change cell type" "u" #'ein:worksheet-change-cell-type + :desc "Toggle output" "t" #'ein:worksheet-toggle-output + :desc "Merge cell" "C-k" #'ein:worksheet-merge-cell + :desc "Merge cell next" "C-j" #'custom/ein:worksheet-merge-cell-next + :desc "Split cell" "s" #'ein:worksheet-split-cell-at-point + :desc "Execute cell and goto next" "RET" #'ein:worksheet-execute-cell-and-goto-next + ;; Output + :desc "Clear output" "C-l" #'ein:worksheet-clear-output + :desc "Clear all output" "C-S-l" #'ein:worksheet-clear-all-output + ;; Notebook + :desc "Rename sheet" "R" #'ein:worksheet-rename-sheet + :desc "Move prev" "H" #'ein:notebook-worksheet-move-prev + :desc "Move next" "L" #'ein:notebook-worksheet-move-next + :desc "Rename notebook" "C-r" #'ein:notebook-rename-command + :desc "Worksheet Delete" "-" #'ein:notebook-worksheet-delete + :desc "Close notebook" "x" #'ein:notebook-close + :desc "Save notebook command" "fs" #'ein:notebook-save-notebook-command + (:prefix ("e" . "Execute") + :desc "All cells" "a" #'ein:worksheet-execute-all-cells + :desc "All cells above" "K" #'ein:worksheet-execute-all-cells-above + :desc "All cells below" "J" #'ein:worksheet-execute-all-cells-below + :desc "Cell and go to next" "RET" #'ein:worksheet-execute-cell-and-goto-next + :desc "Cell and insert below" "j" #'ein:worksheet-execute-cell-and-insert-below ) + (:prefix ("o" . "Open") + :desc "Console" "c" #'ein:console-open + :desc "Prev or last" "h" #'ein:notebook-worksheet-open-prev-or-last + :desc "Next or first" "l" #'ein:notebook-worksheet-open-next-or-first + :desc "Insert next" "n" #'ein:notebook-worksheet-insert-next + :desc "1" "1" #'ein:notebook-worksheet-open-1th + :desc "2" "2" #'ein:notebook-worksheet-open-2th + :desc "3" "3" #'ein:notebook-worksheet-open-3th + :desc "4" "4" #'ein:notebook-worksheet-open-4th + :desc "5" "5" #'ein:notebook-worksheet-open-5th + :desc "6" "6" #'ein:notebook-worksheet-open-5th + :desc "7" "7" #'ein:notebook-worksheet-open-7th + :desc "8" "8" #'ein:notebook-worksheet-open-8th + :desc "last" "9" #'ein:notebook-worksheet-open-last + ) +) +(map! :after ein-multilang + :map ein:notebook-multilang-mode-map ; Minor mode + :prefix "C-c" + :desc "Execute cell" "RET" #'ein:worksheet-execute-cell + :desc "Execute cell and goto next" "" #'ein:worksheet-execute-cell-and-goto-next + :desc "Goto next input" "gj" 'ein:worksheet-goto-next-input + :desc "Goto prev input" "gk" 'ein:worksheet-goto-prev-input + :desc "Move cell down" "M-j" 'ein:worksheet-move-cell-down + :desc "Move cell up" "M-k" 'ein:worksheet-move-cell-up +) #+end_src diff --git a/home/doomemacs/init.el b/home/doomemacs/init.el index e3d7ab1..2eac0e6 100644 --- a/home/doomemacs/init.el +++ b/home/doomemacs/init.el @@ -146,7 +146,7 @@ ;;julia ; a better, faster MATLAB ;;kotlin ; a better, slicker Java(Script) (latex +latexmk +lsp) ; writing papers in Emacs has never been so fun - ;;lean ; for folks with too much to prove + lean ; for folks with too much to prove ledger ; be audit you can be ;;lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore @@ -184,7 +184,7 @@ :app calendar emms - everywhere ; *leave* Emacs!? You must be joking + ;;everywhere ; *leave* Emacs!? You must be joking ;;irc ; how neckbeards socialize ;;(rss +org) ; emacs as an RSS reader ;;twitter ; twitter client https://twitter.com/vnought