Created
April 1, 2016 09:21
-
-
Save lingceng/d38787d83879945f3e5e941dbbb10eec to your computer and use it in GitHub Desktop.
Send text to tmux
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
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