all repos — nixfiles @ 8183780e3193c469de85d24038ceb8ec1e3bac61

System and user configuration, managed by nix and home-manager

Emacs: format SQL files on save
Alan Pearce alan@alanpearce.eu
Wed, 26 Aug 2020 14:07:10 +0200
commit

8183780e3193c469de85d24038ceb8ec1e3bac61

parent

36257b88baa227337e9ea70df9e8bb8318adafca

3 files changed, 8 insertions(+), 0 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -919,6 +919,12 @@ :ghook ('(javascript-mode-hook typescript-mode-hook) #'prettier-js-mode t)   :config (progn
             (setq prettier-js-show-errors 'echo)))
 
+(use-package sqlformat
+  :ghook ('sql-mode-hook sqlformat-on-save-mode)
+  :config (progn
+            (setq sqlformat-command 'pgformatter
+                  sqlformat-args '("-s2"))))
+
 ;;; E-mail
 
 (declare-function sendmail-send-it "sendmail")
M user/settings/emacs.nixuser/settings/emacs.nix
@@ -167,6 +167,7 @@ ripgrep       rjsx-mode
       scss-mode
       spacemacs-theme
+      sqlformat
       swiper
       tide
       toml-mode
M user/settings/satoshipay.nixuser/settings/satoshipay.nix
@@ -19,6 +19,7 @@ caddy     openssl
     mongodb-tools
     pgcli
+    pgformatter
     s3cmd
     sops