Run repl code in the floating/popup window.
This plugin depend on vim-floaterm you need to install it first
using vim-plug
Plug 'voldikss/vim-floaterm'
Plug 'windwp/vim-floaterm-repl'
-
run a part of code in script file
- Select code and run :FloatermRepl
-
run a block code in markdown file with argument passing
- Put cursors in codeblock and run :FloatermRepl (you don't need to select it).
- Passing argument to script in codeheader see
nnoremap <leader>uc :FloatermRepl<CR>
vnoremap <leader>uc :FloatermRepl<CR>
Press <ESC>
or q
to exit in floaterm window
- add support for your language by modify runner script
let g:floaterm_repl_runner= "/home/vim/test/runner.sh"
- Sample runner.sh
#!/usr/bin/env bash
filetype=$1
filepath=$2
shift
shift
params=$@
echo "Start $filetype $filepath"
echo "====================="
case $filetype in
javascript | js)
node $filepath $params
;;
bash | sh)
bash $filepath $params
;;
go )
go run $filepath $params
;;
python | python3)
python3 $filepath $params
;;
*)
echo -n "unknown"
;;
esac
echo "====================="