Ⅰ. 插件描述
Edit mysql queries with full power of VIM and show results in a split window immediately.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'lokikl/vim-mysql-mode'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'lokikl/vim-mysql-mode'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'lokikl/vim-mysql-mode'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/lokikl/vim-mysql-mode
Ⅳ. 文档说明
# VIM MySQL Mode #
This plugin is a replacement of the command line mysql client.
You may edit queries with full power of VIM and shows results in a split window.
Installation
I recommand you to install this plugin with Vundle, just add this line to your .vimrc:
Bundle "loki-nkl/vim-mysql-mode"
Usage
First, please enter the MySQL Mode with:
:MySQLMode
Information like host, port, db name, username and password are asked for setting up connection.
If you want to reset connection, just execute :MySQLMode again.
You should then see two split windows. Let's enter some mysql queries inside the bottom one.
Now go to normal mode and press the F5 key, your queries are executed and you should see the
result in the top split.
Misc
Also encouraging you to use this plugin with Syntastic and Ultisnips, having the power of
syntax checking and snippet support.
Normally, I launch this vim mysql console to touch to my local database directly through a shell command.
function vimsql(){
gvim -c "let g:mysqlModeDBName='$1' | ruby enter_mysql_mode"
}
With the autocompletion power from zsh.
#compdef vimsql
#autoload
compadd -x 'DBs' `mysql -uroot -e 'show databases \G' | grep Database | awk '{print $2}'`
With this setup, I can get into the console by typing vimsql mydb with the autocomplete when vimsql <TAB>.