Tuesday, June 4, 2013

Re: I'm unable to override indentexpr

On 2013-06-04, Steve Litt wrote:

> Thanks Gary,
>
> You're right. I confirmed it by making ~/.vim/after/indent/html.vim,
> putting in indentexpr=, and running Vim again. I can toggle indentexpr
> by commenting and uncommenting that line in
> ~/.vim/after/indent/html.vim, so you're for sure right.
>
> But I don't understand how my ~/.vim/after/ftplugin/html.vim got
> executed, yet didn't change indentexpr. Does Vim throw away certain
> categories of changes depending on the directory? You told me the fix
> for my problem, and I thank you profusely for that. Now I'd like to
> understand the process Vim uses to set all this stuff.

I don't have all of the answer, but I can tell you how to find the
answer.

Vim uses various autocommands and scripts in $VIMRUNTIME to manage
plugins and the order of their execution. The primary one is
filetype.vim. It (and a few others such as scripts.vim and files in
ftdetect) sets the 'filetype' based on filename extensions and/or
contents. The setting of the 'filetype' triggers the FileType event
and starts the execution of FileType autocommands, including the
loading of filetype plugins, indent plugins and syntax plugins. The
loading of indent plugins is controlled by indent.vim.

So, if you follow the order of execution of the plugins by reading
filetype.vim, indent.vim, and perhaps a few other files in the
$VIMRUNTIME directory, you'll discover the sequence in which plugins
are sourced and the reason for the behavior you observed.

One nice thing about the way Bram put a lot of the plugin control in
scripts external to the Vim binary is that it is much simpler to
follow the execution of scripts than it would be to find and follow
source code in C.

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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment