Re: load two plugins for one file type

Gary Johnson <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <20241118185647.GN15474@phoenix>
On 2024-11-18, Riza Dindir wrote:
> Hello
> 
> Is it possible to load two script files for one file type? For instance vim
> defines its own plugin for a file type. I want to extend that, or add a new
> style of mappings for that file type.
> 
> Would it be possible to load two plugin files, one in the default vim plugins
> directory, ftplugin which I do not want to change, and one in the ~/.vim/
> ftplugin directory which I have access to (to change, update) for a file type?

Yes.  Put your changes in a new file,
~/.vim/after/ftplugin/<filetype>.vim, where <filetype> is the name
of the file type you want to affect.  For example,
~/.vim/after/ftplugin/python.vim.

Vim loads filetype plugins in the order determined by 'runtimepath'.
For Unix, that would normally be:

    1.  ~/.vim/ftplugin/<filetype>.vim
    2.  $VIM/vimfiles/ftplugin/<filetype>.vim
    3.  $VIMRUNTIME/ftplugin/<filetype>.vim
    4.  $VIM/vimfiles/after/ftplugin/<filetype>.vim
    5.  ~/.vim/after/ftplugin/<filetype>.vim

Vim's default plugins are in $VIMRUNTIME; local system-wide plugins
are in $VIM/vimfiles; and your personal plugins are in ~/.vim.

By putting your changes in your "after" directory, you can override
settings made by the other plugins for that file type and not have
your settings overridden by them.

See
    :help ftplugin-overrule
    :help 'runtimepath'

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/20241118185647.GN15474%40phoenix.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.