generate_single_file 992 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/zsh
  2. local PLUGIN_FILE="doc/zshnavigationtools.plugin.zsh"
  3. [ -d doc ] || cd ..
  4. rm -vf "$PLUGIN_FILE"
  5. echo "# The preamble comments apply when using ZNT as autoload functions" >>"$PLUGIN_FILE"
  6. echo "# https://github.com/psprint/zsh-navigation-tools" >>"$PLUGIN_FILE"
  7. echo "# License is GPLv3 and MIT" >>"$PLUGIN_FILE"
  8. echo -n "# " >>"$PLUGIN_FILE"
  9. git show-ref master | head -1 >>"$PLUGIN_FILE"
  10. echo >>"$PLUGIN_FILE"
  11. for i in n-*(on); do
  12. echo "$i() {" >>"$PLUGIN_FILE"
  13. cat "$i" >>"$PLUGIN_FILE"
  14. echo "}" >>"$PLUGIN_FILE"
  15. echo "alias n${i#n-}=$i" >>"$PLUGIN_FILE"
  16. echo >>"$PLUGIN_FILE"
  17. done
  18. # Append znt-* files
  19. for i in znt-*(on); do
  20. echo "$i() {" >>"$PLUGIN_FILE"
  21. cat "$i" >>"$PLUGIN_FILE"
  22. echo "}" >>"$PLUGIN_FILE"
  23. echo >>"$PLUGIN_FILE"
  24. done
  25. # Append ^R bind
  26. echo "zle -N znt-history-widget" >>"$PLUGIN_FILE"
  27. echo "bindkey '^R' znt-history-widget" >>"$PLUGIN_FILE"
  28. echo "setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS" >>"$PLUGIN_FILE"