diff options
| author | 2025-01-21 14:33:39 -0800 | |
|---|---|---|
| committer | 2025-01-21 14:35:56 -0800 | |
| commit | 66e4188bd7caf58f43c0270e16bfc6e8d7807b8b (patch) | |
| tree | 02a28c530040bb549d1622b7aa30b27ecb10d33b /oni/home | |
| parent | b78aeefec1ba3cdfc4cfb76e5f505ef06a4c3a0a (diff) | |
| download | new-dotfiles-66e4188bd7caf58f43c0270e16bfc6e8d7807b8b.tar.gz new-dotfiles-66e4188bd7caf58f43c0270e16bfc6e8d7807b8b.zip | |
Add zsh configuration
Diffstat (limited to 'oni/home')
| -rw-r--r-- | oni/home/config/common.scm | 1 | ||||
| -rw-r--r-- | oni/home/config/pop-os.scm | 14 | ||||
| -rw-r--r-- | oni/home/config/zsh/spwd.zsh | 27 |
3 files changed, 40 insertions, 2 deletions
diff --git a/oni/home/config/common.scm b/oni/home/config/common.scm index 39498ca..7495aa9 100644 --- a/oni/home/config/common.scm +++ b/oni/home/config/common.scm @@ -126,6 +126,7 @@ "preexec_functions+=(horizontal-rule)\n" "precmd_functions+=(horizontal-rule)\n" "PROMPT=\"%T \\$(spwd) %B%(?.%F{2}.%F{1}[%?])>%b%f \"") + (local-file "zsh/spwd.zsh") (local-file "zsh/guix-environment.zsh")))))) (define home-guile-service diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm index d7a2113..6a82bce 100644 --- a/oni/home/config/pop-os.scm +++ b/oni/home/config/pop-os.scm @@ -15,7 +15,8 @@ #:select (local-file mixed-text-file)) #:use-module ((oni home config common) - #:select (home-channels-service)) + #:select (home-channels-service + home-zsh-service)) #:use-module ((oni home services emacs) #:select (home-emacs-service-type home-emacs-configuration @@ -24,6 +25,7 @@ home-emacs-org-journal-service-type)) #:use-module ((oni home services environment) #:select (home-environment-service)) + #:use-module (oni home services zsh) #:use-module ((oni packages emacs-config) #:select (emacs-oni-bookmark emacs-oni-browse-url @@ -102,4 +104,12 @@ (home-wakatime-configuration (api-url "https://waka.ryuslash.org/api") (exclude '("COMMIT_EDITMSG$" - "TAG_EDITMSG$"))))))) + "TAG_EDITMSG$"))))) + + home-zsh-service + + ;; This has to be the first extension because it needs to be added to the + ;; configuration last. + (service home-zsh-syntax-highlighting-service-type) + (service home-zsh-autosuggestions-service-type) + (service home-zsh-contextual-abbrevs-service-type))) diff --git a/oni/home/config/zsh/spwd.zsh b/oni/home/config/zsh/spwd.zsh new file mode 100644 index 0000000..76de8d9 --- /dev/null +++ b/oni/home/config/zsh/spwd.zsh @@ -0,0 +1,27 @@ +function spwd() { + # From https://stackoverflow.com/a/45336078 + paths=(${(s:/:)PWD}) + + cur_path='/' + cur_short_path='/' + for directory in ${paths[@]} + do + cur_dir='' + for (( i=0; i<${#directory}; i++ )); do + cur_dir+="${directory:$i:1}" + matching=("$cur_path"/"$cur_dir"*/) + if [[ ${#matching[@]} -eq 1 ]]; then + break + fi + done + cur_short_path+="$cur_dir/" + cur_path+="$directory/" + + if [[ $cur_path == $HOME/ ]]; + then cur_short_path='~/' + fi + done + + printf %b "${cur_short_path: : -1}" + echo +} |
