Created
February 28, 2016 00:19
-
-
Save vpetro/f757a7a6fcfbc376b616 to your computer and use it in GitHub Desktop.
Using :terminal to send code to Scala REPL
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! OpenREPL() | |
if !exists("g:repl_terminal_id") | |
botright split enew | |
let g:repl_terminal_id = termopen("scala") | |
endif | |
endfunction | |
function! PasteScala(lines) | |
if !exists("g:repl_terminal_id") | |
call OpenREPL() | |
endif | |
let toPaste = substitute(a:lines, "\n", "^M", "g") | |
call jobsend(g:repl_terminal_id, add([':paste', toPaste], '')) | |
endfunction | |
nmap \to :call OpenREPL()<CR> | |
nmap \ts :call PasteScala(@")<CR> | |
nmap \ta ggVGy \| :call PasteScala(@")<CR> | |
nmap \tl ^v$"*y \| :call PasteScala(@*)<CR> | |
vnoremap \tv "*y \| :call PasteScala(@*)<CR> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment