Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

42 linhas
1.6 KiB

15 anos atrás
  1. #Copyright Joel Schaerer 2008, 2009
  2. #This file is part of autojump
  3. #autojump is free software: you can redistribute it and/or modify
  4. #it under the terms of the GNU General Public License as published by
  5. #the Free Software Foundation, either version 3 of the License, or
  6. #(at your option) any later version.
  7. #
  8. #autojump is distributed in the hope that it will be useful,
  9. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. #GNU General Public License for more details.
  12. #
  13. #You should have received a copy of the GNU General Public License
  14. #along with autojump. If not, see <http://www.gnu.org/licenses/>.
  15. #local data_dir=${XDG_DATA_HOME:-$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)}
  16. local data_dir=$([ -e ~/.local/share ] && echo ~/.local/share || echo ~)
  17. if [[ "$data_dir" = "${HOME}" ]]
  18. then
  19. export AUTOJUMP_DATA_DIR=${data_dir}
  20. else
  21. export AUTOJUMP_DATA_DIR=${data_dir}/autojump
  22. fi
  23. if [ ! -e "${AUTOJUMP_DATA_DIR}" ]
  24. then
  25. mkdir "${AUTOJUMP_DATA_DIR}"
  26. mv ~/.autojump_py "${AUTOJUMP_DATA_DIR}/autojump_py" 2>>/dev/null #migration
  27. mv ~/.autojump_py.bak "${AUTOJUMP_DATA_DIR}/autojump_py.bak" 2>>/dev/null
  28. mv ~/.autojump_errors "${AUTOJUMP_DATA_DIR}/autojump_errors" 2>>/dev/null
  29. fi
  30. function autojump_preexec() {
  31. { (autojump -a "$(pwd -P)"&)>/dev/null 2>>|${AUTOJUMP_DATA_DIR}/autojump_errors ; } 2>/dev/null
  32. }
  33. typeset -ga preexec_functions
  34. preexec_functions+=autojump_preexec
  35. alias jumpstat="autojump --stat"
  36. function j { local new_path="$(autojump $@)";if [ -n "$new_path" ]; then echo -e "\\033[31m${new_path}\\033[0m"; cd "$new_path";else false; fi }