Assuming that the plugin is using the standard scheme for filetype specific configuration...
Probably the simplest way to override is by creating a file in $MYVIMDIR/after/ftplugin with filename that matches the filetype (aka ft) setting when such a file is loaded. The plugin likely has a file of the same name and it will either be in directory ftplugin ...
You are looking for :h ftplugin-overrule:
If a global filetype plugin does not do exactly what you want, there are three
ways to change this:
1. Add a few settings.
You must create a new filetype plugin in a directory early in
'runtimepath'. For Unix, for example you could use this file:
You can set those ...
In the end, the comments above were very helpful in narrowing down the problem - thanks, everyone! I've resolved it now, and the filetype is only set once. To summarize, there were several issues here:
The problem only affected Markdown files, which I didn't originally realise - sorry for not being more thorough in my original problem determination. This ...
Interesting situation. Let's first address debugging it. It seems your experience with adding a normal iABCDE to the .vim/ftplugin/mail.vim and seeing it twice really suggests this file is being sourced more than once.
I think one thing you can try is adding statements that can display where &filetype was set and also show the stack trace of the function ...
When in doubt look into the standard Vim runtime files.
ts sts et sw should be set by after/ftplugin.
sta is basically no-op, as you have &sw == &sts anyway.
si ai are basically no-op as you have &cindent on. And also, in general, there's nothing in setting ai si on if you have any meaningful indent/xyz.vim.
cino should probably be set by after/...
You don't need to use an autocmd or anything, because the scripts under ftplugin are already loaded by an autocmd triggered when the filetype is actually set.
For example, for filetype markdown, the autocmd that loads ftplugin is equivalent to:
autocmd FileType markdown runtime! ftplugin/markdown.vim ftplugin/markdown_*.vim ftplugin/markdown/*.vim
So you ...
I have a file called ~/.config/nvim/after/ftplugin_after.vim
The correct path you're looking for is actually:
Note that ftplugin needs to be a directory, and that the *.vim file inside it must be named after the filetype of the files you would like to match.
The ftplugin scripts must always match a specific filetype, ...
So what opens this additional buffer is your command exe ":botright copen", :h :copen is used to open the quickfix window. As you use it no matter how the compilation went, when the compilation is successful the quickfix doesn't contain anything and the buffer looks open.
So the first thing to do is to remove the useless usages of :exe: In exe &...
I'm sorry I don't understand the specifics of your question.
At best I guess you want to cache the previous user choice, that could have been done in the ftplugin or the user .vimrc.
get(g:, 'varname', defaultvalue) may help here.
May be something like the following?
function! s:register_linter() abort
au BufWritePre <...
It is normal, you are not using the correct directory. See :h mysyntaxfile-add:
If you are mostly satisfied with an existing syntax file, but would like to
add a few items or change the highlighting, follow these steps:
1. Create your user directory from 'runtimepath', see above.
2. Create a directory in there called "after/syntax". For Unix: >
It turns out, there is a subtle interaction between FileType events and the
actual ftplugin mechanism.
When the filetype is changed, all matching FileType events are run. As near
as I can tell, this is one of the first things to be done.
So the current "state" would include both the buffer-local mapping and the
b:undo_ftplugin necessary to undo it. This ...