├── LICENSE ├── README.md ├── completions └── jump.fish ├── conf.d └── jump.fish └── functions ├── jump.fish ├── mark.fish ├── marks.fish └── unmark.fish /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Bruno Ferreira Pinto 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![][license-badge] 2 | 3 |
4 | 5 | 6 | 7 |
8 |
9 | 10 | # jump 11 | 12 | A port of [Jeroen Janssens' "jump" utility] [1] to the fish shell (and [Oh My Fish!] [omf-link]). 13 | 14 | ## Configuration 15 | 16 | If you have a custom mark folder, you can add the following to your `~/.config/fish/before.init.fish`. 17 | 18 | ``` 19 | set -gx MARKPATH YOUR_CUSTOM_FOLDER_PATH_HERE 20 | ``` 21 | 22 | # License 23 | 24 | [MIT][mit] © [bpinto][author] et [al][contributors] 25 | 26 | 27 | [mit]: http://opensource.org/licenses/MIT 28 | [author]: http://github.com/bpinto 29 | [contributors]: https://github.com/oh-my-fish/plugin-rbenv/graphs/contributors 30 | [omf-link]: https://www.github.com/oh-my-fish/oh-my-fish 31 | 32 | [license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square 33 | [1]: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html 34 | -------------------------------------------------------------------------------- /completions/jump.fish: -------------------------------------------------------------------------------- 1 | # SYNOPSIS 2 | # Completions for jump package. 3 | 4 | complete -c jump -f -a '(command ls ~/.marks)' 5 | complete -c unmark -f -a '(command ls ~/.marks)' 6 | -------------------------------------------------------------------------------- /conf.d/jump.fish: -------------------------------------------------------------------------------- 1 | if not set -q MARKPATH 2 | set -gx MARKPATH $HOME/.marks 3 | command mkdir -p $MARKPATH 4 | end 5 | -------------------------------------------------------------------------------- /functions/jump.fish: -------------------------------------------------------------------------------- 1 | function jump 2 | if test (count $argv) -ne 1 3 | echo "Usage: jump " 4 | else 5 | if test -d $MARKPATH/$argv[1] -a -L $MARKPATH/$argv[1] 6 | cd (readlink $MARKPATH/$argv[1]) 7 | else 8 | echo "No such mark: $argv[1]" 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /functions/mark.fish: -------------------------------------------------------------------------------- 1 | function mark 2 | if test (count $argv) -eq 0 -o (count $argv) -gt 2 3 | echo "Usage: mark [DIRECTORY]" 4 | else if test -e $MARKPATH/$argv[1] 5 | if test -d $MARKPATH/$argv[1] -a -L $MARKPATH/$argv[1] 6 | echo "A mark named $argv[1] already exists." 7 | else 8 | echo "$MARKPATH/$argv[1] already exists." 9 | end 10 | else if test (count $argv) -eq 1 11 | command ln -s (pwd) $MARKPATH/$argv[1] 12 | else if test (count $argv) -eq 2 13 | if test -d $argv[2] 14 | set -l current_dir (pwd) 15 | cd $argv[2] 16 | command ln -s (pwd) $MARKPATH/$argv[1] 17 | cd $current_dir 18 | else 19 | echo "$argv[2] is not a valid directory." 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /functions/marks.fish: -------------------------------------------------------------------------------- 1 | function marks 2 | if test (count $argv) -gt 0 3 | echo "Usage: marks" 4 | else 5 | set -l file_list (command ls $MARKPATH) 6 | if test (count $file_list) -eq 0 7 | echo "No marks currently defined." 8 | else 9 | set -l mark_list 10 | for file in $file_list 11 | if test -d $MARKPATH/$file -a -L $MARKPATH/$file 12 | set mark_list $mark_list $file 13 | end 14 | end 15 | if test (count $mark_list) -eq 0 16 | echo "No marks currently defined." 17 | else 18 | set -l current_dir (pwd) 19 | set -l output "" 20 | for mark_name in $mark_list 21 | cd $MARKPATH/$mark_name 22 | set -l real_path (pwd) 23 | set output "$output$mark_name -> $real_path"\n 24 | end 25 | echo $output | column -t 26 | cd $current_dir 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /functions/unmark.fish: -------------------------------------------------------------------------------- 1 | function unmark 2 | if test (count $argv) -eq 0 3 | echo "Usage: unmark ..." 4 | else 5 | for mark_name in $argv 6 | if test -d $MARKPATH/$mark_name -a -L $MARKPATH/$mark_name 7 | command rm -i $MARKPATH/$mark_name 8 | else 9 | echo "No such mark: $mark_name" 10 | end 11 | end 12 | end 13 | end 14 | --------------------------------------------------------------------------------