Last active
February 27, 2018 07:46
-
-
Save achiku/c1832e59ba8cb033d481891cbd1865d6 to your computer and use it in GitHub Desktop.
sqlformat.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"" sqlfmt | |
let g:sqlfmt_command = "sqlformat" | |
let g:sqlfmt_options = "-r -k lower --comma_first True -" | |
function! SQLfmtv() range | |
let tmp = @@ | |
silent normal gvy | |
let selected = @@ | |
let @@ = tmp | |
let cmd = printf("%s %s << SQL\n%s\nSQL", g:sqlfmt_command, g:sqlfmt_options, selected) | |
echo cmd | |
let lines = system(cmd) | |
echo lines | |
endfunction | |
command! -range SQLfmtv :call SQLfmtv() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment