An open API service indexing awesome lists of open source software.

https://github.com/kurama622/floatrun

A minimize plugin running code in float window
https://github.com/kurama622/floatrun

floating-window nvim nvim-lua nvim-lua-plugin nvim-plugin

Last synced: 23 days ago
JSON representation

A minimize plugin running code in float window

Awesome Lists containing this project

README

        

## FloatRun
`FloatRun` is a minimize Neovim plugin that lets you run your code in float window.

### FloatRunToggle
![FloatRunToggle](https://github.com/Kurama622/screenshot/blob/master/FloatRunToggle.gif)

### FloatTermToggle
![FloatTermToggle](https://github.com/Kurama622/screenshot/blob/master/FloatTermToggle.gif)

### Installation && Configuration
#### Packer.nvim:
```lua
use {
'Kurama622/FloatRun',
config = function()
require 'module.floatrun'
end,
cmd = {'FloatRunToggle', 'FloatTermToggle'}
}
```

Write the following configuration into `~/.config/nvim/lua/module/floatrun.lua`:
```lua
require("FloatRun").setup{
ui = {
relative = "editor", -- win / editor
border = "single",
float_hl = "Normal",
border_hl = "FloatBorder",
blend = 0,
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5
},
run_command = {
['cpp'] = 'g++ -std=c++11 %s -Wall -o {} && {}',
['python'] = "python %s",
['lua'] = "lua %s",
-- ['lua'] = "luafile %s", -- for nvim's built-in cmd
['sh'] = "sh %s",
[''] = "",
}
}
```

#### lazy.nvim

```lua
{
"Kurama622/FloatRun",
cmd = { "FloatRunToggle", "FloatTermToggle" },
opts = function()
return {
ui = {
relative = "editor", -- win / editor
border = "single",
float_hl = "Normal",
border_hl = "FloatBorder",
blend = 0,
height = 0.5,
width = 0.9,
x = 0.5,
y = 0.5,
},
run_command = {
cpp = "g++ -std=c++11 %s -Wall -o {} && {}",
python = "python %s",
lua = "lua %s",
-- lua = "luafile %s", -- for nvim's built-in cmd
sh = "sh %s",
[""] = "",
},
}
end,
keys = {
{ "", mode = { "n", "t" }, "FloatRunToggle" },
{ "", mode = { "n", "t" }, "FloatTermToggle" },
{ "", mode = { "n", "t" }, "FloatTerm" }, -- always create a new terminal
{ "", mode = "t", "FloatTermNext" }, -- switch next terminal
{ "", mode = "t", "FloatTermPrev" }, -- switch prev terminal
},
}
```

### Usage:

```
:FloatRunToggle
:FloatTermToggle
```

### Refer
- [fm-nvim](https://github.com/is0n/fm-nvim/)