jaq-nvim icon indicating copy to clipboard operation
jaq-nvim copied to clipboard

when opening another file and trying to run it, it fails to run it and shows the file doesnt exist

Open Rishabh672003 opened this issue 2 years ago • 1 comments

The issue -

https://user-images.githubusercontent.com/53911515/217227654-de5d2944-1e2f-41d4-9782-6daca33c3953.mp4

minimal init.lua to replicate it

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

vim.g.mapleader = " " -- make sure to set `mapleader` before lazy so your mappings are correct

require("lazy").setup({
	git = {
		log = { "--since=3 days ago" }, -- show commits from the last 3 days
		timeout = 600,
	},
	{
		"catppuccin/nvim",
		name = "catppuccin",
		lazy = false, -- make sure we load this during startup if it is your main colorscheme
		priority = 1000, -- make sure to load this before all the other start plugins
	},
	{
		"is0n/jaq-nvim",
		cmd = "Jaq",
		config = function()
			M = {}
			require("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 %",
						java = "java %",
						markdown = "glow %",
						python = "python %",
						rust = "cargo run",
						cpp = "g++ % -o $fileBase.out && ./$fileBase.out",
						c = "gcc % -o $fileBase.out && ./$fileBase.out",
						go = "go run %",
						sh = "chmod +x % && sh %",
						zsh = "zsh %",
					},

					-- 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 = "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,
					},
				},
			})

			return M
		end,
	},
})


local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
keymap("n", "<Space>w", ":w!<CR>", opts)
keymap("n", "<Space>q", ":q!<CR>", opts)
keymap("n", "<Space>j", ":Jaq<CR>", opts)
keymap("n", "<Space>e", ":Vex<CR>", opts)
keymap("n", "<m-r>", ":silent only | Jaq<cr>", opts)

vim.cmd("colorscheme catppuccin-mocha")

Thanks for your time and work

Rishabh672003 avatar Feb 07 '23 11:02 Rishabh672003

@Rishabh672003 were you able to fix it ? I'm facing the same issue. This is my config

return {
  "is0n/jaq-nvim",
  opts = {
    cmds = {
      default = "term",
      external = {
        python = "python3 %",
        javascript = "node %",
        cpp = "g++ % -o $fileBase.out -std=c++23 && ./$fileBase.out",
        c = "gcc -Wall -Wextra -pedantic % -o $fileBase.out && ./$fileBase.out",
      },
    },
  },
  -- Keymap for running the file
  vim.keymap.set("n", "<Leader>rj", "<Cmd>Jaq<CR>", { silent = true, desc = "Run the File" }),
}

devnchill avatar Jan 26 '25 12:01 devnchill