Skip to content

chris-burgin/query.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

query.nvim

Run database queries from nvim. Query.nvim is a work in progress, expect things to change.

Installation

Plug 'nvim-lua/plenary.nvim'
Plug 'chris-burgin/query.nvim'

Setup

local query_nvim = require("query_nvim")
local connectors = require('query_nvim/connectors')

require('query_nvim').setup({
  db = {
    test = connectors.mysql({
        user = "root",
        host = "127.0.0.1",
        database = "test",
    }),
    demo = connectors.mysql({
        user = "root",
        host = "127.0.0.1",
        database = "demo",
    }),
  },
})

Connectors

Connectors are provided to the query_nvim setup function.

local connectors = require('query_nvim/connectors')
connectors.mysql(...config)

MySQL

Config Param Description Required
user The database user yes
password Password for the user no
host The host on which to connect yes
database The database to query against yes

Custom

To define a custom connector for a database not supported look at connectors.lua for examples.

Usage

Type :Query and hit tab to see a list of commands.

Command Description
query Runs the provided query. :Query query [db.name] [query]
visual Runs the current Visual Selection as a query. :Query visual [db.name]
visual_r Same as selection plus it accepts a list of replacements (?) as a CSV. Note strings must be wrapped in quotes.

Examples

❗ Screenshots are out of date and do not show the required db.name param. ❗

query

query

visual

simple

visual_r

replacement

About

[Work In Progress] Run database queries from nvim.

Topics

Resources

License

Stars

Watchers

Forks