nixos-config/extra/zshrc/common

45 lines
1 KiB
Plaintext
Raw Normal View History

# Do not freeze terminal on Ctrl-S
stty -ixon
# Disable annoying correction prompt
unsetopt correct_all
# Additional keybinds
bindkey '^H' backward-kill-word
allow-any-ptrace() {
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope >/dev/null
}
deny-any-ptrace() {
echo 1 | sudo tee /proc/sys/kernel/yama/ptrace_scope >/dev/null
}
curl-time() {
curl -w @- -o /dev/null -s "$@" <<'EOF'
time_namelookup: %{time_namelookup} s\n
time_connect: %{time_connect} s\n
time_appconnect: %{time_appconnect} s\n
time_pretransfer: %{time_pretransfer} s\n
time_redirect: %{time_redirect} s\n
time_starttransfer: %{time_starttransfer} s\n
----------\n
time_total: %{time_total} s\n
EOF
}
__fzf_history_search() {
local res="$(fc -l -n 0 | tac | uniq | fzf +s +m -x -e --preview-window=hidden)"
if [[ $? -eq 0 ]] && [[ ! -z "${res// }" ]]; then
BUFFER=$res
zle end-of-line
fi
}
autoload __fzf_history_search
zle -N __fzf_history_search
bindkey '^R' __fzf_history_search
autoload zmv