All Projects → bfrg → vim-jqplay

bfrg / vim-jqplay

Licence: other
Run jq interactively in Vim

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to vim-jqplay

vim-qf-preview
Preview the quickfix item under the cursor in a popup window
Stars: ✭ 32 (-42.86%)
Mutual labels:  vim-plugin, vim-ftplugin
move-less
vim plugin for faster navigation without moving the cursor position (look up/down/middle; scroll up/down/both, fold two distance places permanent together)
Stars: ✭ 36 (-35.71%)
Mutual labels:  vim-plugin
completor-swift
Swift code completion for completor.vim
Stars: ✭ 15 (-73.21%)
Mutual labels:  vim-plugin
easybuffer.vim
easybuffer.vim - vim plugin to quickly switch between buffers
Stars: ✭ 50 (-10.71%)
Mutual labels:  vim-plugin
jfq
JSONata on the command line
Stars: ✭ 29 (-48.21%)
Mutual labels:  jq
vim-syntaxMarkerFold
Markers while using syntax fold method
Stars: ✭ 16 (-71.43%)
Mutual labels:  vim-plugin
vim-smt2
A VIM plugin that adds support for the SMT-LIB2 format (including Z3's extensions)
Stars: ✭ 35 (-37.5%)
Mutual labels:  vim-plugin
vim-backscratch
Small scratches for Vim, feels nice
Stars: ✭ 20 (-64.29%)
Mutual labels:  vim-plugin
nvim-toggle-terminal
NeoVim plugin that toggles a terminal buffer in the current window maintaining the same shell instance
Stars: ✭ 54 (-3.57%)
Mutual labels:  vim-plugin
minimal gdb
🐛 Lightweight vim -> gdb broker which uses .gdbinit gdb config file to export breakpoints
Stars: ✭ 16 (-71.43%)
Mutual labels:  vim-plugin
vim-iawriter
iAwriter's Focus mode for vim
Stars: ✭ 23 (-58.93%)
Mutual labels:  vim-plugin
cmp-rg
ripgrep source for nvim-cmp
Stars: ✭ 165 (+194.64%)
Mutual labels:  vim-plugin
vimwasm-try-plugin
Try Vim plugin on your browser without installing it using vim.wasm!
Stars: ✭ 21 (-62.5%)
Mutual labels:  vim-plugin
vim-dap
Vim/Neovim debugger plugin providing a terminal interface to the Debug Adapter Protocol
Stars: ✭ 43 (-23.21%)
Mutual labels:  vim-plugin
gentoo-syntax
[MIRROR] Gentoo Ebuild, Eclass, GLEP, ChangeLog and Portage Files syntax highlighting, filetype and indent settings for Vim
Stars: ✭ 22 (-60.71%)
Mutual labels:  vim-plugin
sjq
Command-line JSON processor with Scala syntax
Stars: ✭ 54 (-3.57%)
Mutual labels:  jq
cake.vim
Utility for CakePHP developers.
Stars: ✭ 35 (-37.5%)
Mutual labels:  vim-plugin
gtd.vim
Getting things done with Vim
Stars: ✭ 42 (-25%)
Mutual labels:  vim-plugin
vim-nicomment
[Unmaintained] Flow comments on your Vim
Stars: ✭ 16 (-71.43%)
Mutual labels:  vim-plugin
gh.vim
Vim/Neovim plugin for GitHub
Stars: ✭ 149 (+166.07%)
Mutual labels:  vim-plugin

vim-jqplay

Run jq on a json buffer, and interactively update the output window whenever the input buffer or the jq filter buffer are modified similar to jqplay.org.

Note: Plugin requires Vim >= 8.1.1776 (no Neovim support).

Usage

Quick Overview

Command Description
:Jqplay [{args}] Start an interactive session using the current json buffer and the jq options {args}.
:JqplayScratch [{args}] Like :Jqplay but creates a new scratch buffer as input.
:JqplayScratch! [{args}] Like :JqplayScratch but forces --null-input and doesn't pass any input to jq.

:Jqplay

Run :Jqplay {args} to start an interactive jq session using the current (json) buffer as input and the jq options {args}. The command will open two new windows:

  1. The first window contains a jq scratch buffer (prefixed with jq-filter://) that is applied interactively to the current json buffer.
  2. The second window displays the jq output (prefixed with jq-output://).

{args} can be any jq command-line arguments as you would write them in the shell (except for the -f/--from-file option and the filter).

Jq is invoked automatically whenever the input buffer or the jq filter buffer are modified. By default jq is executed when the InsertLeave or TextChanged events are triggered. See configuration below for how to change the list of events when jq is invoked.

Once an interactive session is started the following commands are available:

  • :JqplayClose[!] - Stop the interactive session. Add a ! to also delete all associated scratch buffers.
  • :Jqrun [{args}] - Invoke jq manually with the jq options {args}.
  • :Jqstop - Terminate a running jq process started by this plugin.

Run :Jqrun {args} at any time to invoke jq manually with the jq arguments {args} and the current jq-filter:// buffer. This will temporarily override the jq options previously set when starting the session with :Jqplay {args}. Add a bang to :Jqrun! to permanently override the options for the jq-filter:// buffer.

:Jqrun is useful to quickly run the same jq filter with different set of jq options, without closing the session. Alternatively, if you don't want to run jq interactively on every buffer change, disable all autocommands and use :Jqrun instead.

:JqplayScratch

Same as :Jqplay but start an interactive jq session with a new input buffer. The command will open an interactive session in a new tab page using a new scratch buffer as input. Running :JqplayScratch! with a bang will force the -n/--null-input option and open an interactive session without using any input buffer. This is useful when you don't need any input to be passed to jq.

Configuration

Options can be set through the dictionary variable g:jqplay. The following entries are supported:

Key Description Default
exe Path to jq executable. value found in $PATH
opts Default jq command-line options (like --tab). -
autocmds Events when jq is invoked. ['InsertLeave', 'TextChanged']
delay Time in ms after which jq is invoked when an event is triggered. 500

Examples

  1. Use the local jq executable, and tabs for indentation. Invoke jq whenever insert mode is left, or text is changed in either insert or normal mode.
    let g:jqplay = {
        \ 'exe': '~/.local/bin/jq',
        \ 'opts': '--tab',
        \ 'autocmds': ['TextChanged', 'TextChangedI', 'InsertLeave']
        \ }
  2. Use tabs for indentation, do not run jq automatically on buffer change. Instead invoke jq manually with :Jqrun:
    let g:jqplay = {'opts': '--tab', 'autocmds': []}

Installation

$ cd ~/.vim/pack/git-plugins/start
$ git clone --depth=1 https://github.com/bfrg/vim-jqplay
$ vim -u NONE -c 'helptags vim-jqplay/doc | quit'

Note: The directory name git-plugins is arbitrary, you can pick any other name. For more details see :help packages. Alternatively, use your favorite plugin manager.

Related plugins

vim-jq provides Vim runtime files like syntax highlighting for jq script files.

License

Distributed under the same terms as Vim itself. See :help license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].