Code Monkey home page Code Monkey logo

jaq-nvim's Introduction

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:

Type Info Demonstration
Internal:
Runs a vim command using :.
Internal
Float:
Opens a floating window with vim.api.nvim_open_win()
Float
Terminal:
Opens a terminal with :terminal
Terminal
Bang:
Opens a small window with :!
Bang
Quickfix:
Command output is placed in a quickfix window
Quickfix

Installation:

use {"is0n/jaq-nvim"}

Example Lua Config:

require('jaq-nvim').setup{
  cmds = {
    -- Uses vim commands
    internal = {
      lua = "luafile %",
      vim = "source %"
    },

    -- Uses shell commands
    external = {
      markdown = "glow %",
      python   = "python3 %",
      go       = "go run %",
      sh       = "sh %"
    }
  },

  behavior = {
    -- Default type
    default     = "float",

    -- Start in insert mode
    startinsert = false,

    -- Use `wincmd p` on startup
    wincmd      = false,

    -- Auto-save files
    autosave    = false
  },

  ui = {
    float = {
      -- See ':h nvim_open_win'
      border    = "none",

      -- See ':h winhl'
      winhl     = "Normal",
      borderhl  = "FloatBorder",

      -- See ':h winblend'
      winblend  = 0,

      -- Num from `0-1` for measurements
      height    = 0.8,
      width     = 0.8,
      x         = 0.5,
      y         = 0.5
    },

    terminal = {
      -- Window position
      position = "bot",

      -- Window size
      size     = 10

      -- Disable line numbers
      line_no  = false,
    },

    quickfix = {
      -- Window position
      position = "bot",

      -- Window size
      size     = 10
    }
  }

Example JSON Config:

{
  "internal": {
    "lua": "luafile %",
    "vim": "source %"
  },

  "external": {
    "markdown": "glow %",
    "python": "python3 %",
    "go": "go run %",
    "sh": "sh %"
  }
}

In the current working directory, Jaq will search for a file called .jaq.json.

This config file will be used for running commands, both external and internal.

Usage:

:Jaq by default uses the float type to run code. The default can be changed (see Example Lua Config).

To use any other type, provide any of the arguments seen in Demonstration.

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 require('jaq-nvim').setup() or .jaq.json ...

  • % / $file • Current File
  • # / $altFile • Alternate File
  • $dir • Current Working Directory
  • $filePath • Path to Current File
  • $fileBase • Basename of File (no extension)
  • $moduleName • Python Module Name

Lua

jaq-nvim's People

Contributors

is0n avatar celediel avatar andy3153 avatar lixvbnet avatar

Watchers

 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.