(Emacs)~formatting and minor edits for clarity and such

This commit is contained in:
2021-03-23 20:47:16 +00:00
parent b7ebd4b577
commit dabe7c2310

View File

@@ -121,7 +121,7 @@ declared seperator won't be applied when placed at the end of a module
string. string.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defconst +modeline/reserved-chars (list "[" "(") (defconst +modeline/reserved-chars (list "[" "(")
"Characters that, when at the end of a module string, won't have the separator applied to them.") "Characters that, when at the end of a module string, won't have the separator applied to them.")
#+end_src #+end_src
Now declare a function that applies the separator with respect to the Now declare a function that applies the separator with respect to the
@@ -141,19 +141,19 @@ Finally, set the mode-line-format.
(setq-default (setq-default
mode-line-format mode-line-format
(mapcar #'+modeline/handle-string (mapcar #'+modeline/handle-string
(list "%l:%c" (list "%l:%c"
"%p[" "%p["
'(:eval (upcase '(:eval (upcase
(substring (substring
(format "%s" (if (bound-and-true-p evil-state) evil-state "")) (format "%s" (if (bound-and-true-p evil-state) evil-state ""))
0 1))) 0 1)))
"]" "]"
"%+%b(" "%+%b("
'(:eval (format "%s" major-mode)) '(:eval (format "%s" major-mode))
")" ")"
"%I" "%I"
vc-mode vc-mode
mode-line-end-spaces))) mode-line-end-spaces)))
#+end_src #+end_src
* Custom Functions * Custom Functions
These are custom functions I have defined for various purposes. These are custom functions I have defined for various purposes.
@@ -345,7 +345,12 @@ greater functionality from vi to Emacs. Surround, commenting,
multiple cursors and further support to other packages are configured multiple cursors and further support to other packages are configured
here. here.
*** Evil Core *** Evil Core
Setup the evil package, with some basic keybinds. Setup the evil package, with some opinionated keybindings:
- Switch =evil-upcase= and =evil-downcase= cos I'd rather have the
non-capital one be upcase due to how much I use it
- Switch =evil-goto-mark= and =evil-goto-mark-line= as I'd rather have
the global one closer to the home row
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package evil (use-package evil
:hook (after-init-hook . evil-mode) :hook (after-init-hook . evil-mode)
@@ -372,8 +377,7 @@ Setup the evil package, with some basic keybinds.
evil-vsplit-window-right t evil-vsplit-window-right t
evil-want-abbrev-expand-on-insert-exit t) evil-want-abbrev-expand-on-insert-exit t)
:config :config
(fset #'evil-window-vsplit #'make-frame) (fset #'evil-window-vsplit #'make-frame))
(evil-mode))
#+end_src #+end_src
*** Evil surround *** Evil surround
#+begin_src emacs-lisp #+begin_src emacs-lisp
@@ -490,7 +494,7 @@ similarly to a fully fledged completion framework.
completion-styles '(flex partial-completion intials emacs22)) completion-styles '(flex partial-completion intials emacs22))
(setq-default ido-enable-flex-matching t (setq-default ido-enable-flex-matching t
ido-enable-dot-prefix t ido-enable-dot-prefix t
ido-enable-regexp nil) ido-enable-regexp nil)
:config :config
(ido-mode) (ido-mode)
(ido-everywhere)) (ido-everywhere))
@@ -812,19 +816,19 @@ when expansion is a function."
(format-time-string "%Y-%m-%d" (current-time))) (format-time-string "%Y-%m-%d" (current-time)))
(+autotyping/deff-abbrev (+autotyping/deff-abbrev
global-abbrev-table global-abbrev-table
"stme" "stme"
(format-time-string "%H:%M:%S" (current-time))) (format-time-string "%H:%M:%S" (current-time)))
(+autotyping/deff-abbrev (+autotyping/deff-abbrev
text-mode-abbrev-table text-mode-abbrev-table
"sday" "sday"
(format-time-string "%A" (current-time))) (format-time-string "%A" (current-time)))
(+autotyping/deff-abbrev (+autotyping/deff-abbrev
text-mode-abbrev-table text-mode-abbrev-table
"smon" "smon"
(format-time-string "%B" (current-time)))) (format-time-string "%B" (current-time))))
#+end_src #+end_src
*** Skeletons *** Skeletons
Defining some basic skeletons and a macro to help generate an abbrev Defining some basic skeletons and a macro to help generate an abbrev
@@ -886,7 +890,7 @@ Collection of snippets, activate after yasnippet has been loaded.
:straight nil :straight nil
:general :general
(:keymaps 'isearch-mode-map (:keymaps 'isearch-mode-map
d "M-s" #'isearch-repeat-forward)) "M-s" #'isearch-repeat-forward))
#+end_src #+end_src
** Display line numbers ** Display line numbers
I don't like using this mode by default, but I'd like to configure it I don't like using this mode by default, but I'd like to configure it
@@ -1158,7 +1162,7 @@ calendar to the kill ring.
:states '(normal motion) :states '(normal motion)
"Y" #'+calendar/copy-date) "Y" #'+calendar/copy-date)
(leader (leader
"ad" #'+calendar/toggle-calendar) "ad" #'+calendar/toggle-calendar)
:config :config
(defun +calendar/copy-date () (defun +calendar/copy-date ()
"Copy date under cursor into kill ring." "Copy date under cursor into kill ring."
@@ -1293,9 +1297,9 @@ user wants to open current file. Bind it to =aU= in the leader.
(interactive) (interactive)
(cond (cond
((and (not FORCE) (or (string= (replace-regexp-in-string ".*.html" ((and (not FORCE) (or (string= (replace-regexp-in-string ".*.html"
"html" (buffer-name)) "html") "html" (buffer-name)) "html")
(eq major-mode 'web-mode) (eq major-mode 'web-mode)
(eq major-mode 'html-mode))) ; If in html file (eq major-mode 'html-mode))) ; If in html file
(if (y-or-n-p "Open current file?: ") ; Maybe they want to open a separate file (if (y-or-n-p "Open current file?: ") ; Maybe they want to open a separate file
(xwidget-webkit-browse-url (format "file://%s" (buffer-file-name))) (xwidget-webkit-browse-url (format "file://%s" (buffer-file-name)))
(+xwidget/render-file t))) ; recurse and open file via prompt (+xwidget/render-file t))) ; recurse and open file via prompt
@@ -1544,7 +1548,7 @@ work for me given the various TeX utilities installed via Arch.
#+end_src #+end_src
* Major modes, programming and text * Major modes, programming and text
Setups for common major modes and languages. Setups for common major modes and languages.
** General Text Configuration ** Text Configuration
Standard packages and configurations for the text-mode. These Standard packages and configurations for the text-mode. These
configurations are usually further placed on configurations are usually further placed on
*** Flyspell *** Flyspell
@@ -1616,7 +1620,7 @@ Show parenthesis for Emacs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'prog-mode-hook #'show-paren-mode) (add-hook 'prog-mode-hook #'show-paren-mode)
#+end_src #+end_src
** General Programming Configuration ** Programming Configuration
*** Eldoc *** Eldoc
Eldoc presents documentation to the user upon placing ones cursor upon Eldoc presents documentation to the user upon placing ones cursor upon
any symbol. This is very useful when programming as it: any symbol. This is very useful when programming as it:
@@ -1770,9 +1774,9 @@ This mode just colourises stuff, and uses eglot to do the heavy
lifting. lifting.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(load-file (concat user-emacs-directory "ada-mode.el")) (load-file (concat user-emacs-directory "ada-mode.el"))
(with-eval-after-load "eglot" (with-eval-after-load "eglot"
(add-hook 'ada-mode-hook #'eglot)) (add-hook 'ada-mode-hook #'eglot))
#+end_src #+end_src
** NHexl ** NHexl
Hexl-mode is the inbuilt package within Emacs to edit hex and binary Hexl-mode is the inbuilt package within Emacs to edit hex and binary
@@ -1861,7 +1865,7 @@ vanilla =org-goto=. Also records for auto insertion.
(define-auto-insert '("\\.org\\'" . "Org skeleton") (define-auto-insert '("\\.org\\'" . "Org skeleton")
'("Enter title: " '("Enter title: "
"#+title: " str | (buffer-file-name) "\n" "#+title: " str | (buffer-file-name) "\n"
"#+author: " user-full-name "\n" "#+author: " (read-string "Enter author: ") | user-full-name "\n"
"#+description: " (read-string "Enter description: ") | "Description" "\n" "#+description: " (read-string "Enter description: ") | "Description" "\n"
"#+options: toc:nil\n\n" "#+options: toc:nil\n\n"
"#+begin_center\n" "#+begin_center\n"
@@ -2043,14 +2047,14 @@ opposing style.
(with-eval-after-load "autoinsert" (with-eval-after-load "autoinsert"
(define-auto-insert (define-auto-insert
'("\\.c\\'" . "C skeleton") '("\\.c\\'" . "C skeleton")
'("" '(""
"/* " (file-name-nondirectory (buffer-file-name (current-buffer))) "\n" "/* " (file-name-nondirectory (buffer-file-name (current-buffer))) "\n"
" * Date: " (format-time-string "%Y-%m-%d") "\n" " * Date: " (format-time-string "%Y-%m-%d") "\n"
" * Author: " user-full-name "\n" " * Author: " user-full-name "\n"
" */\n" " */\n"
"\n" "\n"
"\n" "\n"
_)) _))
(define-auto-insert (define-auto-insert
'("\\.cpp\\'" . "C++ skeleton") '("\\.cpp\\'" . "C++ skeleton")