mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
add code runner jaq
This commit is contained in:
parent
a5bfdfbfb2
commit
9ac7fbb4c6
5 changed files with 137 additions and 21 deletions
|
@ -17,6 +17,7 @@
|
|||
"impatient.nvim": { "branch": "main", "commit": "b842e16ecc1a700f62adb9802f8355b99b52a5a6" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" },
|
||||
"indent-o-matic": { "branch": "master", "commit": "749b7cbae2d52aa1f65b6a2cd7b879a0b52ac3a1" },
|
||||
"jaq-nvim": { "branch": "master", "commit": "236296aae555657487d1bb4d066cbde9d79d8cd4" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "4f60facf18b34ae06d164485aa2ce879e21e44fc" },
|
||||
"live-server": { "branch": "main", "commit": "ecd7c1418823b65dd2bca710587c80afe42c973e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a52f078026b27694d2290e34efa61a6e4a690621" },
|
||||
|
|
|
@ -208,6 +208,13 @@ return {
|
|||
require("user.coderunner")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"is0n/jaq-nvim",
|
||||
event = "CursorHold",
|
||||
config = function()
|
||||
require("user.jaq")
|
||||
end,
|
||||
},
|
||||
-- for color view
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
|
|
|
@ -1,24 +1,45 @@
|
|||
local status_ok, code_runner = pcall(require, "code_runner")
|
||||
if not status_ok then
|
||||
return
|
||||
return
|
||||
end
|
||||
code_runner.setup({
|
||||
-- put here the commands by filetype
|
||||
filetype = {
|
||||
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||
python = "python3 -u",
|
||||
typescript = "deno run",
|
||||
javascript = "node $dir/$fileName",
|
||||
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
||||
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
||||
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
||||
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
||||
},
|
||||
mode = "term",
|
||||
focus = true,
|
||||
startinsert = true,
|
||||
term = {
|
||||
position = "vert",
|
||||
size = 50,
|
||||
},
|
||||
-- put here the commands by filetype
|
||||
filetype = {
|
||||
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||
python = "python3 -u",
|
||||
typescript = "deno run",
|
||||
javascript = "node $dir/$fileName",
|
||||
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
||||
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
||||
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
||||
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
||||
},
|
||||
-- mode = "term",
|
||||
mode = "float",
|
||||
focus = true,
|
||||
startinsert = true,
|
||||
term = {
|
||||
--position = "vert",
|
||||
position = "bot",
|
||||
size = 50,
|
||||
},
|
||||
float = {
|
||||
-- Key that close the code_runner floating window
|
||||
close_key = "<ESC>",
|
||||
-- Window border (see ':h nvim_open_win')
|
||||
border = "rounded",
|
||||
|
||||
-- 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",
|
||||
|
||||
-- Transparency (see ':h winblend')
|
||||
blend = 0,
|
||||
},
|
||||
})
|
||||
|
|
86
lua/user/jaq.lua
Normal file
86
lua/user/jaq.lua
Normal file
|
@ -0,0 +1,86 @@
|
|||
M = {}
|
||||
local status_ok, jaq_nvim = pcall(require, "jaq-nvim")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
jaq_nvim.setup({
|
||||
-- Commands used with 'Jaq'
|
||||
cmds = {
|
||||
-- Default UI used (see `Usage` for options)
|
||||
default = "term",
|
||||
|
||||
-- Uses external commands such as 'g++' and 'cargo'
|
||||
external = {
|
||||
typescript = "deno run %",
|
||||
javascript = "node %",
|
||||
-- markdown = "glow %",
|
||||
python = "python %",
|
||||
-- rust = "rustc % && ./$fileBase && rm $fileBase",
|
||||
rust = "cargo run",
|
||||
cpp = "g++ % -o $fileBase && ./$fileBase",
|
||||
go = "go run %",
|
||||
sh = "sh %",
|
||||
java = "java %",
|
||||
},
|
||||
|
||||
-- Uses internal commands such as 'source' and 'luafile'
|
||||
internal = {
|
||||
-- lua = "luafile %",
|
||||
-- vim = "source %",
|
||||
},
|
||||
},
|
||||
|
||||
behavior = {
|
||||
-- Default type
|
||||
default = "terminal",
|
||||
|
||||
-- Start in insert mode
|
||||
startinsert = false,
|
||||
|
||||
-- Use `wincmd p` on startup
|
||||
wincmd = false,
|
||||
|
||||
-- Auto-save files
|
||||
autosave = false,
|
||||
},
|
||||
|
||||
-- UI settings
|
||||
ui = {
|
||||
-- Floating Window / FTerm settings
|
||||
float = {
|
||||
-- Floating window border (see ':h nvim_open_win')
|
||||
border = "rounded", -- none, single, double, rounded
|
||||
|
||||
-- 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 = 20,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_set_keymap
|
||||
|
||||
keymap("n", "<m-r>", ":silent only | Jaq<cr>", opts)
|
||||
return M
|
|
@ -219,10 +219,11 @@ local mappings = {
|
|||
},
|
||||
r = { "<cmd>RunCode<CR>", "Run Code" },
|
||||
f = { "<cmd>RunFile<CR>", "Run File" },
|
||||
j = { "<cmd>Jaq float<CR>", "Run With Jaq" },
|
||||
p = { "<cmd>RunProject<CR>", "Run Project" },
|
||||
g = { "<cmd>ToggleTerm size=70 direction=vertical<cr>gradle run<cr>" .. trn, "Run Gradle" },
|
||||
g = { "<cmd>ToggleTerm size=70 direction=float<cr>gradle run<cr>" .. trn, "Run Gradle" },
|
||||
m = {
|
||||
"<cmd>ToggleTerm size=70 direction=vertical<cr>mvn exec:java -Dexec.mainClass=com.pojokcode.App<cr>",
|
||||
"<cmd>ToggleTerm size=70 direction=float<cr>mvn exec:java -Dexec.mainClass=com.pojokcode.App<cr>",
|
||||
"Run MVN",
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue