Skip to content

Instantly share code, notes, and snippets.

@lingceng
Created April 1, 2016 09:21
Show Gist options
  • Save lingceng/d38787d83879945f3e5e941dbbb10eec to your computer and use it in GitHub Desktop.
Save lingceng/d38787d83879945f3e5e941dbbb10eec to your computer and use it in GitHub Desktop.
Send text to tmux
Plugin 'benmills/vimux'
function! VimuxSlime()
call VimuxOpenRunner()
let lines = split(@v, '\n')
let text = ''
let index = 0
while index < len(lines)
let line = lines[index]
let l:text = l:text . line
if !( (index+1) < len(lines) && lines[index + 1] =~ '^\s*\.')
let l:text = l:text . "\n"
endif
let index = index + 1
endwhile
call VimuxSendText(l:text)
call VimuxSendKeys("Enter")
endfunction
vmap <LocalLeader>vs "vy :call VimuxSlime()<CR>
nmap <LocalLeader>vs ^v$<LocalLeader>vs<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment