Ⅰ. 插件描述
Minor quickrun psql settingsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'bootleq/vim-qrpsqlpq'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'bootleq/vim-qrpsqlpq'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'bootleq/vim-qrpsqlpq'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/bootleq/vim-qrpsqlpq
Ⅳ. 文档说明
Vim QuickRun psql Configuration Pack
Some minor setting for using Vim as psql client, with vim-quickrun plugin.
Sorry for such an ugly name, qrpsqlpq for QuickRun PSQL PacK.
This plugin tries to be unobtrusive, only adds sql/qrpsqlpq type for
quickrun, only takes effect when running quickrun with that type.
For example: call qrpsqlpq#run() on a .sql file.
Features
- Output
psqlexecution result in split/vsplit buffer. Format psql "expanded" output result:
- Blank lines between records.
- Fold each record.
- Minor highlight.
Format
EXPLAINoutput result:- Convert time display
cost=1.00..5.00toCOST: 4.00. - Mark bottleneck entry with
MAXtext. - Minor highlight.
- Convert time display
- Detect Rails development db name by Rails.vim.
Config Example
function! s:init_qrpsqlpq()
nmap <buffer> <Leader>r [qrpsqlpq]
nnoremap <silent> <buffer> [qrpsqlpq]j :call qrpsqlpq#run('split')<CR>
nnoremap <silent> <buffer> [qrpsqlpq]l :call qrpsqlpq#run('vsplit')<CR>
nnoremap <silent> <buffer> [qrpsqlpq]r :call qrpsqlpq#run()<CR>
endfunction
autocmd FileType sql call s:init_qrpsqlpq()