From c1b034529d148602199f3177107da2c02d24442c Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sun, 21 Aug 2022 10:56:08 +0200 Subject: [PATCH] Add R5RS REPL mappings --- .vim/ftplugin/scheme/repl.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .vim/ftplugin/scheme/repl.vim diff --git a/.vim/ftplugin/scheme/repl.vim b/.vim/ftplugin/scheme/repl.vim new file mode 100644 index 0000000..6609e70 --- /dev/null +++ b/.vim/ftplugin/scheme/repl.vim @@ -0,0 +1,25 @@ +" +" Source: https://wiki.call-cc.org/vim / Jonathan Palardy +" + +" Note, this is assuming you have an R5RS Scheme REPL runnning in the second +" TMUX pane. + +" Send `(load )` to tmux pane +nmap rf :call Scheme_send_sexp("(load \"" . expand("%:p") . "\")\n") +nmap re :call Scheme_eval_defun() + +" Send s-expression to TMUX buffer +fun! Scheme_send_sexp(sexp) + let ss = escape(a:sexp, '\"') + " Send to second tmux pane + call system("tmux send-keys -t 1 \"" . ss . "\n\"") +endfun + +" Send s-expression under cursor to TMUX buffer +fun! Scheme_eval_defun() + let pos = getpos('.') + silent! exec "normal! 99[(yab" + call Scheme_send_sexp(@") + call setpos('.', pos) +endfun