vim/plugin/slime.vim @ c314a1f64f5a

vim: make slime.vim less dumb
author Steve Losh <steve@stevelosh.com>
date Fri, 23 Jul 2010 23:53:03 -0400
parents 6bd31aa2672a
children 6a7961f15ca1

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

function Send_to_Screen(text)
  if !exists("g:screen_sessionname") || !exists("g:screen_windowname")
    call Screen_Vars()
  end

  echo system("screen -S " . g:screen_sessionname . " -p " . g:screen_windowname . " -X stuff '" . substitute(a:text, "'", "'\\\\''", 'g') . "'")
endfunction

function Screen_Session_Names(A,L,P)
  return system("screen -ls | awk '/Attached/ {print $1}'")
endfunction

function Screen_Vars()
  if !exists("g:screen_sessionname") || !exists("g:screen_windowname")
    let g:screen_sessionname = ""
    let g:screen_windowname = "0"
  end

  let g:screen_sessionname = input("session name: ", "", "custom,Screen_Session_Names")
  let g:screen_windowname = input("window name: ", g:screen_windowname)
endfunction

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

vmap <C-c><C-c> "ry:call Send_to_Screen(@r."\n")<CR>
nmap <C-c><C-c> V<C-c><C-c>

nmap <C-c>v :call Screen_Vars()<CR>