zsh-navigation-tools.plugin.zsh 984 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. # Don't leave positional parameters being set
  20. set --
  21. #
  22. # Load functions
  23. #
  24. 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
  25. autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget
  26. alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history
  27. alias nkill=n-kill noptions=n-options npanelize=n-panelize
  28. zle -N znt-history-widget
  29. bindkey '^R' znt-history-widget
  30. setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS