By installing python sqlparse module
pip install sqlparse
from vim you can use
:%!sqlformat --reindent --keywords upper --identifiers lower -
so as not to attach the shortcut , pt , I added the following configuration to the .vimrc configuration file:
autocmd FileType sql call SqlFormatter() augroup end function SqlFormatter() set noai " set mappings... map ,pt :%!sqlformat --reindent --keywords upper --identifiers lower -<CR> endfunction
You can tweak sqlformat a bit. Cm.
sqlformat --help
Valerio Crini
source share