更多分享内容可访问我的个人博客
本文介绍如何将 vim 打造为优秀的 sql 编辑器。本文内容仅涉及对 sql 编辑的基本配置,要获取完整的体验请参考vim 专栏。
代码检查、格式化与代码补全
代码检查与格式化只需安装coc.nvim
以及coc-sql
插件即可。
coc.nvim
的安装与配置可以参考另一篇文章。
参考链接文章中的自定义补全源
一节自定义 sql 关键字补全文件。可参考以下内容。
function! coc#source#sql#init() abort
return {
\'triggerCharacters': [''],
\'filetypes' : ['sql'],
\}
endfunction
function! coc#source#sql#complete(opt, cb) abort
let items = ['ADD','ADD CONSTRAINT','ALL','ALTER','ALTER COLUMN','