Facebook
From Little Kangaroo, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 164
  1. # Luke's config for the Zoomer Shell
  2.  
  3. # Enable colors and change prompt:
  4. autoload -U colors && colors    # Load colors
  5. PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
  6. setopt autocd           # Automatically cd into typed directory.
  7. stty stop undef         # Disable ctrl-s to freeze terminal.
  8. setopt interactive_comments
  9.  
  10. # History in cache directory:
  11. HISTSIZE=10000
  12. SAVEHIST=10000
  13. HISTFILE=~/.cache/zsh/history
  14.  
  15. # Load aliases and shortcuts if existent.
  16. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc"
  17. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc"
  18. [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc"
  19.  
  20. # Basic auto/tab complete:
  21. autoload -U compinit
  22. zstyle ':completion:*' menu select
  23. zmodload zsh/complist
  24. compinit
  25. _comp_options+=(globdots)               # Include hidden files.
  26.  
  27. # vi mode
  28. bindkey -v
  29. export KEYTIMEOUT=1
  30.  
  31. # Use vim keys in tab complete menu:
  32. bindkey -M menuselect 'h' vi-backward-char
  33. bindkey -M menuselect 'k' vi-up-line-or-history
  34. bindkey -M menuselect 'l' vi-forward-char
  35. bindkey -M menuselect 'j' vi-down-line-or-history
  36. bindkey -v '^?' backward-delete-char
  37.  
  38. # Change cursor shape for different vi modes.
  39. function zle-keymap-select () {
  40.     case $KEYMAP in
  41.         vicmd) echo -ne 'e[1 q';;      # block
  42.         viins|main) echo -ne 'e[5 q';; # beam
  43.     esac
  44. }
  45. zle -N zle-keymap-select
  46. zle-line-init() {
  47.     zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
  48.     echo -ne "e[5 q"
  49. }
  50. zle -N zle-line-init
  51. echo -ne 'e[5 q' # Use beam shape cursor on startup.
  52. preexec() { echo -ne 'e[5 q' ;} # Use beam shape cursor for each new prompt.
  53.  
  54. # Use lf to switch directories and bind it to ctrl-o
  55. lfcd () {
  56.     tmp="$(mktemp)"
  57.     lf -last-dir-path="$tmp" "$@"
  58.     if [ -f "$tmp" ]; then
  59.         dir="$(cat "$tmp")"
  60.         rm -f "$tmp" >/dev/null
  61.         [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
  62.     fi
  63. }
  64. bindkey -s '^a' 'bc -lqn'
  65.  
  66. bindkey -s '^f' 'cd "$(dirname "$(fzf)")"n'
  67.  
  68. bindkey '^k' history-beginning-search-backward
  69.  
  70. bindkey '^j' history-beginning-search-forward
  71.  
  72. bindkey '^[[P' delete-char
  73.  
  74. # Edit line in vim with ctrl-e:
  75. autoload edit-command-line; zle -N edit-command-line
  76. bindkey '^e' edit-command-line
  77.  
  78. # Load syntax highlighting; should be last.
  79. source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
  80.