Giter Club home page Giter Club logo

jaq-nvim's Introduction

GitHub Stars PRs Welcome Last Commit GitHub Open Issues GitHub Closed Issues GitHub License Lua

jaq-nvim

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.

Demo:

Demo

Screenshots
Run C++ Code w/ :Jaq Bang

Jaq Bang

Run C++ Code w/ :Jaq Float

Jaq Float

Run C++ Code w/ :Jaq Term

Jaq Term

Installation:

Configuration:

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
		}
	}
}

Usage:

: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 quickfix
  • term • opens a terminal with :terminal
  • fterm • opens a terminal using a new FTerm from numToStr/FTerm.nvim
  • toggleterm • opens a terminal using :TermExec from akinsho/toggleterm.nvim
  • bang • 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

Similar Plugins:

Lua

jaq-nvim's People

Contributors

andy3153 avatar celediel avatar is0n avatar lixvbnet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.