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"
|
||||
"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
|
||||
|
|
|
@ -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)))
|
||||
|
|
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