Add more documentation in config

This commit is contained in:
2024-10-01 15:36:58 +01:00
parent 2d8bc9f6f5
commit 5ebdd91d33

View File

@@ -350,7 +350,8 @@ Configure the blinking cursor.
** Mode line ** Mode line
The mode line is the little bar at the bottom of the buffer, just The mode line is the little bar at the bottom of the buffer, just
above the minibuffer. It can store essentially any text, but above the minibuffer. It can store essentially any text, but
generally details about the current buffer (such as name, major mode, ) is placed there. generally details about the current buffer (such as name, major mode,
etc) is placed there.
The default mode-line is... disgusting. It displays information in an The default mode-line is... disgusting. It displays information in an
unintelligible format and seems to smash together a bunch of unintelligible format and seems to smash together a bunch of
@@ -438,10 +439,12 @@ Who uses a mouse? This disables the use of GUI dialogues for stuff.
use-dialog-box nil) use-dialog-box nil)
#+end_src #+end_src
** Scrolling ** Scrolling
Emacs can automatically scroll the buffer depending on how many lines When scrolling, editors generally try to keep the cursor on screen.
the cursor is away from the limits of the window. Here I set the Emacs has some variables which ensure the cursor is a certain number
margin to 8 (so it'll start correcting at 8) and scroll-conservatively of lines above the bottom of the screen and below the top of the
to the same value so it'll keep the cursor centred. screen when scrolling. Here I set the margin to 8 (so it'll start
correcting at 8) and scroll-conservatively to the same value so it'll
keep the cursor centred.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package emacs (use-package emacs
@@ -450,23 +453,23 @@ to the same value so it'll keep the cursor centred.
scroll-margin 8)) scroll-margin 8))
#+end_src #+end_src
* Core packages * Core packages
For my core packages, whose configuration doesn't change much anyway, Core packages required when configuring the other stuff.
** General - Bindings package ** General - Bindings package
Vanilla Emacs has the ~bind-key~ function (and the ~bind-key*~ macro) Vanilla Emacs has the ~bind-key~ function (and the ~bind-key*~ macro)
for this, but [[*Evil][Evil]] has it's own ~evil-define-key~. I'd for this, but [[*Evil][Evil]] has it's own ~evil-define-key~. I'd
like a unified interface for using both, hence I use =general=. like a unified interface for using both, which is why I use =general=.
General provides a set of very useful macros for defining keys for a General provides a set of very useful macros for defining keys in a
variety of different situations. One may redefine any key in any variety of different situations. One may redefine any key in any
keymap, bind over different Evil states, add =which-key= keymap, bind over different Evil states, add =which-key=
documentation, create so-called "definers" which act as wrapper macros documentation, create so-called "definers" which act as wrapper macros
over some pre-defined configuration, etc. over some pre-defined configuration, etc, all at the same time.
Here I setup the rough outline of how bindings should be made at the Here I setup the rough outline of how bindings should be made in the
global scope, namely: global scope, namely:
+ Use "SPC" as a "leader", the root of all major bindings + Use "SPC" as a "leader", the root of all general bindings
+ Use "\" as a local-leader, the root of all mode-specific bindings + Use "\" as a local-leader, the root of all major mode specific
+ A ton of "definers" for the different sub bindings for the leader bindings
key + A few "definers" for the different sub bindings for the leader key
+ ~nmmap~ macro, for defining keys under both normal and motion + ~nmmap~ macro, for defining keys under both normal and motion
states. states.
@@ -565,7 +568,9 @@ global scope, namely:
#+end_src #+end_src
*** Some binds for Emacs *** Some binds for Emacs
Here are some bindings for Emacs using general and the definers Here are some bindings for Emacs using general and the definers
created previously. This should be relatively easy to understand. created previously. Here I bind stuff I don't care to make a separate
heading for, so it serves as both a dumping ground and as a great
set of examples on how to use general.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package emacs (use-package emacs
@@ -619,9 +624,7 @@ created previously. This should be relatively easy to understand.
"q" #'save-buffers-kill-terminal "q" #'save-buffers-kill-terminal
"c" #'+literate/compile-config "c" #'+literate/compile-config
"C" #'+literate/clean-config "C" #'+literate/clean-config
"l" #'+literate/load-config) "l" #'+literate/load-config))
(search-leader "i" #'imenu))
#+end_src #+end_src
** Evil - Vim emulation ** Evil - Vim emulation
My editor journey started off with Vim rather than Emacs, so my brain My editor journey started off with Vim rather than Emacs, so my brain
@@ -926,10 +929,8 @@ later instances.
(use-package consult (use-package consult
:straight t :straight t
:general :general
(general-def
:keymaps 'override
[remap imenu] #'consult-imenu)
(search-leader (search-leader
"i" #'consult-imenu
"s" #'consult-line)) "s" #'consult-line))
#+end_src #+end_src
*** Amx *** Amx
@@ -2315,10 +2316,10 @@ Emacs.
Standard packages and configurations for text-mode and its derived Standard packages and configurations for text-mode and its derived
modes. modes.
** Flyspell ** Flyspell
Flyspell allows me to quickly spell check text documents. I use Flyspell allows me to spell check text documents. I use it primarily
flyspell primarily in org mode, as that is my preferred prose writing in org mode, as that is my preferred prose writing software, but I
software, but I also need it in commit messages and so on. So also need it in commit messages and so on, thus it should really hook
flyspell-mode should be hooked to text-mode. into text-mode.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package flyspell (use-package flyspell
@@ -2333,11 +2334,11 @@ flyspell-mode should be hooked to text-mode.
"s" #'flyspell-mode)) "s" #'flyspell-mode))
#+end_src #+end_src
** Undo tree ** Undo tree
Undo tree sits on top of the incredible Emacs undo capabilities. Undo tree sits on top of Emacs' undo capabilities. It provides a nice
Provides a nice visual for edits and a great way to produce branches visual for the history of a buffer and is a great way to produce
of edits. Also allows saving of undo trees, which makes Emacs a quasi branches of edits. This history may be saved to and loaded from the
version control system in and of itself! The only extra necessary disk, which makes Emacs a quasi version control system in and of
would be describing changes... itself. The only feature left is describing changes...
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package undo-tree (use-package undo-tree