Quickly navigate your filesystem from the command line
61–70 of 148 posts
Re: Quickly navigate your filesystem from the command line
#62Here is a fully functional (albeit minimal) Windows version: http://appleseedhq.net/stuff/marks-v1.zip . Tested on Windows 7 (does not require PowerShell). GitHub: https://github.com/dictoon/marks Edit: to install, unzip anywhere and add to your path. Then: C:\Windows> mark win C:\Windows> marks win => C:\Windows C:\Windows> cd .. C:\> jump win C:\Windows> Marks will be stored in a marks\ subdirectory (relatively to…
Re: Quickly navigate your filesystem from the command line
#63 export MARKPATH=$HOME/.marks
function jump {
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1
}
function unmark {
rm -if $MARKPATH/$1
}
function marks {
ls -l $MARKPATH | sed 's/ / /g' | cut -d' ' -f9- | sed 's/ -/\t-/g' && echo
}
_completemarks() {
local curw=${COMP_WORDS[COMP_CWORD]}
local wordlist=$(find $MARKPATH -type l -printf "%f\n")
COMPREPLY=($(compgen -W '${wordlist[@]}' -- "$curw"))
return 0
}
complete -F _completemarks jump unmarkRe: Quickly navigate your filesystem from the command line
#64You 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…
Re: Quickly navigate your filesystem from the command line
#65I had to modify Jeroen's code to get the `marks` shortcut working under Mac OS 10.8: export MARKPATH=$HOME/.marks function jump { cd -P $MARKPATH/$1 2> /dev/null || echo "No such mark: $1" } function mark { mkdir -p $MARKPATH; ln -s $(pwd) $MARKPATH/$1 } function unmark { rm -i $MARKPATH/$1 } function marks { ls -l $MARKPATH | sed 's/ / /g' | cut -d' ' -f9- && echo }
function _jump {
local cur=${COMP_WORDS[COMP_CWORD]}
local marks=$(find $MARKPATH -type l | awk -F '/' '{print $NF}')
COMPREPLY=($(compgen -W '${marks[@]}' -- "$cur"))
return 0
}
complete -o default -o nospace -F _jump jumpRe: Quickly navigate your filesystem from the command line
#66cdhere navigates your cmd.exe to wherever the current topmost Explorer window is pointed at.
It's not the same as the OP's trick, of course, but since you're voluntarily using Windows, I'm going to assume you "live" on the command line less than the average UNIX user, and more on GUI tools such as good old Explorer.
Re: Quickly navigate your filesystem from the command line
#67You 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…
Re: Quickly navigate your filesystem from the command line
#68Re: Quickly navigate your filesystem from the command line
#69Re: Quickly navigate your filesystem from the command line
#70For Windows users I have a closely related shameless plug: cdhere navigates your cmd.exe to wherever the current topmost Explorer window is pointed at. It's not the same as the OP's trick, of course, but since you're voluntarily using Windows, I'm going to assume you "live" on the command line less than the average UNIX user, and more on GUI tools such as good old Explorer. https://github.com/eteeselink/cdhere