Open pataquets opened 2 years ago
@pataquets I don't think this is necessary, because sncli is supposed create a tempfile with a filename extension depending on the type (.mkd for markdown and .txt for plain text). So your editor should automatically pick up the filetype=markdown for markdown notes, or you can run an autocmd based on the extension *.mkd
or anything specific to sncli notes by matching on sncli-temp-*
.
However I do notice there's a bug(?) where sncli will set the filetype based on cfg_default_markdown
, rather than checking with the note... that might be worth addressing.
@pataquets https://github.com/insanum/sncli/pull/122 may address your request, albeit in a slightly different way. Would you like to test it out? :)
@swalladge : I didn't noticed the bug, as I was using the pager most of the time. But opening with $EDITOR
makes it visible. PR now correctly sets temp file extensions according to note type. LGTM.
However, I've noticed the extension mkd
being used. Although it's recognized almost everywhere, I've found the most commonly used extension to be md
, which is always recognized. Check out this SU thread. For the widest compatibility, I would bet safe on md
as temp file extension. WDYT?
I've stumbled on this, since I'm using bat as my pager, and it's not detecting mkd
as Markdown (although there is a workaround). I'll see if I manage to sort out my issue, but the PR helps, indeed.
PR now correctly sets temp file extensions according to note type. LGTM.
Thanks. :)
However, I've noticed the extension mkd being used. Although it's recognized almost everywhere, ... For the widest compatibility, I would bet safe on md as temp file extension. WDYT?
I 100% agree. I just have a minor concern about backwards compatibility - I don't know how many users have scripts and such that depend on the *.mkd
naming... So perhaps we could open a pull request and keep it open for comments for a period of time?
PR now correctly sets temp file extensions according to note type. LGTM. Thanks. :)
Oops, meant to add: would you mind adding your comment to the PR just for records sake? Just so I'm not merging a new PR with no reviews or comments :grimacing:
[...]
However, I've noticed the extension mkd being used. Although it's recognized almost everywhere, ... For the widest compatibility, I would bet safe on md as temp file extension. WDYT?
I 100% agree. I just have a minor concern about backwards compatibility - I don't know how many users have scripts and such that depend on the
*.mkd
naming... So perhaps we could open a pull request and keep it open for comments for a period of time?
Me too. A PR open for a while seems like a nice compromise.
@pataquets https://github.com/insanum/sncli/pull/123 :)
Markdown notes may benefit from specific, customized pager and editor command, eg:
vim +'set ft=markdown'
. Somecfg_editor_markdown
configuration setting (with fallback tocfg_editor
if not present) might do. Alternatively, passing note flags as command-line parameters (as done with{fname}
) would enable writing a script to solve this.