Created
January 23, 2011 21:50
-
-
Save caifara/792477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function Send_to_Screen(text) | |
if !exists("g:slime") | |
call Screen_Vars() | |
end | |
let escaped_text = substitute(shellescape(a:text), "\\\\\n", "\n", "g") | |
call system("screen -S " . g:slime["sessionname"] . " -p " . g:slime["windowname"] . " -X stuff " . escaped_text) | |
endfunction | |
function Screen_Session_Names(A,L,P) | |
return system("screen -ls | awk '/Attached/ {print $1}'") | |
endfunction | |
function Screen_Vars() | |
if !exists("g:slime") | |
let g:slime = {"sessionname": "", "windowname": "0"} | |
end | |
let g:slime["sessionname"] = input("session name: ", g:slime["sessionname"], "custom,Screen_Session_Names") | |
let g:slime["windowname"] = input("window name: ", g:slime["windowname"]) | |
endfunction | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
vmap <C-c><C-c> "ry :call Send_to_Screen(@r)<CR> | |
nmap <C-c><C-c> vip<C-c><C-c> | |
nmap <C-c>v :call Screen_Vars()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment