mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
commit
6834ae756e
@ -22,6 +22,7 @@
|
|||||||
* __node__ – Adds locally installed NodeJS `npm` binary executable modules to the path.
|
* __node__ – Adds locally installed NodeJS `npm` binary executable modules to the path.
|
||||||
* __percol__ – Browse your fish history with [percol](https://github.com/mooz/percol).
|
* __percol__ – Browse your fish history with [percol](https://github.com/mooz/percol).
|
||||||
* __peco__ – Browse your fish history with [peco](https://github.com/peco/peco).
|
* __peco__ – Browse your fish history with [peco](https://github.com/peco/peco).
|
||||||
|
* __osx__ - Integration with Finder and iTunes.
|
||||||
* __php__ – Manage phphttp server.
|
* __php__ – Manage phphttp server.
|
||||||
* __plenv__ – [plenv](https://github.com/tokuhirom/plenv) Perl binary manager integration.
|
* __plenv__ – [plenv](https://github.com/tokuhirom/plenv) Perl binary manager integration.
|
||||||
* __pyenv__ – [Simple Python Version Management](https://github.com/yyuu/pyenv) integration.
|
* __pyenv__ – [Simple Python Version Management](https://github.com/yyuu/pyenv) integration.
|
||||||
|
17
plugins/osx/README.markdown
Normal file
17
plugins/osx/README.markdown
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
osx
|
||||||
|
---
|
||||||
|
|
||||||
|
**Maintainer:** [cykeb](https://github.com/CYKEB)
|
||||||
|
|
||||||
|
Inspired by the oh-my-zsh plugin by [sorin-ionescu](https://github.com/sorin-ionescu)
|
||||||
|
https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/osx.plugin.zsh
|
||||||
|
|
||||||
|
- `tab` - Open the current directory in a new tab
|
||||||
|
- `pfd` - Return the path of the frontmost Finder window
|
||||||
|
- `pfs` - Return the current Finder selection
|
||||||
|
- `cdf` - cd to the current Finder directory
|
||||||
|
- `pushdf` - pushd to the current Finder directory
|
||||||
|
- `ql` - Quick Look a specified file
|
||||||
|
- `manp` - Open a specified man page in Preview
|
||||||
|
- `trash` - Move a specified file to the Trash
|
||||||
|
- `itunes` - Play, pause etc. iTunes
|
5
plugins/osx/cdf.fish
Normal file
5
plugins/osx/cdf.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# cd to the current Finder directory
|
||||||
|
|
||||||
|
function cdf -d "cd to the current Finder directory"
|
||||||
|
cd (pfd)
|
||||||
|
end
|
33
plugins/osx/itunes.fish
Normal file
33
plugins/osx/itunes.fish
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Play, pause etc. iTunes
|
||||||
|
|
||||||
|
function itunes -d "Play, pause etc. iTunes. Use -h or --help for a more detailed description."
|
||||||
|
if [ (count $argv) -gt 0 ]
|
||||||
|
set -l opt $argv[1]
|
||||||
|
switch $opt
|
||||||
|
case launch play pause stop rewind resume quit
|
||||||
|
case mute
|
||||||
|
set opt "set mute to true"
|
||||||
|
case unmute
|
||||||
|
set opt "set mute to false"
|
||||||
|
case next previous
|
||||||
|
set opt "$opt track"
|
||||||
|
case vol volume
|
||||||
|
set opt "set sound volume to $argv[2]"
|
||||||
|
case "" -h --help
|
||||||
|
echo "Usage: itunes <option>"
|
||||||
|
echo "option:"
|
||||||
|
echo \t"launch|play|pause|stop|rewind|resume|quit"
|
||||||
|
echo \t"mute|unmute\tcontrol volume set"
|
||||||
|
echo \t"next|previous\tplay next or previous track"
|
||||||
|
echo \t"vol"\t"Set the volume, takes an argument from 0 to 100"
|
||||||
|
echo \t"help"\t"show this message and exit"
|
||||||
|
return 0
|
||||||
|
case '*'
|
||||||
|
echo "Unknown option $opt. Use -h or --help for a more detailed description."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
osascript -e "tell application \"iTunes\" to $opt"
|
||||||
|
else
|
||||||
|
echo "Arguments expected. Use -h or --help for a more detailed description."
|
||||||
|
end
|
||||||
|
end
|
5
plugins/osx/manp.fish
Normal file
5
plugins/osx/manp.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Open a specified man page in Preview
|
||||||
|
|
||||||
|
function manp -d "Open a specified man page in Preview"
|
||||||
|
man -t $argv | open -f -a Preview
|
||||||
|
end
|
8
plugins/osx/pfd.fish
Normal file
8
plugins/osx/pfd.fish
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Return the path of the frontmost Finder window
|
||||||
|
|
||||||
|
function pfd -d "Return the path of the frontmost Finder window"
|
||||||
|
osascript 2>/dev/null -e '
|
||||||
|
tell application "Finder"
|
||||||
|
return POSIX path of (target of window 1 as alias)
|
||||||
|
end tell'
|
||||||
|
end
|
13
plugins/osx/pfs.fish
Normal file
13
plugins/osx/pfs.fish
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Return the path of the frontmost Finder window
|
||||||
|
|
||||||
|
function pfs -d "Return the path of the frontmost Finder window"
|
||||||
|
osascript 2>/dev/null -e '
|
||||||
|
set output to ""
|
||||||
|
tell application "Finder" to set the_selection to selection
|
||||||
|
set item_count to count the_selection
|
||||||
|
repeat with item_index from 1 to count the_selection
|
||||||
|
if item_index is less than item_count then set the_delimiter to "\n"
|
||||||
|
if item_index is item_count then set the_delimiter to ""
|
||||||
|
set output to output & ((item item_index of the_selection as alias)\'s POSIX path) & the_delimiter
|
||||||
|
end repeat'
|
||||||
|
end
|
5
plugins/osx/pushdf.fish
Normal file
5
plugins/osx/pushdf.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# pushd to the current Finder directory
|
||||||
|
|
||||||
|
function pushdf -d "pushd to the current Finder directory"
|
||||||
|
pushd (pfd)
|
||||||
|
end
|
9
plugins/osx/ql.fish
Normal file
9
plugins/osx/ql.fish
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Quick Look a specified file
|
||||||
|
|
||||||
|
function ql -d "Quick Look a specified file"
|
||||||
|
if [ (count $argv) -gt 0 ]
|
||||||
|
qlmanage >/dev/null ^/dev/null -p Applications/ &
|
||||||
|
else
|
||||||
|
echo "No file or folder as argument given"
|
||||||
|
end
|
||||||
|
end
|
7
plugins/osx/tab.fish
Normal file
7
plugins/osx/tab.fish
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Open the current directory in a new tab
|
||||||
|
function tab -d "Open the current directory in a new tab"
|
||||||
|
osascript 2>/dev/null -e '
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Terminal" to keystroke "t" using command down
|
||||||
|
end tell'
|
||||||
|
end
|
20
plugins/osx/trash.fish
Normal file
20
plugins/osx/trash.fish
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Move a specified file to the Trash
|
||||||
|
|
||||||
|
function trash -d "Move a specified file to the Trash"
|
||||||
|
if [ (count $argv) -gt 0 ]
|
||||||
|
set -l trash_dir "$HOME/.Trash"
|
||||||
|
for item in $argv
|
||||||
|
if test -e $item
|
||||||
|
set -l item_name (basename $item)
|
||||||
|
if test -e "$trash_dir/$item_name"
|
||||||
|
set -l current_time (date "+%H.%M.%S")
|
||||||
|
mv -f "$item" "$trash_dir/$item_name $current_time"
|
||||||
|
else
|
||||||
|
mv -f "$item" "$trash_dir/"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
echo "No file(s) given to delete"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user