Various small additions
This commit is contained in:
parent
fe3c0fb5d5
commit
05f6bf7007
11 changed files with 208 additions and 5 deletions
|
@ -59,3 +59,7 @@ function zle-line-finish () {
|
|||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
|
||||
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||
zle -N insert-sudo insert_sudo
|
||||
bindkey "^[s" insert-sudo
|
||||
|
|
22
modules/conf/init
Executable file
22
modules/conf/init
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/zsh
|
||||
|
||||
conf() {
|
||||
local target=${conf_locations[${1}]}
|
||||
if [[ -d ${target} ]]; then
|
||||
cd ${target}
|
||||
if ! [[ -w ${target} ]]; then
|
||||
su
|
||||
fi
|
||||
elif [[ -f ${target} ]]; then
|
||||
if ! [[ -w ${target} ]]; then
|
||||
sudoedit ${target}
|
||||
else
|
||||
$EDITOR ${target}
|
||||
fi
|
||||
elif [[ -n ${target} ]]; then
|
||||
echo "Conf target for $1 missing: $target"
|
||||
else
|
||||
echo "Unknown conf target: $1"
|
||||
fi
|
||||
|
||||
}
|
3
modules/fuck/init
Normal file
3
modules/fuck/init
Normal file
|
@ -0,0 +1,3 @@
|
|||
if exists thefuck; then
|
||||
eval "$(thefuck --alias)"
|
||||
fi
|
10
modules/localrc/init
Executable file
10
modules/localrc/init
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/zsh
|
||||
|
||||
load_localrc() {
|
||||
local dir=${1:-$PWD}
|
||||
if [[ -f $dir/.lzshrc ]]; then source $dir/.lzshrc
|
||||
elif [[ "$dir" != "/" ]]; then load_localrc ${dir:h}
|
||||
fi
|
||||
}
|
||||
|
||||
chpwd_hook load_localrc
|
Loading…
Add table
Add a link
Reference in a new issue