Thank you. Have created a plugin file and put that into the ~/.vim/after/ftplugin. It is working.
But one thing that I was doing in the plugin script was setting foldmethod, foldexpr, and foldtext with setlocal. But these were not being run because they were put after the "if exists" check I am doing in the plugin so that it is not loaded twice. I moved these before the "if exists" check. Is this the way to do it for plugins? Or should these be done in another file?
Here is the start of the plugin...
// Should these be moved somewhere else. This is a file type plugin.
setlocal foldmethod=expr foldexpr=PodFold()
setlocal foldtext=PodFoldText()
if exists("g:loaded_podotl")
finish
endif
let g:loaded_podotl = 1
setlocal foldtext=PodFoldText()
if exists("g:loaded_podotl")
finish
endif
let g:loaded_podotl = 1
Regards
On Wed, Nov 20, 2024 at 8:06 PM Charles Campbell <astrocec50@gmail.com> wrote:
Riza Dindir wrote:
> Thanks
>
> On Mon, Nov 18, 2024 at 9:57 PM Gary Johnson <garyjohn@spocom.com
> <mailto: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'
>
In $VIM/vimfiles/ftplugin you can create a directory called "vim/" and
put multiple files (plugins) in it, too. They'll all be loaded.
In $VIM/vimfiles/after/ftplugin you can do the same thing; these plugins
will be loaded later in the cycle.
Chip Campbell
--
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%2Bek4BEiB5pTksp3W6PwBCu2_0LqPz1i8mCoe-jyP6Kwqqo01w%40mail.gmail.com.