Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use STDIN with tmux unless a file is specified

This reverts to the previous default behavior
but allows a workaround to be configured for edge cases.
  • Loading branch information...
commit 98588eb981830334236e32be9591a32cd8c53b91 1 parent 8dc7ca3
@rwstauner rwstauner authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 plugin/slime.vim
View
21 plugin/slime.vim
@@ -12,10 +12,6 @@ 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -35,6 +31,11 @@ function! s:ScreenConfig() abort
let b:slime_config = {"sessionname": "", "windowname": "0"}
end
+ " screen needs a file, so set a default if not configured
+ if !exists("g:slime_paste_file")
+ let g:slime_paste_file = "$HOME/.slime_paste"
+ end
+
let b:slime_config["sessionname"] = input("screen session name: ", b:slime_config["sessionname"], "custom,<SNR>" . s:SID() . "_ScreenSessionNames")
let b:slime_config["windowname"] = input("screen window name: ", b:slime_config["windowname"])
endfunction
@@ -44,9 +45,15 @@ endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! s:TmuxSend(config, 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"]))
+ let l:prefix = "tmux -L " . shellescape(a:config["socket_name"])
+ " use STDIN unless configured to use a file
+ if !exists("g:slime_paste_file")
+ call system(l:prefix . " load-buffer -", a:text)
+ else
+ call s:WritePasteFile(a:text)
+ call system(l:prefix . " load-buffer " . g:slime_paste_file)
+ end
+ call system(l:prefix . " paste-buffer -t " . shellescape(a:config["target_pane"]))
endfunction
function! s:TmuxPaneNames(A,L,P)
Please sign in to comment.
Something went wrong with that request. Please try again.