zsh-navigation-tools.plugin.zsh 930 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env zsh
  2. REPO_DIR="${0%/*}"
  3. CONFIG_DIR="$HOME/.config/znt"
  4. #
  5. # Copy configs
  6. #
  7. if ! test -d "$HOME/.config"; then
  8. mkdir "$HOME/.config"
  9. fi
  10. if ! test -d "$CONFIG_DIR"; then
  11. mkdir "$CONFIG_DIR"
  12. fi
  13. set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
  14. for i; do
  15. if ! test -f "$CONFIG_DIR/$i"; then
  16. cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR"
  17. fi
  18. done
  19. #
  20. # Load functions
  21. #
  22. autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize
  23. autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget
  24. alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history
  25. alias nkill=n-kill noptions=n-options npanelize=n-panelize
  26. zle -N znt-history-widget
  27. bindkey '^R' znt-history-widget
  28. setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS