changeset 759:f632a9850bb8

lookie, i can has x platform
author Jeff Hammel <k0scist@gmail.com>
date Wed, 16 Sep 2015 15:09:19 -0700
parents 88f19ebb43ea
children d0b975ffabdf
files .bashrc
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.bashrc	Mon Aug 31 08:54:57 2015 -0700
+++ b/.bashrc	Wed Sep 16 15:09:19 2015 -0700
@@ -29,7 +29,6 @@
 export CLICOLOR=1
 export EDITOR='emacs -nw'
 export JS_EDITLINE=1
-export JS_EDITLINE=1
 
 # aliases
 alias awd="python -c 'import os;  print (os.path.realpath(\".\"))'"
@@ -65,6 +64,20 @@
 export PATH=~/firefox:~/bin:~/bin/mozilla:~/python:$PATH:/usr/sbin:/usr/games/bin:~/virtualenv:~/silvermirror/bin:~/smartopen/bin:~/k0s/bin:~/docs/project/ims/workflow:~/cognet/bin:~/cognet/python
 export PYTHONPATH=~/python:$PYTHONPATH:~/virtualenv
 
+# clipboard
+if which xclip &> /dev/null
+then
+    export CLIP_COPY="xclip -i"
+    export CLIP_PASTE="xclip -o"
+elif which pbcopy &> /dev/null
+then
+    export CLIP_COPY="pbcopy"
+    export CLIP_PASTE="pbpaste"
+else
+    export CLIP_COPY="tee"
+    export CLIP_PASTE="true"
+fi
+
 ### functions
 
 gplot() {
@@ -251,8 +264,8 @@
 
 fn() {
     # put full name on clipboard and echo it
-    python -c "import os; print (os.path.realpath('$*'))" | xclip -i
-    xclip -o
+    python -c "import os; print (os.path.realpath('$*'))" | ${CLIP_COPY}
+    ${CLIP_PASTE}
 }
 
 swap() {