mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Merge pull request #4254 from apjanke/copyfile-portability
Cross-platform clipboard clipcopy() and clippaste()
This commit is contained in:
commit
dc06e96e9c
4 changed files with 100 additions and 10 deletions
|
|
@ -6,11 +6,11 @@ cf () {
|
|||
}
|
||||
# compile & copy to clipboard
|
||||
cfc () {
|
||||
cf "$1" | pbcopy
|
||||
cf "$1" | clipcopy
|
||||
}
|
||||
|
||||
# compile from pasteboard & print
|
||||
alias cfp='coffeeMe "$(pbpaste)"'
|
||||
# compile from clipboard & print
|
||||
alias cfp='coffeeMe "$(clippaste)"'
|
||||
|
||||
# compile from pasteboard and copy to clipboard
|
||||
alias cfpc='cfp | pbcopy'
|
||||
# compile from clipboard and copy to clipboard
|
||||
alias cfpc='cfp | clipcopy'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# Copies the pathname of the current directory to the system or X Windows clipboard
|
||||
function copydir {
|
||||
pwd | tr -d "\r\n" | pbcopy
|
||||
}
|
||||
emulate -L zsh
|
||||
print -n $PWD | clipcopy
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# Copies the contents of a given file to the system or X Windows clipboard
|
||||
#
|
||||
# copyfile <file>
|
||||
function copyfile {
|
||||
[[ "$#" != 1 ]] && return 1
|
||||
local file_to_copy=$1
|
||||
cat $file_to_copy | pbcopy
|
||||
emulate -L zsh
|
||||
clipcopy $1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue