1

I change this file, but it seems that I have to restart Vim to make it take effect.

Is there any way to make .vim/after/ftplugin/markdown.vim take effect immediately?

I already tried :source and :runtime, which do not work.

1
  • 1
    Can you please edit with (1) exacts steps you take, (2) the results, (3) what you expect and how that differs from (2), and (4) any code snippets that are relevant?
    – D. Ben Knoble
    Commented Feb 7, 2022 at 14:01

1 Answer 1

1

Your best option is probably to trigger the autocommands which are triggered when you set the filetype. To do so you can use :h :doautocmd with the event FileType:

:doautocmd filetype

For example:

  • Open test.md
  • Type ia to insert a a
  • Edit ~/.vim/ftplugin/after/markdown.ft to add inoremap a A
  • Switch back to test.md
  • Run doautocmd filetype
  • ia will insert A instead of a

Note that you probably want to add you customization to ~/.vim/after/ftplugin directory, this will allow to run the built-in ftplugins and your own directives instead of overriding the built-in ones (which happens when you use ~/.vim/ftplugin/

1
  • 1
    Thanks, it works.
    – Tokubara
    Commented Feb 7, 2022 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.