commit 670949497dfd71d7f6a83aaac7c2c092cddfc3a5
parent 4298a4247803482724c0b02627336cb7760c4cb7
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Sat, 31 Oct 2020 12:33:50 +0100
vimsend: open in containing Vim
If running from Vim's internal terminal, the vim command shouldn't open
a new Vim, but should open the file in the containing Vim. Finally found
a way to do that.
Former-commit-id: 340c57e842d1dae22968ef0b81d53e169d6941ac
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/scripts/vimsend b/scripts/vimsend
@@ -0,0 +1,10 @@
+#!/bin/sh
+# Send a file to Vim
+case "$1" in
+ /*) fpath="$1";;
+ *) fpath="$(pwd)/$1";;
+esac
+
+# Have to use $fpath directly here otherwise opens two windows
+# shellcheck disable=SC2059
+printf "]51;[\"drop\", \"$fpath\"]"
diff --git a/shell/aliases b/shell/aliases
@@ -26,5 +26,6 @@ alias tx="tmuxinator"
alias mpva="mpv --no-audio-display --no-video --volume=50"
alias irrsi="irssi --home=~/.config/irssi"
alias scim="sc-im"
-alias mbsync="mbsync -c $HOME/.config/mbsync/mbsyncrc"
+alias mbsync='mbsync -c $HOME/.config/mbsync/mbsyncrc'
alias mutt='BW_SESSION="$(bw unlock --raw)" neomutt'
+[ -n "$VIM_TERMINAL" ] && alias vim=vimsend