Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure with vim? #68

Open
coolaj86 opened this issue Sep 18, 2024 · 1 comment
Open

How to configure with vim? #68

coolaj86 opened this issue Sep 18, 2024 · 1 comment

Comments

@coolaj86
Copy link

coolaj86 commented Sep 18, 2024

I tried to configure this with vim based on... the LLM that shall not be named... but when I add this to my ~/.vimrc it deletes the file and replaces it with the error message on error.

" Auto-format SQL files with sqlfmt on save
autocmd BufWritePre *.sql execute ':silent %!sqlfmt'

A misplaced comma like this

CREATE TABLE IF NOT EXISTS "customers" (
    "id" UUID PRIMARY KEY,
    "nickname" VARCHAR(255),
);

becomes

at or near ")": syntax error
@maddyblue
Copy link
Owner

Ah! sqlfmt should be changed to exit with non-zero in this case to communicate to tools that...there was an error. Or it should have a cli flag that ignores errors and outputs the input unchanged. Or it does everything: non-zero exit code, copies input directly to stdout, prints error on stderr. That'd enable tools to decide what to do on error. I'm unlikely to make this change, but would review such a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants