Closed amontalenti closed 10 years ago
Hi. Sorry for the delay in replying. I can't reproduce this on NetBSD (which is what I'm on currently). Which platform are you on?
Did you know that Simplenote.vim now respects the markdown flag in Simplenote? For example if you set as markdown in the web interface and then open via Simplenote.vim it will open with filetype=markdown
. You could then unset this in vim (:set filetype=txt
) and update via Simplenote.vim (:Simplenote -u
) and the markdown flag will have been removed in the web interface.
We could think about using the presence of the g:SimplenoteFiletype = "markdown"
setting to ensure the markdown flag is set in Simplenote for new notes created and notes updated via Simplenote.vim
I'm on Ubuntu 12.04 LTS (Linux).
When you say, "did you know Simplenote.vim now respects the markdown flag in Simplenote", now as of when? I just installed the plugin last week.
Sorry (again) missed the second part of your comment. If you've installed it from here (i.e. via git) then it has been there from quite some time (since September/December 2013). If you've installed from Vimscripts then it won't have that functionality (that's stuck on the 0.7.0 release).
Ok, so I think I've just been affected by this. Recently been setting Gvim up on Windows and it seems to suffer from this issue as well.
I don't think it is just because of Gvim though; I'm pretty sure I never saw this on Arch Linux with Gvim; On NetBSD I only use (terminal) vim.
I'll have a think about a better way of fixing this.
Hi. I think this problem is to do with doautocmd BufReadPost
which was introduced recently.
I've only investigated on opening new notes so far, but changing the order of these lines:
if note.has_key("systemtags"):
if ("markdown" in note["systemtags"]):
vim.command("setlocal filetype=markdown")
vim.command("setlocal nomodified")
vim.command("doautocmd BufReadPost")
to this:
vim.command("setlocal nomodified")
vim.command("doautocmd BufReadPost")
if note.has_key("systemtags"):
if ("markdown" in note["systemtags"]):
vim.command("setlocal filetype=markdown")
Seems to do the trick at least as far as the auto-detection of the markdown flag in simplenote. I'll carry on looking into this (for the use case of g:SimplenoteFiletype
) and update here when done.
That fixes it as far as I can tell from my testing, but please let me know if you are still having issues.
Thanks for reporting it as well and sorry for the delay in being able to reproduce it.
Even though I set
When I open notes that are Markdown-formatted and that start with a line like this:
My vim
filetype
will be set toconf
. I wondered why this might be; it turns out it's because vim has some logic in the system filetype detection that if it sees a file with a leading "#" as its first char, it'll guess the "configuration" filetype. This is revealed with this:The solution I came up with is slightly dramatic -- I changed the plugin to give the scratch buffers the name
<simplenote-id>.md
. This would cause myfiletype.vim
logic to kick in based on file extension, which would force the setting offiletype=markdown
. There is probably a better way to fix this, but my vim-plugin-fu is a little weak so I am looking to you for some better ideas.Cheers on a great plugin, BTW!