Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/catgoose/coderunner.nvim
Open terminal in split and execute commands on buffer save
https://github.com/catgoose/coderunner.nvim
neovim-plugin nvim-plugin
Last synced: 15 days ago
JSON representation
Open terminal in split and execute commands on buffer save
- Host: GitHub
- URL: https://github.com/catgoose/coderunner.nvim
- Owner: catgoose
- Created: 2023-02-02T13:24:49.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T11:51:29.000Z (9 months ago)
- Last Synced: 2024-08-07T18:34:53.550Z (3 months ago)
- Topics: neovim-plugin, nvim-plugin
- Language: Lua
- Homepage:
- Size: 29.3 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# coderunner.nvim
Open terminal in a configurable split and execute commands on buffer save.
## Default configuration
```lua
langs = {
ruby = {
{ "ruby", "[#file]" },
},
lua = {
{ "lua", "[#file]" },
},
python = {
{ "python3", "[#file]" },
},
javascript = {
{ "clear" }, -- each table is a separate commands
{ "node", "[#file]" },
},
cpp = {
{ "clear" }, -- 3 commands are ran.
-- ctrl-p/n can be used to cycle history.
{ "make", { "[#ask]", "Enter make argument" } },
{ { "[#ask]", "Command to run after make" } },
},
},
split = "horizontal", -- vertical or horizontal
scale = 0.25,
filetype = "coderunner",
},
```- Each key in `langs` table expects a table of commands.
- `[#file]` tag is replaced by the current filename.
- `{ "[#ask]", "Ask text }` Table prompts for input.## API
```lua
require("coderunner").run({{split = "horizontal"}})
require("coderunner").run({{split = "vertical"}})
```## Example setup with lazy.nvim
```lua
local opts = {
split = "vertical",
scale = 0.25,
}return {
"catgoose/coderunner.nvim",
opts - opts,
event = "BufReadPre",
keys = {
{"cc", [[require("coderunner").run({split = "horizontal"})]]),
{"cv", [[require("coderunner").run({split = "vertical"})]])},
}
```## Todo
- [ ] Allow defining a table of actions to perform as a token