Database management for Neovim.
- Database explorer
- Ability to execute queries
- Edit/ copy/ delete data
- ...
The supported databases at the moment:
- SQLite
- MySQL
- PostgreSQL
- Neovim (vim is not supported)
- Python 3.9
- pynvim
- pyyaml
- sqlite3
- psql
- mysql
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
VDToggleDatabase
: Open or close database managementVDToggleQuery
: Open or close query terminalVimDatabaseListTablesFzf
: List all tables in fzf
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
Check the default key binding here
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"
...
The maximum number of rows to display in table results.
Default: 50
Set the layout for database window.
Possible values:
left
right
above
below
Default: left
Set size for database window.
Default: 100
Navigate between connection, database, table mode:
<Leader> c
: Go to connection mode<Leader> d
: Go to database mode<Leader> t
: Go to table mode
- New connection (press
c
) - Delete connection (press
dd
) - Select connection (press
s
) - Modify connection (press
m
)
- Select database (press
s
)
- Filter table (press
f
) - Clear filter (press
F
) - Select table (press
s
) - Delete table (press
dd
) - Describe table (press
.
)
- Sort asc (press
o
) - Sort desc (press
O
) - Filter (press
f
) - Clear filter (press
F
) - Filter columns (press
a
) - Clear filter columns (press
A
) - Delete row (press
dd
) - Modify row at column (press
m
) - Copy row (press
p
) - Show create row query (press
C
) - Show update row query (press
M
) - Show update row query (press
P
) - Describe table (press
.
) - Next page (press
right-arrow
) - Previous page (press
left-arrow
)
- Execute the query (press
r
)