Skip to content

Conversation

reynoldsme
Copy link
Contributor

@reynoldsme reynoldsme commented Apr 10, 2024

When using the editor command in iamb, the temporary file currently has no file extension. This is probably a reasonable default behavior, but some users may want to hint to their editor a particular file type such as .md or .txt to make use of linters, formatters, spell checkers, or other file type specific editor configurations.

This PR preserves the default behavior sets the default suffix to .md while adding a external_edit_file_suffix configuration option which accepts a string to append to the end of the temporary file name passed to the users editor.

user_gutter_width: self.user_gutter_width.or(other.user_gutter_width),
external_edit_file_suffix: self
.external_edit_file_suffix
.or(other.external_edit_file_suffix),
Copy link
Owner

Choose a reason for hiding this comment

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

I would be fine with an .unwrap_or_else(|| ".md".into()) here. iamb interprets the text as markdown, so that's probably the most useful default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, PR updated.

@ulyssa ulyssa changed the title Add external edit file suffix config Add external_edit_file_suffix to config Apr 12, 2024
@ulyssa ulyssa merged commit b995906 into ulyssa:main Apr 12, 2024
@ulyssa
Copy link
Owner

ulyssa commented Apr 12, 2024

Merged! Thank you for thinking to add this! 🎉 Getting syntax highlighting is I imagine one of people's big reasons to use an external editor, so this should make that much easier on them. (Although it would be nice to eventually implement it in the message bar, too.)

@reynoldsme
Copy link
Contributor Author

Happy to help, and thank you for creating and maintaining iamb!

@ulyssa ulyssa added this to the v0.0.10 milestone Apr 24, 2024
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