From 74ba6b62556b1e88d149d8fe99074b32051f74a5 Mon Sep 17 00:00:00 2001 From: Daniel Jay Haskin Date: Wed, 11 Sep 2024 10:27:29 -0600 Subject: [PATCH] Use the paste file in conemu for faster turnaround --- autoload/slime/common.vim | 7 ++++++- autoload/slime/targets/conemu.vim | 9 +++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/autoload/slime/common.vim b/autoload/slime/common.vim index 4861fbb..6957875 100644 --- a/autoload/slime/common.vim +++ b/autoload/slime/common.vim @@ -25,7 +25,12 @@ function! slime#common#write_paste_file(text) call mkdir(paste_dir, "p") endif let lines = split(a:text, "\n", 1) - call writefile(lines, slime#config#resolve("paste_file"), 'b') + let paste_file = slime#config#resolve("paste_file") + let result = writefile(lines, paste_file, 'bS') + if result != 0 + echoerr "Couldn't write to slime paste file." + endif + return paste_file endfunction function! slime#common#capitalize(text) diff --git a/autoload/slime/targets/conemu.vim b/autoload/slime/targets/conemu.vim index 8c897fe..8e13709 100644 --- a/autoload/slime/targets/conemu.vim +++ b/autoload/slime/targets/conemu.vim @@ -9,11 +9,8 @@ function! slime#targets#conemu#config() abort endfunction function! slime#targets#conemu#send(config, text) - " use the selection register to send text to ConEmu using the windows clipboard (see help gui-clipboard) - " save the current selection to restore it after send - let tmp = @* - let @* = a:text - call slime#common#system("conemuc -guimacro:%s print", [a:config["HWND"]]) - let @* = tmp + " Use the selection register to send text to ConEmu using the slime paste file + let paste_file = slime#common#write_paste_file(a:text) + call slime#common#system("conemuc -guimacro:%s pastefile 2 %s", [a:config["HWND"], paste_file]) endfunction