Monday, November 18, 2024

Re: load two plugins for one file type

Thanks

On Mon, Nov 18, 2024 at 9:57 PM Gary Johnson <garyjohn@spocom.com> wrote:
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/20241118185647.GN15474%40phoenix.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CA%2Bek4BGn9JsLrxJiCQxeKbSfGRjD4-3nGWJrDDK_BfMq2t2%2BwQ%40mail.gmail.com.

No comments: