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

Otter in Nix files #59

Closed
LamprosPitsillos opened this issue Oct 19, 2023 · 6 comments
Closed

Otter in Nix files #59

LamprosPitsillos opened this issue Oct 19, 2023 · 6 comments

Comments

@LamprosPitsillos
Copy link

Would it be possible to use otters in nix files with anotated code blocks?

nvim-treesitter/nvim-treesitter#4658

@jmbuhr
Copy link
Owner

jmbuhr commented Oct 19, 2023

Not quite yet, but I'm working on some improvements to the parsing (in
#60) and took the opportunity to also include those special comments you show for nix, which looks to work so far!

image
image

@LamprosPitsillos
Copy link
Author

LamprosPitsillos commented Oct 19, 2023

Really exciting!
Thanks for your work. If you need testers @ me , I'll be glad to help

@jmbuhr
Copy link
Owner

jmbuhr commented Oct 20, 2023

You can already test with this branch, if you want. Let me know if you find bugs :)

@koalagang
Copy link

Adding nix support to otter could be interesting to use when writing shell scripts in nix files. It would solve a problem I have where I like to write my shell scripts declaratively with nix but miss out on stuff like formatters (shfmt) and linters (shellcheck). It could also be useful for homemanager users who use home.file.<name>.text.

P.S. For anyone curious, here's a great video demonstrating writing shell scripts inside nix files.

@jmbuhr
Copy link
Owner

jmbuhr commented Oct 26, 2023

The branch is merged now, feel free to try it out. Formatting as you mentioned should also work if you have a language server that supports "textDocument/rangeFormatting" requests, via otter.ask_format

@jmbuhr
Copy link
Owner

jmbuhr commented Oct 26, 2023

Though if is is a separate formatter not part of a language server, the easier approach is to use vims native filters, e.g. visual mode select followed by :!shfmt if shfmt accepts input at stdin.

@jmbuhr jmbuhr closed this as completed Oct 29, 2023
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

3 participants