Skip to content

Commit ec8317f

Browse files
committed
Do not interact with X in any way in vimcat.
`unset DISPLAY` at the beginning of vimcat to disable any X server interaction by vim or anything else. Fixes a bug where the clipboard is clobbered if the user has: ```vim set clipboard=unnamedplus ``` in their `vimrc`. - Fix #255. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
1 parent 145cf10 commit ec8317f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

vimcat

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ fi
3939

4040
tab_stop=8
4141

42+
# Do not interact with X server in any way (fixes bug #255 with clobbering
43+
# selection buffer and clipboard.)
44+
unset DISPLAY
45+
4246
quit() {
4347
(
4448
kill "$vim_pid" >/dev/null 2>&1
@@ -69,7 +73,7 @@ quit() {
6973

7074
do_sleep() {
7175
_ms=${1:-100}
72-
"$vim" -NEsnR -i NONE -u NONE +"sleep $_ms m" +q >/dev/null 2>&1
76+
"$vim" -NEnR -i NONE -u NONE +"sleep $_ms m" +q >/dev/null 2>&1
7377
}
7478

7579
usage() {
@@ -118,7 +122,7 @@ start_pipeline() {
118122

119123
start_highlight_job() {
120124
# INSERT VIMCAT_DEBUG PREPARATION HERE
121-
set -- -NE -i NONE -n \
125+
set -- -NEn -i NONE \
122126
--cmd "set runtimepath^=$runtime" \
123127
--cmd "call vimcat#Init({ 'rc': '$vimcatrc' })" \
124128
--cmd visual \

0 commit comments

Comments
 (0)