Keep the zsh history focused to a single project at a time

This commit is contained in:
Howard Abrams 2025-10-23 17:12:33 -07:00
parent fe720dfddf
commit 05e0fbae40
3 changed files with 28 additions and 8 deletions

View file

@ -1035,6 +1035,7 @@ And some shortcut keys from the =general= project:
"<tab> <tab>" '("switch" . tab-switch)
"<tab> p" '("new project" . ha-tab-bar-new-project)
"<tab> n" '("new space" . ha-tab-bar-new)
"<tab> u" '("update names" . ha-tab-bar-update-names)
"<tab> d" '("delete space" . ha-tab-bar-delete))
(global-set-key (kbd "s-C-t") 'ha-tab-bar-new)
@ -1050,6 +1051,7 @@ I want to quickly jump, by the number shown on the tab, to that grouping. The fo
(defun ha-tab-bar-update-names ()
"Create normal-mode keybindings for the tab groupings.
This creates `SPC TAB 1' to jump to the first tab, etc."
(interactive)
;; Remove all previously created keybindings:
(ignore-errors
(dolist (indx (number-sequence 1 9))
@ -1108,14 +1110,14 @@ Also, as [[https://www.bytedude.com/gpg-in-emacs/][bytedude]] mentions, I need t
:config
(setenv "GPG_AGENT_INFO" nil)
(epa-file-enable))
(ignore-error (epa-file-enable)))
#+end_src
Since I already (at this point in my file) have Org installed and running, the following code configures the encryption of certain header sections (see [[https://orgmode.org/worg/org-tutorials/encrypting-files.html][this tutorial]]). Headers with a =:crypt:tag (see =org-crypt-tag-matcher= to change it) will be encrypted.
To temporarily read an encrypted part, and call =M-x org-decrypt-entry= when the cursor is inside that section. Saving the file, will re-encrypt it.
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no
(use-package org
:config
(require 'org-crypt)

View file

@ -145,12 +145,10 @@ The [[https://github.com/emacs-dashboard/emacs-dashboard][emacs-dashboard]] proj
(string-replace "\n" "" smaller-version)))
(setq dashboard-startup-banner
(if (ha-emacs-for-work?)
"~/src/hamacs/support/teal-sticker.png"
;; Choose a random image from my collection of startup images:
(thread-first "~/src/hamacs/support/dashboard"
(directory-files t (rx ".png"))
(seq-random-elt))))
;; Choose a random image from my collection of startup images:
(thread-first "~/src/hamacs/support/dashboard"
(directory-files t (rx ".png"))
(seq-random-elt)))
(setq dashboard-banner-logo-title
(format "Emacs %s — %s"

View file

@ -265,6 +265,26 @@ The trick is to install some base-level plugins, and then, on my work computer,
fi
#+END_SRC
I would like to have a history /per project/, so that when I start a session for a project, my history has where I left off /for that project/ and not everything. I guess Im not the only one who [[https://github.com/ivan-cukic/zsh-per-project-history][thought of this idea]]. We first need to add his plugin to the list of supplied plugins, so do this once:
#+BEGIN_SRC zsh :tangle no
git clone https://github.com/ivan-cukic/zsh-per-project-history ~/.oh-my-zsh/plugins/per-project-history
#+END_SRC
His idea is to have a variable array, =PER_PROJECT_HISTORY_TAGS= that lists files that should identify the start of a project, and while his default seems sufficient, I am not found of the spammy message, so:
#+BEGIN_SRC zsh
declare -a PER_PROJECT_HISTORY_TAGS
export PER_PROJECT_HISTORY_TAGS=(.envrc .git)
declare -r PER_PROJECT_HISTORY_TAGS
#+END_SRC
we just need to add =per-history= to the list of plugins:
#+BEGIN_SRC zsh
plugins+=(per-project-history)
#+END_SRC
Now that Ive filled in the =plugins= variable, load OMZ and the plugins:
#+BEGIN_SRC zsh