Add zsh configuration
This commit is contained in:
parent
b78aeefec1
commit
66e4188bd7
3 changed files with 40 additions and 2 deletions
|
@ -126,6 +126,7 @@
|
||||||
"preexec_functions+=(horizontal-rule)\n"
|
"preexec_functions+=(horizontal-rule)\n"
|
||||||
"precmd_functions+=(horizontal-rule)\n"
|
"precmd_functions+=(horizontal-rule)\n"
|
||||||
"PROMPT=\"%T \\$(spwd) %B%(?.%F{2}.%F{1}[%?])>%b%f \"")
|
"PROMPT=\"%T \\$(spwd) %B%(?.%F{2}.%F{1}[%?])>%b%f \"")
|
||||||
|
(local-file "zsh/spwd.zsh")
|
||||||
(local-file "zsh/guix-environment.zsh"))))))
|
(local-file "zsh/guix-environment.zsh"))))))
|
||||||
|
|
||||||
(define home-guile-service
|
(define home-guile-service
|
||||||
|
|
|
@ -15,7 +15,8 @@
|
||||||
#:select (local-file
|
#:select (local-file
|
||||||
mixed-text-file))
|
mixed-text-file))
|
||||||
#:use-module ((oni home config common)
|
#:use-module ((oni home config common)
|
||||||
#:select (home-channels-service))
|
#:select (home-channels-service
|
||||||
|
home-zsh-service))
|
||||||
#:use-module ((oni home services emacs)
|
#:use-module ((oni home services emacs)
|
||||||
#:select (home-emacs-service-type
|
#:select (home-emacs-service-type
|
||||||
home-emacs-configuration
|
home-emacs-configuration
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
home-emacs-org-journal-service-type))
|
home-emacs-org-journal-service-type))
|
||||||
#:use-module ((oni home services environment)
|
#:use-module ((oni home services environment)
|
||||||
#:select (home-environment-service))
|
#:select (home-environment-service))
|
||||||
|
#:use-module (oni home services zsh)
|
||||||
#:use-module ((oni packages emacs-config)
|
#:use-module ((oni packages emacs-config)
|
||||||
#:select (emacs-oni-bookmark
|
#:select (emacs-oni-bookmark
|
||||||
emacs-oni-browse-url
|
emacs-oni-browse-url
|
||||||
|
@ -102,4 +104,12 @@
|
||||||
(home-wakatime-configuration
|
(home-wakatime-configuration
|
||||||
(api-url "https://waka.ryuslash.org/api")
|
(api-url "https://waka.ryuslash.org/api")
|
||||||
(exclude '("COMMIT_EDITMSG$"
|
(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)))
|
||||||
|
|
27
oni/home/config/zsh/spwd.zsh
Normal file
27
oni/home/config/zsh/spwd.zsh
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Reference in a new issue