Permalink
Browse files

use file and readreg to fix "stuff" limitations

  • Loading branch information...
1 parent d0cea52 commit feebbf09d60ea7864f36c15b36383471af087b45 @jpalardy committed May 26, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 plugin/slime.vim
View
9 plugin/slime.vim
@@ -12,13 +12,18 @@ if !exists("g:slime_target")
let g:slime_target = "screen"
end
+if !exists("g:slime_paste_file")
+ let g:slime_paste_file = "$HOME/.slime_paste"
+end
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Screen
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:ScreenSend(config, text)
- let escaped_text = substitute(shellescape(a:text), "\\\\\\n", "\n", "g")
- call system("screen -S " . shellescape(a:config["sessionname"]) . " -p " . shellescape(a:config["windowname"]) . " -X stuff " . escaped_text)
+ call system("cat > " . g:slime_paste_file, 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
function! s:ScreenSessionNames(A,L,P)

4 comments on commit feebbf0

@davidwclin

I've actually tried this approach as suggested earlier by a comment on your blog http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/#div-comment-587. While this works in general, my Clojure REPL still had issues with the same character limit - though I haven't looked into the reason.

@jpalardy
Owner

So, this doesn't work?

Could you provide me with a recipe to reproduce?

@davidwclin

No, it didn't work for me.
1) get something to run, e.g. https://thefiletree.com/test/test.clj
2) have a clojure REPL running on screen
3) from another terminal:
screen -S clojure -p 0 -X readreg p /tmp/test.clj
screen -S clojure -p 0 -X paste p

Only the first 1000 chars or so would run.
A secondary concern is that the copy-paste approach causes a slight pause, maybe that's fixable.

@davidwclin

Ok, it works in the Clojure REPL in general. Wasn't working for me because I'm using rlwrap. So yea, your solutions works, but just doesn't work nicely with rlwrap.

Please sign in to comment.