Skip to content

Commit

Permalink
Add c switch to edit the clipboard contents.
Browse files Browse the repository at this point in the history
  • Loading branch information
masher2 committed Feb 10, 2019
1 parent 2ada163 commit 22359f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vim_anywhere
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#
# Modified by Jesús Pérez to use terminal neovim and work only on linux

while getopts ":v" opt; do
while getopts ":cv" opt; do
case "$opt" in
v) set -x ;;
c) read_clipboard='true' ;;
\?) echo "Invalid option: -$OPTARG" >&2 ;;
esac
done
Expand All @@ -23,7 +24,12 @@ TMPFILE=$TMPFILE_DIR/doc-$(date +"%y%m%d%H%M%S")
mkdir -p $TMPFILE_DIR
touch $TMPFILE

# Linux
chmod o-r $TMPFILE # Make file only readable by you

if [[ $read_clipboard == 'true' ]]; then
xclip -o -selection clipboard > $TMPFILE
fi

$TERMINAL -e nvim $TMPFILE

cat $TMPFILE | xclip -selection clipboard

0 comments on commit 22359f9

Please sign in to comment.