Skip to content

mark-coyle/telescope-dbcli.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

telescope-dbcli.nvim

Basic dbcli query history viewer support with telescope

telescope-dbcli.nvim

Dependencies

This plugin will only work on Neovim nightly (0.5). It also assumes you are already using the popular telescope plugin which can be found here and that you are using some of the dbcli tools i.e. pgcli, mssql-cli

Installation

Using your preferred plugin manager ( Packer and vim-plug for example )

-- Packer
use { 'mark-coyle/telescope-dbcli.nvim' }

-- Plug
Plug 'mark-coyle/telescope-dbcli.nvim'

Run your plugin managers installer :PackerSync/:PlugInstall

Then load the extension in your lua/viml config

-- in lua
require('telescope').load_extension('dbcli')
-- in vimscript
:lua require('telescope').load_extension('dbcli')

Usage

After installing, you should now be able to run :Telescope dbcli or you can map it as you like using something like

:lua require('telescope').extensions.dbcli.pgcli()
:lua require('telescope').extensions.dbcli.mssql_cli()

Config

As it happens, pgcli and mssql-cli have history files that share a format, the same underlying picker logic works for both. As such, you can define the history file path and the prompt title for none, either or both in the telescope extension config.

The defaults for the following config options are the values used in the example, should you need to change the defaults, you can override them like so:

require('telescope').setup {
  extensions = {
    dbcli = {
      pgcli = {
        prompt_title = 'Pgcli History'
        history_file = os.getenv('HOME') .. "/.config/pgcli/history",
        display_timestamp_in_finder = true
      },
      mssql_cli = {
        prompt_title = 'Mssql-cli History'
        history_file = os.getenv('HOME') .. "/.config/mssqlcli/history",
        display_timestamp_in_finder = true
      },
      on_query_select = {
        open_in_scratch_buffer = true,
        add_query_to_register = false
      }
    }
  }
}

About

Basic dbcli query history viewer support with telescope

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages