Skip to content
Browse files

Use paste_file with tmux for portability

This works around some variations of tmux that can hang waiting for STDIN
  • Loading branch information...
1 parent 3ecc0a6 commit 8dc7ca3c61b23c0230c5970eced3bcc2f3a9b834 @rwstauner committed Jun 28, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 plugin/slime.vim
View
10 plugin/slime.vim
@@ -21,7 +21,7 @@ end
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:ScreenSend(config, text)
- call system("cat > " . g:slime_paste_file, a:text)
+ call s:WritePasteFile(a:text)
call system("screen -S " . shellescape(a:config["sessionname"]) . " -p " . shellescape(a:config["windowname"]) . " -X readreg p " . g:slime_paste_file)
call system("screen -S " . shellescape(a:config["sessionname"]) . " -p " . shellescape(a:config["windowname"]) . " -X paste p")
endfunction
@@ -44,7 +44,8 @@ endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:TmuxSend(config, text)
- call system("tmux -L " . shellescape(a:config["socket_name"]) . " load-buffer -", a:text)
+ call s:WritePasteFile(a:text)
+ call system("tmux -L " . shellescape(a:config["socket_name"]) . " load-buffer " . g:slime_paste_file)
call system("tmux -L " . shellescape(a:config["socket_name"]) . " paste-buffer -t " . shellescape(a:config["target_pane"]))
endfunction
@@ -73,6 +74,11 @@ function! s:SID()
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze_SID$')
endfun
+function! s:WritePasteFile(text)
+ " could check exists("*writefile")
+ call system("cat > " . g:slime_paste_file, a:text)
+endfunction
+
function! s:_EscapeText(text)
if exists("&filetype")
let custom_escape = "_EscapeText_" . &filetype

0 comments on commit 8dc7ca3

Please sign in to comment.
Something went wrong with that request. Please try again.