From 6bddd33f52e85a617f716b60233d692d92de87c4 Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Fri, 18 Aug 2023 15:20:42 -0500 Subject: [PATCH] Minor changes --- .config/emacs/config.el | 43 ++++++++++++++++++-- .config/emacs/config.org | 56 ++++++++++++++++++++++++-- .config/emacs/scripts/app-launchers.el | 4 +- 3 files changed, 95 insertions(+), 8 deletions(-) diff --git a/.config/emacs/config.el b/.config/emacs/config.el index fecc53f..8181694 100644 --- a/.config/emacs/config.el +++ b/.config/emacs/config.el @@ -141,7 +141,9 @@ (dt/leader-keys "SPC" '(counsel-M-x :wk "Counsel M-x") "." '(find-file :wk "Find file") - "TAB TAB" '(comment-line :wk "Comment lines")) + "=" '(perspective-map :wk "Perspective") ;; Lists all the perspective keybindings + "TAB TAB" '(comment-line :wk "Comment lines") + "u" '(universal-argument :wk "Universal argument")) (dt/leader-keys "b" '(:ignore t :wk "Bookmarks/Buffers") @@ -183,8 +185,17 @@ (dt/leader-keys "f" '(:ignore t :wk "Files") - "f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Open emacs config") - "f e" '((lambda () (interactive) (dired "~/.config/emacs/")) :wk "Open file in user-emacs-directory") + "f c" '((lambda () (interactive) + (find-file "~/.config/emacs/config.org")) + :wk "Open emacs config.org") + "f e" '((lambda () (interactive) + (dired "~/.config/emacs/")) + :wk "Open user-emacs-directory in dired") + "f d" '(find-grep-dired :wk "Search for string in files in DIR") + "f g" '(counsel-grep-or-swiper :wk "Search for string current file") + "f i" '((lambda () (interactive) + (find-file "~/.config/emacs/init.el")) + :wk "Open emacs init.el") "f j" '(counsel-file-jump :wk "Jump to a file below current directory") "f l" '(counsel-locate :wk "Locate a file") "f r" '(counsel-recentf :wk "Find recent files") @@ -277,6 +288,13 @@ (dt/leader-keys "p" '(projectile-command-map :wk "Projectile")) + (dt/leader-keys + "s" '(:ignore t :wk "Search") + "s d" '(dictionary-search :wk "Search dictionary") + "s m" '(man :wk "Man pages") + "s t" '(tldr :wk "Lookup TLDR docs for a command") + "s w" '(woman :wk "Similar to man but doesn't require man")) + (dt/leader-keys "t" '(:ignore t :wk "Toggle") "t e" '(eshell-toggle :wk "Toggle eshell") @@ -416,6 +434,23 @@ (require 'org-tempo) +(use-package perspective + :init + (persp-mode) + :config + ;; Sets a file to write to when we save states + (setq persp-state-default-file "~/.config/emacs/sessions")) + +;; This will group buffers by persp-name in ibuffer. +(add-hook 'ibuffer-hook + (lambda () + (persp-ibuffer-set-filter-groups) + (unless (eq ibuffer-sorting-mode 'alphabetic) + (ibuffer-do-sort-by-alphabetic)))) + +;; Automatically save perspective states to file when Emacs exits. +(add-hook 'kill-emacs-hook #'persp-state-save) + (use-package projectile :config (projectile-mode 1)) @@ -494,6 +529,8 @@ ;; Corrects (and improves) org-mode's native fontification. (doom-themes-org-config)) +(use-package tldr) + (add-to-list 'default-frame-alist '(alpha-background . 100)) ; For all new frames henceforth (use-package which-key diff --git a/.config/emacs/config.org b/.config/emacs/config.org index 8c83ca8..4d04f81 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -39,6 +39,7 @@ - [[#diminish-org-indent-mode][Diminish Org Indent Mode]] - [[#org-level-headers][Org Level Headers]] - [[#source-code-block-tag-expansion][Source Code Block Tag Expansion]] +- [[#perspective][PERSPECTIVE]] - [[#projectile][PROJECTILE]] - [[#rainbow-mode][RAINBOW MODE]] - [[#shells-and-terminals][SHELLS AND TERMINALS]] @@ -47,6 +48,7 @@ - [[#vterm-toggle][Vterm-Toggle]] - [[#sudo-edit][SUDO EDIT]] - [[#theme][THEME]] +- [[#tldr][TLDR]] - [[#transparency][TRANSPARENCY]] - [[#which-key][WHICH-KEY]] @@ -265,7 +267,9 @@ You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTR (dt/leader-keys "SPC" '(counsel-M-x :wk "Counsel M-x") "." '(find-file :wk "Find file") - "TAB TAB" '(comment-line :wk "Comment lines")) + "=" '(perspective-map :wk "Perspective") ;; Lists all the perspective keybindings + "TAB TAB" '(comment-line :wk "Comment lines") + "u" '(universal-argument :wk "Universal argument")) (dt/leader-keys "b" '(:ignore t :wk "Bookmarks/Buffers") @@ -307,8 +311,17 @@ You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTR (dt/leader-keys "f" '(:ignore t :wk "Files") - "f c" '((lambda () (interactive) (find-file "~/.config/emacs/config.org")) :wk "Open emacs config") - "f e" '((lambda () (interactive) (dired "~/.config/emacs/")) :wk "Open file in user-emacs-directory") + "f c" '((lambda () (interactive) + (find-file "~/.config/emacs/config.org")) + :wk "Open emacs config.org") + "f e" '((lambda () (interactive) + (dired "~/.config/emacs/")) + :wk "Open user-emacs-directory in dired") + "f d" '(find-grep-dired :wk "Search for string in files in DIR") + "f g" '(counsel-grep-or-swiper :wk "Search for string current file") + "f i" '((lambda () (interactive) + (find-file "~/.config/emacs/init.el")) + :wk "Open emacs init.el") "f j" '(counsel-file-jump :wk "Jump to a file below current directory") "f l" '(counsel-locate :wk "Locate a file") "f r" '(counsel-recentf :wk "Find recent files") @@ -401,6 +414,13 @@ You can use the bindings CTRL plus =/- for zooming in/out. You can also use CTR (dt/leader-keys "p" '(projectile-command-map :wk "Projectile")) + (dt/leader-keys + "s" '(:ignore t :wk "Search") + "s d" '(dictionary-search :wk "Search dictionary") + "s m" '(man :wk "Man pages") + "s t" '(tldr :wk "Lookup TLDR docs for a command") + "s w" '(woman :wk "Similar to man but doesn't require man")) + (dt/leader-keys "t" '(:ignore t :wk "Toggle") "t e" '(eshell-toggle :wk "Toggle eshell") @@ -641,6 +661,29 @@ Org-tempo is not a separate package but a module within org that can be enabled. (require 'org-tempo) #+end_src +* PERSPECTIVE +[[https://github.com/nex3/perspective-el][Perspective]] provides multiple named workspaces (or "perspectives") in Emacs, similar to multiple desktops in window managers. Each perspective has its own buffer list and its own window layout, along with some other isolated niceties, like the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html][xref]] ring. + +#+begin_src emacs-lisp +(use-package perspective + :init + (persp-mode) + :config + ;; Sets a file to write to when we save states + (setq persp-state-default-file "~/.config/emacs/sessions")) + +;; This will group buffers by persp-name in ibuffer. +(add-hook 'ibuffer-hook + (lambda () + (persp-ibuffer-set-filter-groups) + (unless (eq ibuffer-sorting-mode 'alphabetic) + (ibuffer-do-sort-by-alphabetic)))) + +;; Automatically save perspective states to file when Emacs exits. +(add-hook 'kill-emacs-hook #'persp-state-save) + +#+end_src + * PROJECTILE [[https://github.com/bbatsov/projectile][Projectile]] is a project interaction library for Emacs. It should be noted that many projectile commands do not work if you have set "fish" as the "shell-file-name" for Emacs. I had initially set "fish" as the "shell-file-name" in the Vterm section of this config, but oddly enough I changed it to "bin/sh" and projectile now works as expected, and Vterm still uses "fish" because my default user "sh" on my Linux system is "fish". @@ -758,6 +801,13 @@ The first line below designates the directory where will place all of our custom (doom-themes-org-config)) #+end_src +* TLDR + +#+begin_src emacs-lisp +(use-package tldr) + +#+end_src + * TRANSPARENCY With Emacs version 29, true transparency has been added. I have turned transparency off by setting the alpha to '100'. If you want some slight transparency, try setting alpha to '90'. Of course, if you set alpha to '0', the background of Emacs would completely transparent. diff --git a/.config/emacs/scripts/app-launchers.el b/.config/emacs/scripts/app-launchers.el index 327079c..c290791 100644 --- a/.config/emacs/scripts/app-launchers.el +++ b/.config/emacs/scripts/app-launchers.el @@ -5,7 +5,7 @@ ;; Counsel-Linux-App ;; Since we have counsel installed, we can use 'counsel-linux-app' to launch our Linux apps. It list the apps by their executable command, so it's kind of tricky to use. -(defun emacs-counsel-launcher () +(defun dt/emacs-counsel-launcher () "Create and select a frame called emacs-counsel-launcher which consists only of a minibuffer and has specific dimensions. Runs counsel-linux-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited" (interactive) (with-selected-frame @@ -32,7 +32,7 @@ ;; create a global keyboard shortcut with the following code ;; emacsclient -cF "((visibility . nil))" -e "(emacs-run-launcher)" -(defun emacs-run-launcher () +(defun dt/emacs-run-launcher () "Create and select a frame called emacs-run-launcher which consists only of a minibuffer and has specific dimensions. Runs app-launcher-run-app on that frame, which is an emacs command that prompts you to select an app and open it in a dmenu like behaviour. Delete the frame after that command has exited" (interactive) (with-selected-frame