From dc743e2046c9e5d6354644adc842da1cde6546f8 Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Fri, 1 Dec 2023 15:53:48 +0100 Subject: Reviewed keyboard shortcuts; converging back to Emacs defaults... --- smart-documents.org | 65 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/smart-documents.org b/smart-documents.org index 28f8ac7..ea29855 100644 --- a/smart-documents.org +++ b/smart-documents.org @@ -407,7 +407,7 @@ ignored by =git= by default. * Keyboard shortcuts What follows are the most useful keybindings, as well as the -keybindings to the functions we defined ourselves. It doesn't matter +keybindings to the functions we defined ourselves. It doesn't matter if we haven't defined the functions themselves yet; Emacs will accept a keybinding for any symbol and does not check if the symbol's function definition exists, until the keybinding is pressed. @@ -426,22 +426,28 @@ shortcuts.] ** Files -*** Save a file +*** COMMENT Save a file + +# This is made redundant by C-x C-s. #+BEGIN_SRC emacs-lisp :tangle yes (global-set-key (kbd "C-s") 'save-buffer) #+END_SRC -*** Open a file +*** COMMENT Open a file + +# This is made redundant by C-x C-f. #+BEGIN_SRC emacs-lisp :tangle yes - (global-set-key (kbd "C-o") 'find-file) + (global-set-key (kbd "C-c o") 'find-file) #+END_SRC -*** List open files +*** COMMENT List open files + +# This is made redundant by C-x b. #+BEGIN_SRC emacs-lisp :tangle yes - (global-set-key (kbd "C-b") 'ivy-switch-buffer) + (global-set-key (kbd "C-c b") 'ivy-switch-buffer) #+END_SRC *** Open this very file @@ -501,7 +507,9 @@ shortcuts.] ** Windows -*** Close window and quit +*** COMMENT Close window and quit +# When considering key chord usage frequency, Emacs default +# keybindings make more sense every passing day. The following bindings lead to more natural window & frame exit behaviors. @@ -515,7 +523,7 @@ The following bindings lead to more natural window & frame exit behaviors. *** Make new frame #+BEGIN_SRC emacs-lisp :tangle yes - (global-set-key (kbd "C-n") 'make-frame) + (global-set-key (kbd "C-c n") 'make-frame) #+END_SRC *** Make only frame @@ -567,8 +575,8 @@ It seems that starting with Emacs 27.1, Control + mousewheel works. ** TODO COMMENT Navigation # [2021-09-13 Mon] # -# Kinda don't like this... This is some more text. And then some. And -# then some. +# Kinda don't like this... This is some more text. And then some. +# And then some. =Alt= (=Meta=) is the privileged key for motion in a buffer. It is followed by an optional numerical argument, and a movement @@ -640,9 +648,10 @@ We prevent Org mode from overriding preferred navigation keys. ** One-click workflows -A major advantage of the Emacs document production system: arbitrarily -complicated functions can be assigned to very simple keybindings. This -means we can automate workflows up to a pretty absurd level. +A major advantage of Emacs is the following: arbitrarily complicated +workflows can be described by a series of functions assigned to a +single keybinding. This means we can build automations to a pretty +absurd level. *** Export to PDF @@ -652,7 +661,7 @@ documents. **** Document #+BEGIN_SRC emacs-lisp :tangle yes - (global-set-key (kbd "C-p") 'sd-quick-export) + (global-set-key (kbd "C-c p") 'sd-quick-export) #+END_SRC **** TODO Presentation @@ -669,6 +678,12 @@ Clean up buffer in every mode. (global-set-key [f12] 'sd-beautify-buffer) #+END_SRC +*** Smart compilation + +#+BEGIN_SRC emacs-lisp :tangle yes + (global-set-key (kbd "C-c m") 'sd-smart-compile) +#+END_SRC + * Packages @@ -728,18 +743,19 @@ This is the 2^{nd} most significant customization after keys.[fn::For more information on =vi= keybindings, visit [[https://hea-www.harvard.edu/~fine/Tech/vi.html]].] -#+BEGIN_SRC emacs-lisp :tangle yes +#+BEGIN_SRC emacs-lisp :tangle no (use-package evil) (setq evil-toggle-key "C-c d") (evil-mode 1) #+END_SRC -** Spelling, completion, and snippets + +* Spelling, completion, and snippets The following customizations open the doors to vastly increased typing speed and accuracy. -*** Syntax checking +** Syntax checking We require a package to highlight syntax errors and warnings. The ~flycheck~ package ensures we are aware of all our code's syntactical @@ -751,22 +767,22 @@ shortcomings. (global-flycheck-mode) #+END_SRC -*** Spelling +** Spelling #+NAME: flyspell -#+BEGIN_SRC emacs-lisp :tangle yes +#+BEGIN_SRC emacs-lisp :tangle no (use-package flyspell) (add-hook 'text-mode-hook 'flyspell-mode) #+END_SRC -*** Completion +** Completion -#+BEGIN_SRC emacs-lisp :tangle yes +#+BEGIN_SRC emacs-lisp :tangle no (use-package company) (add-hook 'after-init-hook 'global-company-mode) #+END_SRC -*** Insert template from keyword +** Insert template from keyword Thanks to ~yasnippet~, we can type certain keywords, then press =TAB=, to automatically insert a predefined text snippet. We can then @@ -791,7 +807,7 @@ modifiable field. Many clever programming tricks can be performed with (yas-global-mode 1) #+END_SRC -*** Delete all consecutive whitespaces +** Delete all consecutive whitespaces #+NAME: hungry-delete #+BEGIN_SRC emacs-lisp :tangle yes @@ -876,7 +892,7 @@ Everlasting Father, Prince of Peace. #+BEGIN_SRC emacs-lisp :tangle yes (use-package swiper - :bind (("C-f" . swiper))) + :bind (("C-c f" . swiper))) #+END_SRC *** COMMENT Web browsing @@ -1401,7 +1417,6 @@ being executed by the Org Babel backend upon document export. (ocaml . t))) #+END_SRC - ** Exporting {{{SDs}}} *** LaTeX export -- cgit v1.2.3