Okay. Yee Cheng reminds me that I should be able to restrict this behavior to the markdown filetype. And this should work by means of ~/.vim/ftplugin/markdown.vim.
Indeed! This works for me -- but only if I hide my personal .vimrc file! In fact, if that file exists, the markdown.vim script will not be loaded, *even if the .vimrc is empty! *I confirmed this via the :scriptnames command in the editor. What is going wrong, that simply doing "touch .vimrc" to create an empty .vimrc file is sufficient to cause this mechanism to fail? So... rename / remove my .vimrc, and I can open a '.md' file in MacVim, and the :scriptnames command shows ~/.vim/ftplugin/markdown.vim is loaded. Now I close that file, and do "touch .vimrc" at the commandline, and open the same file... and markdown.vim is not loaded. The file .vimrc exists -- but it's empty. On Sunday, July 9, 2023 at 12:31:05 AM UTC-7 David Finton wrote: > Thank you; that makes sense! I tried putting the file in > ~/.vim/ftplugin and it had no effect. Could you suggest another place to > try? > > --David > > > > On Jul 8, 2023, at 11:28 PM, Yee Cheng Chin <ychin....@gmail.com> wrote: > > I think the reason why the article you linked to uses a ftplugin file in > .vim folder is to make sure it only gets set when you are editing a > Markdown file. Otherwise if you do it in your own vimrc it will be set for > all file types unless you explicitly uses a FileType auto-command to do the > same thing. My guess is that you put the file at the wrong place, which > resulted in it not being loaded in. > > On Saturday, July 8, 2023 at 9:54:54 PM UTC-7 David Finton wrote: > >> Solved. >> >> I looked for info on setting the variable makeprg in Vim. In Vim, ":set >> mp" showed me that the makeprg variable was still set to its default value >> of "make". But I also realized that I could change that setting in my >> ~/_vimrc file, rather than in a script under the ".vim" folder. >> >> I used the same exact setting line from Rob Allen's article, but I used >> it to set the "makeprg" variable directly in my vimrc. >> >> Works like a charm. >> >> >> On Tuesday, July 4, 2023 at 5:27:22 PM UTC-7 David Finton wrote: >> >>> I found a simple recipe for configuring ".make" in MacVim to >>> automatically bring up Marked 2 for markdown rendering as I edit. I can't >>> get it to work. Perhaps there is a simpler way? >>> >>> The recipe is from Rob Allen: Use Vim's :make to preview markdown >>> <https://dzone.com/articles/use-vims-make-to-preview-markdown> >>> >>> So I have the file ~/.vim/ftplugin/markdown.vim, and it contains the >>> following line: >>> >>> set makeprg=open\ -a\ Marked\\\ 2.app\ '%:p' >>> When I try ":make" in MacVim, it reports the following: >>> >>> make: *** No targets specified and no makefile found. Stop. >>> >>> I can manually start Marked 2, and in Marked 2 find the file I'm editing >>> and open it, and that works. But I would like to do this with a keystroke >>> from MacVim. Rob Allen's page filled me with hope that this was possible >>> and easy. Am I close? >>> >>> Thanks! >>> >> > -- > -- > You received this message from the "vim_mac" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to a topic in the > Google Groups "vim_mac" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/vim_mac/246RNCSsiyo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > vim_mac+u...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_mac/3b27eef1-ac93-4217-a134-19ca8c8d930fn%40googlegroups.com > > <https://groups.google.com/d/msgid/vim_mac/3b27eef1-ac93-4217-a134-19ca8c8d930fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- -- You received this message from the "vim_mac" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_mac" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_mac/09415578-b5f8-4a98-9c9f-ab299af0b7c4n%40googlegroups.com.