Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

dadbod.vim: Modern database interface for Vim

NotificationsYou must be signed in to change notification settings

tpope/vim-dadbod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dadbod is a Vim plugin for interacting with databases. It's a more moderntake ondbext.vim, improving on it on the following ways:

  • Connections are specified with a single URL, rather than prompting you for14 separate variables
  • All interaction is through invoking:DB, not 53 different commands and 35different maps (omitting many of the more esoteric features, of course)
  • Supports a modern array of backends, including NoSQL databases:
    • Big Query
    • ClickHouse
    • DuckDB
    • Impala
    • jq
    • MongoDB
    • MySQL
    • MariaDB
    • Oracle
    • osquery
    • PostgreSQL
    • Presto
    • Redis
    • Snowflake
    • SQL Server
    • SQLite
    • Your own easily implemented adapter
  • Easily configurable based on a project directory (as seen inrails.vim,for example), rather than just globally or in a per-file modeline
  • For those that just can't live without some piece of dbext functionality,the optiong:dadbod_manage_dbext is provided to force dbext to useDadbod's default database.

Usage

The:DB command has a few different usages. All forms accept a URL as thefirst parameter, which can be omitted if a default is configured or providedby a plugin.

Omit further arguments to spawn an interactive console (likepsql orredis-cli).

:DB postgresql:///foobar:DB redis:

If additional arguments are provided, they are interpreted as a query stringto pass to the database. Results are displayed in a preview window.

:DB sqlite:myfile.sqlite3 select count(*) from widgets:DB redis:/// CLIENT LIST

Give a range to run part or all of the current buffer as a query.

:%DB mysql://root@localhost/bazquux

Use< to pass in a filename.

:DB mongodb:///test < big_query.js

There's also a special assignment syntax for saving a URL to a Vim variablefor later use.

:DB g:prod = postgres://user:pass@db.example.com/production_database:DB g:prod drop table users

A few additional URL like formats are accepted for interop:

  • :DB jdbc:sqlserver://...
  • :DB dbext:profile=profile_name
  • :DB dbext:type=PGSQL:host=...
  • :DB $DATABASE_URL (with optionaldotenv.vim support)

Plugins can provide their own URL handlers as well. For example,heroku.vim provides support forheroku:appname style URLs.

If you want to manage multiple connections at once through UI,trydadbod-ui.

Installation

Install using your favorite package manager, or use Vim's built-in packagesupport:

mkdir -p ~/.vim/pack/tpope/startcd ~/.vim/pack/tpope/startgit clone https://tpope.io/vim/dadbod.gitvim -u NONE -c "helptags dadbod/doc" -c q

Promotion

Like dadbod.vim? Star the repository onGitHub and vote for it onvim.org.

Love dadbod.vim? Followtpope onGitHub andTwitter.

License

Copyright © Tim Pope. Distributed under the same terms as Vim itself.See:help license.


[8]ページ先頭

©2009-2025 Movatter.jp