jaq-nvim
is Just Another Quickrun plugin for Neovim that was inspired by quickrun.vim. In short, it is a plugin that lets you run the code of any language with a single command.
- packer.nvim:
use {'is0n/jaq-nvim'}
The following is an example config...
require('jaq-nvim').setup{
-- Commands used with 'Jaq'
cmds = {
-- Default UI used (see `Usage` for options)
default = "float",
-- Uses external commands such as 'g++' and 'cargo'
external = {
typescript = "deno run %",
javascript = "node %",
markdown = "glow %",
python = "python3 %",
rust = "rustc % && ./$fileBase && rm $fileBase",
cpp = "g++ % -o $fileBase && ./$fileBase",
go = "go run %",
sh = "sh %",
},
-- Uses internal commands such as 'source' and 'luafile'
internal = {
lua = "luafile %",
vim = "source %"
}
},
-- UI settings
ui = {
-- Start in insert mode
startinsert = false,
-- Switch back to current file
-- after using Jaq
wincmd = false,
-- Floating Window / FTerm settings
float = {
-- Floating window border (see ':h nvim_open_win')
border = "none",
-- Num from `0 - 1` for measurements
height = 0.8,
width = 0.8,
x = 0.5,
y = 0.5,
-- Highlight group for floating window/border (see ':h winhl')
border_hl = "FloatBorder",
float_hl = "Normal",
-- Floating Window Transparency (see ':h winblend')
blend = 0
},
terminal = {
-- Position of terminal
position = "bot",
-- Open the terminal without line numbers
line_no = false,
-- Size of terminal
size = 10
},
toggleterm = {
-- Position of terminal, one of "vertical" | "horizontal" | "window" | "float"
position = "horizontal",
-- Size of terminal
size = 10
},
quickfix = {
-- Position of quickfix window
position = "bot",
-- Size of quickfix window
size = 10
}
}
}
:Jaq
by default uses the float
option to run code, however, both bang
and term
are appropriate terms. Append any of the following terms to the end of :Jaq
to override the default value.
float
• opens a floating window with:lua vim.api.nvim_open_win()
quickfix
/qf
• command output is placed in a quickfixterm
• opens a terminal with:terminal
fterm
• opens a terminal using a new FTerm from numToStr/FTerm.nvimtoggleterm
• opens a terminal using :TermExec from akinsho/toggleterm.nvimbang
• opens a small window with:!
internal
• runs a vim command
Example: :Jaq bang
The commands for :Jaq
also have certain variables that can help in running code. You can put any of the following in your require('jaq-nvim').setup()
...
%
• Current File$file
• Current File$filePath
• Path to Current File$fileBase
• Basename of File (no extension)$altFile
• Alternate File$dir
• Current Working Directory (CWD)$moduleName
• Python Module Name
- pianocomposer321/yabs.nvim • "Yet Another Build System for Neovim, written in Lua."
- CRAG666/code_runner.nvim • "The best code runner you could have [...]"