vim-database

Introduction

Database management for Neovim.

The supported databases at the moment:

Requirements

Install

Install pynvim

pip3 install pynvim

Install pyyaml

pip3 install pyyaml

Install Neovim plugin

Plug 'dinhhuy258/vim-database', {'branch': 'master', 'do': ':UpdateRemotePlugins'}

Install sqlite3 (Optional - skip if you don’t use sqlite)

brew install sqlite

Install postgres client (Optional - skip if you don’t use postgres)

brew install postgresql

Install msyql client (Optional - skip if you don’t use mysql)

brew install mysql

Usage

You can map these commands to another keys:

nnoremap <silent> <F3> :VDToggleDatabase<CR>
nnoremap <silent> <F4> :VDToggleQuery<CR>
nmap <silent> <Leader>fd :VimDatabaseListTablesFzf<CR>

If you see an error Not and editor command: VDToggleDatabase you need to run :UpdateRemotePlugins. If the error still occurs, run the following command

pip install --user --upgrade pynvim

then restart nvim and re-run :UpdateRemotePlugins and finally restart nvim, :VDToggleDatabase will exist

Key bindings

Check the default key binding here

Configuration

You can tweak the behavior of Database by setting a few variables in your vim setting file. For example:

let g:vim_database_rows_limit = 50
let g:vim_database_window_layout = "bottom"
...

g:vim_database_rows_limit

The maximum number of rows to display in table results.

Default: 50

g:vim_database_window_layout

Set the layout for database window.

Possible values:

Default: left

g:vim_database_window_size

Set size for database window.

Default: 100

Features

Navigate between connection, database, table mode:

Connection mode

Database mode

Table mode

Data mode

Query mode