Skip to content

Adding setting to enable editing clipboard contents #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ done
###

AW_PATH=$HOME/.vim-anywhere
AW_SETTINGS=$AW_PATH/settings
TMPFILE_DIR=/tmp/vim-anywhere
TMPFILE=$TMPFILE_DIR/doc-$(date +"%y%m%d%H%M%S")
VIM_OPTS=--nofork

# Use ~/.gvimrc.min or ~/.vimrc.min if one exists
VIMRC_PATH=($HOME/.gvimrc.min $HOME/.vimrc.min)

# load any custom settings
source $AW_SETTINGS;

for vimrc_path in "${VIMRC_PATH[@]}"; do
if [ -f $vimrc_path ]; then
VIM_OPTS+=" -u $vimrc_path"
Expand All @@ -56,6 +60,9 @@ touch $TMPFILE
# Linux
if [[ $OSTYPE == "linux-gnu" ]]; then
chmod o-r $TMPFILE # Make file only readable by you
if [ "$OPEN_CLIPBOARD_CONTENTS" -eq "1" ]; then
xclip -selection clipboard -o > $TMPFILE;
fi
gvim $VIM_OPTS $TMPFILE
cat $TMPFILE | xclip -selection clipboard

Expand All @@ -66,6 +73,10 @@ elif [[ $OSTYPE == "darwin"* ]]; then
"Please reinstall vim-anywhere."

app=$(osascript $AW_PATH/script/current_app.scpt)

if [ "$OPEN_CLIPBOARD_CONTENTS" -eq "1" ]; then
pbpaste > $TMPFILE;
fi
mvim_path=$(cat $AW_PATH/.path)

require_file_exists $mvim_path \
Expand Down
1 change: 1 addition & 0 deletions settings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OPEN_CLIPBOARD_CONTENTS=1