Ⅰ. 插件描述
Run SQL straight from VIMⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'trevorgrayson/vim-oink'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'trevorgrayson/vim-oink'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'trevorgrayson/vim-oink'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/trevorgrayson/vim-oink
Ⅳ. 文档说明
# vim-oink
Run SQL straight from VIM
Are you cating raw SQL into the psql command? Does your [ "$EDITOR" == "vim" ]? Then this is the vim plugin for you!
If you are using Postgres and you've saved your credentials in your workbench/editor, there is a good chance this plugin will already know all your passwords! This plugin leverages ~/.pgpass which is probably storing all your passwords in clear text. Is that a good idea? Probably not, but it's going to be freaking sweet if this works!
To get started, copy the *.vim files from the plugin folder into your .vim/plugin directory. Restart vim and try the following commands:
:PgConnect
:PgStatus
:PgDatabases
:PgTables
:PgSchemas
You may set your environment with the following commands:
:PgSetHost
:PgSetUser
:PgSetDatabase
Write some SQL in VIM and try the following:
:PgExecBuf
:PgExplainBuf
Make sure you have syntax highlighting on, and have a ball!
This expects that you have the psql executable installed on your machine. Presently Postgres only, but expect this to expand to MySQL and friends.
Development
source plugin/*