summaryrefslogtreecommitdiff
path: root/user-profiles/zsh/zshrc
blob: a41c9d9cb147e56ab3caa67a5006b30116489f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
fancy-ctrl-z () {
  emulate -LR zsh
  if [[ $#BUFFER -eq 0 ]]; then
    [[ -n $(jobs -s) ]] && bg
    zle redisplay
  else
    zle push-input
  fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z

function fancy-ctrl-d() {
  zle || exit 0
  [[ -n $BUFFER ]] && return
  typeset -g precmd_functions=(fancy-ctrl-d)
  zle accept-line
}
zle -N fancy-ctrl-d
bindkey '^D' fancy-ctrl-d
setopt ignore_eof

# word navigation for urxvt
bindkey -e
bindkey ';5C' emacs-forward-word
bindkey ';5D' emacs-backward-word
bindkey '^[[1;5C' emacs-forward-word
bindkey '^[[1;5D' emacs-backward-word
bindkey '^H' backward-kill-word

autoload -Uz url-quote-magic bracketed-paste-magic
zle -N self-insert url-quote-magic
zle -N bracketed-paste bracketed-paste-magic

setopt extended_glob

autoload -Uz add-zsh-hook

_precmd_title() {
  print -Pn "\e]0;%~\a"
}

_preexec_title() {
  print -Pn "\e]0;%~ — $2\a"
}

add-zsh-hook precmd _precmd_title
add-zsh-hook preexec _preexec_title