Closed elcolie closed 2 years ago
put it in your .bashrc or .zshrc
alias jj='autojump'
When I use jj
. It returns me the path, but my location does not moved!
remove above code and put the below into your bashrc or zshrc
jj() {
if [[ ${1} == -* ]] && [[ ${1} != "--" ]]
then
autojump ${@}
return
fi
setopt localoptions noautonamedirs
local output="$(autojump ${@})"
if [[ -d "${output}" ]]
then
if [ -t 1 ]
then
echo -e "\\033[31m${output}\\033[0m"
else
echo -e "${output}"
fi
cd "${output}"
else
echo "autojump: directory '${@}' not found"
echo "\n${output}\n"
echo "Try \`autojump --help\` for more information."
false
fi
}
It returns 2 lines. First line is command not found. Second line is the directory to go
$ jj el
bash: setopt: command not found
some/directory/here
It returns 2 lines. First line is command not found. Second line is the directory to go
$ jj el bash: setopt: command not found some/directory/here
sorry, i only test it in zsh , i forget bash don't support setopt, you can delete the code
setopt localoptions noautonamedirs
i think it will be ok
Thank you very much.
I like this tool very much. All of my computers are installed it both osx and GNU/Linux Debian. Currently I am trying to use it with my server the problem is
j
is been used already.Question: How to change default key from j to jj in GNU/Linux Debian?