Open cenksoykan opened 5 years ago
Thanks for the contribution. I'm not entirely sure this dot notation is correct. Can you point to VIM documentation somewhere explaining how it is supposed to work?
Of course, here it is :arrow_right: VimDoc
:h 'filetype'
When a dot appears in the value then this separates two filetype
names. Example:
/* vim: set filetype=c.doxygen : */
This will use the "c" filetype first, then the "doxygen" filetype.
This works both for filetype plugins and for syntax files. More than
one dot may appear.
Thanks for that link.
If the default VIM filetype is rmd
where is the rmarkdown
value even entering the picture? Is that our doing? If so would we be better off just changing that to rmd across the board?
It might be before the vim support #15 Indeed it is better to change it
You can see the defaults
:echo glob($VIMRUNTIME . '/ftplugin/*.vim')
:echo glob($VIMRUNTIME . '/syntax/*.vim')
I just did a pretty complete code review and don't see anywhere else in this plugin it even needs changing. Can you just make these two lines read filetype=rmd
?
After that we'll need one more commit that renames the files and add symlinks. If you like you can cherry pick this commit into your branch (or I can push it) after you fix the thing in my previous comment.
Katkıda bulunduğun için teşekkür ederim.
If the default VIM filetype is
rmd
where is thermarkdown
value even entering the picture? Is that our doing? If so would we be better off just changing that to rmd across the board?
That is indeed our doing. The reason we have a different filetype is the same as why vim-pandoc uses pandoc
as the filetype instead of markdown
: since vim already provides an rmd filetype, instead of adding to it, we try to set everything on our own (of course, rmarkdown uses the pandoc markdown support underneath).
@fmoralesc Hum. I'm going to have to sleep on this here, I'm not sure we're doing this right. That actually makes sense, and yet it seems like that shouldn't be what we need to do.
@fmoralesc Two questions.
Is there no way to clear other values before setting new ones?
Given that our issue with *.md
files is that they are ambiguous and could be generic Markdown or the could be Pandoc Flavored Markdown, to you still think this case is analogous since *.rmd
files are a specific flavor already identified by a different filetype value?
@fmoralesc I think we need to resolve this, it's still tripping people up and seems wrong to me still. Any feedback on my #2 question above?
The difference between filetype rmd
and rmarkdown
creates an issue with the Nvim-R
plugin. Sending R code chunk to console with <leader>cc
doesn't work when filetype is rmarkdown
but works when filetype is rmd
. On the other hand the command :RM
works when filetype is rmarkdown
but doesn't work when filetype is rmd
.
This leads to the user having to switch manually between the different filetypes. After switching from rmarkdown
to rmd
filetype once after opening a .Rmd
file the Nvim-R
plugin behaves correctly (<leader>cc
at least works) and the :RM
command works. So I was using a hacky solution taking advantage of this:
In the directory ~/.config/nvim/after/ftdetect
(need to create this if non-existent) I put an rmarkdown.vim
file where I override the rmarkdown
filetype with rmd
like so
augroup rmarkdown
au BufRead,BufNewFile *.Rmd set filetype=rmd
au BufRead,BufNewFile *.Rpres set filetype=rmd
augroup END
Note that I use au
without !
because otherwise the commands in the plugin specific script ~/.local/share/nvim/plugged/vim-rmarkdown/ftdetect/rmarkdown.vim
would not be run to set the filetype to rmarkdown
to begin with.
I don't think this is a permanent solution and it might cause something to break but I haven't run into problems yet. I will report back if I do. The best solution would of course be that this plugin uses the rmd
filetype but I have not looked into whether this is possible.
Update: This commit fixes this issue so no need for the hacky solution.
Default filetype is rmd for that reason I added rmd before rmarkdown to fix compatibility issues with any other plugin uses the default. But I don't know if this plugin fails for any significant reason with that change. I have tried and so far it works very fine in general