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

Make lint-on-save and format-on-save configurable #3

Merged
merged 1 commit into from
Feb 12, 2021

Conversation

katesuyu
Copy link
Contributor

@katesuyu katesuyu commented Feb 12, 2021

I personally do not prefer doing linting or formatting on save as it may cause confusing diffs in contributions to other projects if I autoformat every file I modify. However, janet.kak previously hardcoded this functionality, and I couldn't even disable it as the hooks had no group, so I had to remove that part of the code locally. Since I'd prefer not maintaining a fork, I decided to come up with a more constructive solution, which was simply defining config options that can be included in kakrc like so:

plug "pepe/janet.kak" config %{
    set-option global janet_autoformat true
    set-option global janet_autolint true
}

Additionally I made some miscellaneous changes:

  • Normal mode mapping of <a-space> is removed and a snippet of how the user can access the Janet user mode is added to README. It is unidiomatic to define normal mode mappings in Kakoune plugins but you can feel free to define them in your personal kakrc.
  • Default commands for linter and formatter are no longer hardcoded to /usr/local/bin; now they simply expect the command to be in PATH. Users can feel free to override this new behavior by setting janet_formatcmd or janet_lintcmd.

Thank you for making this plugin, it's nice to see other Kakoune users out there. :)

@katesuyu katesuyu changed the title Make lint-on-save and format-on-savve configurable Make lint-on-save and format-on-save configurable Feb 12, 2021
Copy link
Owner

@pepe pepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very fine. Thank you!

@pepe pepe merged commit 6c1493e into pepe:master Feb 12, 2021
@pepe
Copy link
Owner

pepe commented Feb 12, 2021

Thank you for the very kind words, and indeed I am happy to know another Kakoune + Janet user out there. Especially with PR :-D. I need to look closely at the .kakrc of yours to learn something. Just from little snoop, Joule became my default color scheme.

@pepe
Copy link
Owner

pepe commented Feb 15, 2021

@katesuyu FYI, it seems that for some reason, janet-configure-buffer is not called when opening Janet files. I have set both variables to true, but without running :janet-configure-buffer after loading buffer, they have no effect.

Also, janet user-mode is not working anymore, even after janet-configure-buffer.

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

Successfully merging this pull request may close these issues.

2 participants