https://github.com/windwp/vim-floaterm-repl
Running your code and get result in floating window.
https://github.com/windwp/vim-floaterm-repl
vim vim-pl
Last synced: about 1 year ago
JSON representation
Running your code and get result in floating window.
- Host: GitHub
- URL: https://github.com/windwp/vim-floaterm-repl
- Owner: windwp
- License: other
- Created: 2020-08-30T02:52:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-03-16T13:18:45.000Z (over 5 years ago)
- Last Synced: 2025-03-16T17:17:18.794Z (over 1 year ago)
- Topics: vim, vim-pl
- Language: Vim script
- Homepage:
- Size: 775 KB
- Stars: 29
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
Run repl code in the floating/popup window.
### demo

# Install
This plugin depend on [vim-floaterm](https://github.com/voldikss/vim-floaterm) you need to install it first
using vim-plug
``` vim
Plug 'voldikss/vim-floaterm'
Plug 'windwp/vim-floaterm-repl'
```
# Usage
* 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](#demo)
## Key map
``` vim
nnoremap uc :FloatermRepl
vnoremap uc :FloatermRepl
```
Press `` or `q` to exit in floaterm window
## Configuration
* add support for your language by modify runner script
```vim
let g:floaterm_repl_runner= "/home/vim/test/runner.sh"
```
* Sample runner.sh
``` bash
#!/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 "====================="
```