mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-19 19:32:45 +08:00
Added jump plugin
This commit is contained in:
parent
14788bcd4b
commit
3b56be3e26
7
plugins/jump/README.md
Normal file
7
plugins/jump/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
jump
|
||||
====
|
||||
|
||||
A port of [Jeroen Janssens' "jump" utility] [1] to the fish shell (and [Oh My Fish!] [2]).
|
||||
|
||||
[1]: http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
|
||||
[2]: https://github.com/bpinto/oh-my-fish
|
11
plugins/jump/jump.fish
Normal file
11
plugins/jump/jump.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
function jump
|
||||
if test (count $argv) -ne 1
|
||||
echo "Usage: jump <MARK_NAME>"
|
||||
else
|
||||
if test -d $MARKPATH/$argv[1] -a -L $MARKPATH/$argv[1]
|
||||
cd $MARKPATH/$argv[1]
|
||||
else
|
||||
echo "No such mark: $argv[1]"
|
||||
end
|
||||
end
|
||||
end
|
2
plugins/jump/jump.load
Normal file
2
plugins/jump/jump.load
Normal file
|
@ -0,0 +1,2 @@
|
|||
set -x MARKPATH $HOME/.marks
|
||||
command mkdir -p $MARKPATH
|
15
plugins/jump/mark.fish
Normal file
15
plugins/jump/mark.fish
Normal file
|
@ -0,0 +1,15 @@
|
|||
function mark
|
||||
if test (count $argv) -eq 1
|
||||
command ln -s (pwd) $MARKPATH/$argv[1]
|
||||
else if test (count $argv) -eq 2
|
||||
if test -d $argv[2]
|
||||
cd $argv[2]
|
||||
command ln -s (pwd) $MARKPATH/$argv[1]
|
||||
cd -
|
||||
else
|
||||
echo "$argv[2] is not a valid directory."
|
||||
end
|
||||
else
|
||||
echo "Usage: mark <MARK_NAME> [DIRECTORY]"
|
||||
end
|
||||
end
|
20
plugins/jump/marks.fish
Normal file
20
plugins/jump/marks.fish
Normal file
|
@ -0,0 +1,20 @@
|
|||
function marks
|
||||
if test (count $argv) -gt 0
|
||||
echo "Usage: marks"
|
||||
else
|
||||
set -l file_list (command ls $MARKPATH/)
|
||||
set -l mark_list
|
||||
for file in $file_list
|
||||
if test -d $MARKPATH/$file -a -L $MARKPATH/$file
|
||||
set mark_list $mark_list $file
|
||||
end
|
||||
end
|
||||
if test (count $mark_list) -eq 0
|
||||
echo "No marks currently defined."
|
||||
else
|
||||
for mark_name in $mark_list
|
||||
echo "$mark_name -> "(realpath $MARKPATH/$mark_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
13
plugins/jump/unmark.fish
Normal file
13
plugins/jump/unmark.fish
Normal file
|
@ -0,0 +1,13 @@
|
|||
function unmark
|
||||
if test (count $argv) -eq 0
|
||||
echo "Usage: unmark <MARK_NAME>..."
|
||||
else
|
||||
for mark_name in $argv
|
||||
if test -d $MARKPATH/$mark_name -a -L $MARKPATH/$mark_name
|
||||
command rm -i $MARKPATH/$mark_name
|
||||
else
|
||||
echo "No such mark: $mark_name"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user