diff --git a/lazy-lock.json b/lazy-lock.json index 27980d3..56b8c7d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -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" }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index c9a880e..319f10e 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -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", diff --git a/lua/user/coderunner.lua b/lua/user/coderunner.lua index 3813a65..83d49b7 100644 --- a/lua/user/coderunner.lua +++ b/lua/user/coderunner.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 = "", + -- 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, + }, }) diff --git a/lua/user/jaq.lua b/lua/user/jaq.lua new file mode 100644 index 0000000..307ed8f --- /dev/null +++ b/lua/user/jaq.lua @@ -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", "", ":silent only | Jaq", opts) +return M diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index be3ee4c..72c239d 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -219,10 +219,11 @@ local mappings = { }, r = { "RunCode", "Run Code" }, f = { "RunFile", "Run File" }, + j = { "Jaq float", "Run With Jaq" }, p = { "RunProject", "Run Project" }, - g = { "ToggleTerm size=70 direction=verticalgradle run" .. trn, "Run Gradle" }, + g = { "ToggleTerm size=70 direction=floatgradle run" .. trn, "Run Gradle" }, m = { - "ToggleTerm size=70 direction=verticalmvn exec:java -Dexec.mainClass=com.pojokcode.App", + "ToggleTerm size=70 direction=floatmvn exec:java -Dexec.mainClass=com.pojokcode.App", "Run MVN", }, },