Add zsh custom plugins

This commit is contained in:
Julian Mutter 2022-08-24 16:39:59 +02:00
parent 7e37870ce6
commit d198b662b0
2 changed files with 19 additions and 1 deletions

View File

@ -35,7 +35,8 @@ alacritty = "~/.config/alacritty"
starship = "~/.config/"
[zsh.files]
zsh = "~/"
"zsh/.zshrc" = "~/.zshrc"
"zsh/custom-plugins" = "~/.oh-my-zsh/custom"
[polybar.files]
polybar = "~/.config/polybar"

View File

@ -0,0 +1,17 @@
#!/usr/bin/zsh
#
# My version of the last-working-dir plugin (https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/last-working-dir/last-working-dir.plugin.zsh)
#
# Updates the last directory once directory is changed
autoload -U add-zsh-hook
add-zsh-hook chpwd chpwd_last_working_dir
chpwd_last_working_dir() {
# Don't run in subshells
[[ "$ZSH_SUBSHELL" -eq 0 ]] || return 0
pwd > ~/.last-working-dir
}
# Changes directory to the last working directory
lwd() {
[[ -r ~/.last-working-dir ]] && cd $(cat ~/.last-working-dir)
}