GithubHelp home page GithubHelp logo

kelsey-sorrels / vim-db Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tpope/vim-dadbod

0.0 1.0 0.0 14 KB

Modern database interface for Vim

Home Page: https://www.vim.org/scripts/script.php?script_id=5665

Vim Script 100.00%

vim-db's Introduction

db.vim

DB is a Vim plugin for interacting with databases. It's a more modern take on dbext.vim, improving on it on the following ways:

  • Connections are specified with a single URL, rather than prompting you for 14 separate variables
  • All interaction is through invoking :DB, not 53 different commands and 35 different maps (omitting many of the more esoteric features, of course)
  • Supports a modern array of backends, including NoSQL databases:
    • MongoDB
    • MySQL
    • PostgreSQL
    • Redis
    • Sqlite
    • Your own easily implemented adapter
  • Easily configurable based on a project directory (as seen in rails.vim, for example), rather than just globally or in a per-file modeline

Usage

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

Omit further arguments to spawn an interactive console (like psql or redis-cli).

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

If additional arguments are provided, they are interpreted as a query string to 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 mongo:///test < big_query.js

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

:DB g:prod = postgres://user:[email protected]/production_database
:DB g:prod drop table users

A few additonal URL like formats are accepted for interop:

  • :DB jdbc:postgresql://...
  • :DB dbext:profile_name
  • :DB dbext:type=PGSQL:host=...
  • :DB $DATABASE_URL (with optional dotenv.vim support)

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

Installation

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

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/db.git
vim -u NONE -c "helptags db/doc" -c q

Promotion

Like db.vim? Star the repository on GitHub and vote for it on vim.org.

Love db.vim? Follow tpope on GitHub and Twitter.

License

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

vim-db's People

Contributors

tpope avatar

Watchers

Kelsey Sorrels avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.