Awesome Open Source
Awesome Open Source

vim-sql-suggest

Use the omnicomplete popup menu to explore and complete SQL table and column names. The plugin currently supports mysql and postgres databases.

The Plugin In Action

sql-suggest

Usage

The plugin provides one function to call for completing tables and columns and a convenience function for easily switching the database that suggestions are provided for.

Mapping The Functions

You will need to map the complete function in insert mode. Here is an example. <Leader>sc will complete for columns and <Leader>st will complete for tables.

inoremap <Leader>sc <C-R>=SQLComplete("column")<CR>
inoremap <Leader>st <C-R>=SQLComplete("table")<CR>

Default Database

You can set a default database by setting the variable suggest_db in your .vimrc like so:

let g:suggest_db = "psql -U Jrock example_table"

You can also use the command UpdateSuggestDB to easily set the database that the plugin will look in for completions.

Installation

Use your plugin manager of choice.

  • Pathogen
    • git clone https://github.com/JarrodCTaylor/vim-sql-suggest ~/.vim/bundle/vim-sql-suggest
  • Vundle
    • Add Bundle 'JarrodCTaylor/vim-sql-suggest' to .vimrc
    • Run :BundleInstall
  • NeoBundle
    • Add NeoBundle 'JarrodCTaylor/vim-sql-suggest' to .vimrc
    • Run :NeoBundleInstall
  • vim-plug
    • Add Plug 'JarrodCTaylor/vim-sql-suggest' to .vimrc
    • Run :PlugInstall
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (820,562
Plugin (113,722
Database (92,852
Sql (22,125
Vim (18,647
Names (6,116
Suggestions (2,951