From b4c9e643280102b8a79635c1af1cc21c3c0fa2e1 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Thu, 18 Feb 2021 06:41:30 -0600 Subject: [PATCH] Adding ligatures and dired tweaks --- README.org | 46 +++++++++++++++++++++++++++++++++++++++++++++- early-init.el | 1 + init.el | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 833cdca4..c5002f0b 100644 --- a/README.org +++ b/README.org @@ -7,12 +7,14 @@ - [[#keep-folders-clean][Keep Folders Clean]] - [[#set-basic-ui-config][Set basic UI config]] - [[#lets-bootstrap-straightel][Let's bootstrap straight.el]] + - [[#ligatures][Ligatures]] - [[#keybindings][Keybindings]] - [[#undo-tree][Undo-Tree]] - [[#better-ui][Better UI]] - [[#completion][Completion]] - [[#help][Help]] - [[#format][Format]] + - [[#file-management][File Management]] - [[#org-mode][Org Mode]] - [[#magit][Magit]] - [[#pdf-tools][PDF-Tools]] @@ -40,7 +42,7 @@ Let's create a message that will tell us how long it takes emacs to load in orde #+end_src Let's also set the =gc-cons-threshold= variable to a high setting for the remainder of our setup process to speed things up. -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no (setq gc-cons-threshold 50000000) #+end_src ** Keep Folders Clean @@ -164,6 +166,37 @@ Also, real quick let's make sure that ~~ works as the same as ~~ :defer 1) #+end_src +** Ligatures +Here let's try to add ligatures to our font system since the VictorMono Nerd Font supports all ligatures being a "Nerd Font". +#+begin_src emacs-lisp +(let ((alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") + (?# . "\\(?:#\\(?:###?\\|_(\\|[!#(:=?[_{]\\)\\)") + (?$ . "\\(?:\\$>\\)") + (?& . "\\(?:&&&?\\)") + (?* . "\\(?:\\*\\(?:\\*\\*\\|[/>]\\)\\)") + (?+ . "\\(?:\\+\\(?:\\+\\+\\|[+>]\\)\\)") + (?- . "\\(?:-\\(?:-[>-]\\|<<\\|>>\\|[<>|~-]\\)\\)") + (?. . "\\(?:\\.\\(?:\\.[.<]\\|[.=?-]\\)\\)") + (?/ . "\\(?:/\\(?:\\*\\*\\|//\\|==\\|[*/=>]\\)\\)") + (?: . "\\(?::\\(?:::\\|\\?>\\|[:<-?]\\)\\)") + (?\; . "\\(?:;;\\)") + (?< . "\\(?:<\\(?:!--\\|\\$>\\|\\*>\\|\\+>\\|-[<>|]\\|/>\\|<[<=-]\\|=\\(?:=>\\|[<=>|]\\)\\||\\(?:||::=\\|[>|]\\)\\|~[>~]\\|[$*+/:<=>|~-]\\)\\)") + (?= . "\\(?:=\\(?:!=\\|/=\\|:=\\|=[=>]\\|>>\\|[=>]\\)\\)") + (?> . "\\(?:>\\(?:=>\\|>[=>-]\\|[]:=-]\\)\\)") + (?? . "\\(?:\\?[.:=?]\\)") + (?\[ . "\\(?:\\[\\(?:||]\\|[<|]\\)\\)") + (?\ . "\\(?:\\\\/?\\)") + (?\] . "\\(?:]#\\)") + (?^ . "\\(?:\\^=\\)") + (?_ . "\\(?:_\\(?:|?_\\)\\)") + (?{ . "\\(?:{|\\)") + (?| . "\\(?:|\\(?:->\\|=>\\||\\(?:|>\\|[=>-]\\)\\|[]=>|}-]\\)\\)") + (?~ . "\\(?:~\\(?:~>\\|[=>@~-]\\)\\)")))) + (dolist (char-regexp alist) + (set-char-table-range composition-function-table (car char-regexp) + `([,(cdr char-regexp) 0 font-shape-gstring])))) +#+end_src + ** Keybindings There are two major packages we need to get the functionality I desire. Evil and general. #+begin_src emacs-lisp @@ -407,6 +440,16 @@ Marginalia makes for some great decoration to our minibuffer completion items. W (setq format-all-formatters '("Emacs Lisp" emacs-lisp)) :defer 1) #+end_src +** File Management +*** Dired +#+begin_src emacs-lisp +(chris/leader-keys + "od" '(dired-jump :which-key "open dired here")) +(general-def 'normal dired-mode-map + "h" 'dired-up-directory + "l" 'dired-find-file + "q" 'kill-this-buffer) +#+end_src ** Org Mode Let's start by creating a self contained function of what I'd like started on every org buffer. @@ -628,6 +671,7 @@ As of right now I haven't fully setup my early-init file, this does not export i ;; threshold to temporarily prevent it from running, then reset it later by ;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes. (setq gc-cons-threshold 50000000) +(message "set gc-cons-threshold to 50000000") ;; ;; In noninteractive sessions, prioritize non-byte-compiled source files to ;; ;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time diff --git a/early-init.el b/early-init.el index cdeca727..fd99b6ec 100644 --- a/early-init.el +++ b/early-init.el @@ -7,6 +7,7 @@ ;; threshold to temporarily prevent it from running, then reset it later by ;; enabling `gcmh-mode'. Not resetting it will cause stuttering/freezes. (setq gc-cons-threshold 50000000) +(message "set gc-cons-threshold to 50000000") ;; ;; In noninteractive sessions, prioritize non-byte-compiled source files to ;; ;; prevent the use of stale byte-code. Otherwise, it saves us a little IO time diff --git a/init.el b/init.el index 6e7d0ae8..dac6121a 100644 --- a/init.el +++ b/init.el @@ -7,8 +7,6 @@ gcs-done)) (add-hook 'emacs-startup-hook #'chris/display-startup-time) -(setq gc-cons-threshold 50000000) - (setq inhibit-startup-message t) (scroll-bar-mode -1) @@ -83,6 +81,33 @@ (which-key-mode) :defer 1) +(let ((alist '((?! . "\\(?:!\\(?:==\\|[!=]\\)\\)") + (?# . "\\(?:#\\(?:###?\\|_(\\|[!#(:=?[_{]\\)\\)") + (?$ . "\\(?:\\$>\\)") + (?& . "\\(?:&&&?\\)") + (?* . "\\(?:\\*\\(?:\\*\\*\\|[/>]\\)\\)") + (?+ . "\\(?:\\+\\(?:\\+\\+\\|[+>]\\)\\)") + (?- . "\\(?:-\\(?:-[>-]\\|<<\\|>>\\|[<>|~-]\\)\\)") + (?. . "\\(?:\\.\\(?:\\.[.<]\\|[.=?-]\\)\\)") + (?/ . "\\(?:/\\(?:\\*\\*\\|//\\|==\\|[*/=>]\\)\\)") + (?: . "\\(?::\\(?:::\\|\\?>\\|[:<-?]\\)\\)") + (?\; . "\\(?:;;\\)") + (?< . "\\(?:<\\(?:!--\\|\\$>\\|\\*>\\|\\+>\\|-[<>|]\\|/>\\|<[<=-]\\|=\\(?:=>\\|[<=>|]\\)\\||\\(?:||::=\\|[>|]\\)\\|~[>~]\\|[$*+/:<=>|~-]\\)\\)") + (?= . "\\(?:=\\(?:!=\\|/=\\|:=\\|=[=>]\\|>>\\|[=>]\\)\\)") + (?> . "\\(?:>\\(?:=>\\|>[=>-]\\|[]:=-]\\)\\)") + (?? . "\\(?:\\?[.:=?]\\)") + (?\[ . "\\(?:\\[\\(?:||]\\|[<|]\\)\\)") + (?\ . "\\(?:\\\\/?\\)") + (?\] . "\\(?:]#\\)") + (?^ . "\\(?:\\^=\\)") + (?_ . "\\(?:_\\(?:|?_\\)\\)") + (?{ . "\\(?:{|\\)") + (?| . "\\(?:|\\(?:->\\|=>\\||\\(?:|>\\|[=>-]\\)\\|[]=>|}-]\\)\\)") + (?~ . "\\(?:~\\(?:~>\\|[=>@~-]\\)\\)")))) + (dolist (char-regexp alist) + (set-char-table-range composition-function-table (car char-regexp) + `([,(cdr char-regexp) 0 font-shape-gstring])))) + (use-package evil :init (setq evil-want-integration t @@ -213,6 +238,13 @@ (setq format-all-formatters '("Emacs Lisp" emacs-lisp)) :defer 1) +(chris/leader-keys + "od" '(dired-jump :which-key "open dired here")) +(general-def 'normal dired-mode-map + "h" 'dired-up-directory + "l" 'dired-find-file + "q" 'kill-this-buffer) + (defun chris/org-mode-setup () (org-indent-mode +1) (toc-org-mode +1)