function _jump {
local cur=${COMP_WORDS[COMP_CWORD]}
local marks=$(find $MARKPATH -type l -printf "%f\n")
COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur"))
return 0
}
complete -o default -o nospace -F _jump jump
Bash completion really needs better docs :-|Quickly navigate your filesystem from the command line
21–30 of 148 posts
Re: Quickly navigate your filesystem from the command line
#22You might want to check out z: https://github.com/rupa/z
Re: Quickly navigate your filesystem from the command line
#23Re: Quickly navigate your filesystem from the command line
#24To have completion with bash you can use this: function _jump { local cur=${COMP_WORDS[COMP_CWORD]} local marks=$(find $MARKPATH -type l -printf "%f\n") COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur")) return 0 } complete -o default -o nospace -F _jump jump Bash completion really needs better docs :-|
Re: Quickly navigate your filesystem from the command line
#25To have completion with bash you can use this: function _jump { local cur=${COMP_WORDS[COMP_CWORD]} local marks=$(find $MARKPATH -type l -printf "%f\n") COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur")) return 0 } complete -o default -o nospace -F _jump jump Bash completion really needs better docs :-|
I was in the process of doing this myself and though "I wonder if it's already been posted in the comments". Thank you!
Re: Quickly navigate your filesystem from the command line
#26A handy alias I use: alias ..='cd ..' Moving up the file tree has never been easier!
Put the following in your .bashrc instead: shopt -s autocd If you type a directory in the command-line, it’ll cd into it, e.g.: $ .. # cd .. $ ~ # cd ~ $ foo # cd foo I can’t live without this.
Re: Quickly navigate your filesystem from the command line
#27You might want to check out z: https://github.com/rupa/z
Re: Quickly navigate your filesystem from the command line
#28You can also use ranger [1] to change directories, especially if you want to explore the directory tree quickly when you don't know exactly where to jump to. Install it and add the following to ~/.bashrc: function ranger-cd { tempfile='/tmp/chosendir' /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" test -f "$tempfile" && if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then cd -- "$(cat "$tempfile")" fi r…
it says it's not available. any idea why ranger is not longer available in package manager?
Re: Quickly navigate your filesystem from the command line
#29Re: Quickly navigate your filesystem from the command line
#30You can also use ranger [1] to change directories, especially if you want to explore the directory tree quickly when you don't know exactly where to jump to. Install it and add the following to ~/.bashrc: function ranger-cd { tempfile='/tmp/chosendir' /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" test -f "$tempfile" && if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then cd -- "$(cat "$tempfile")" fi r…
thanks! I tried: apt-get install ranger it says it's not available. any idea why ranger is not longer available in package manager?