Loading ...
Sorry, an error occurred while loading the content.

Re: b:did_indent variable

Expand Messages
  • Bram Moolenaar
    ... That s the wrong place. ... That s the wrong solution. This way if you do :set ft=foo while a filetype was already set, it won t reload the indent
    Message 1 of 3 , Apr 20, 2012
    • 0 Attachment
      Marcin Szamotulski wrote:

      > On 17:24 Thu 19 Apr , Marcin Szamotulski wrote:
      > > Hello,
      > >
      > > In my ftplugin for tex files there is a script for indentation.

      That's the wrong place.

      > > It sets the variable b:did_indent in the usual form. The problem is
      > > that even though b:did_indent is set to 1 the
      > > /usr/share/vim/vim73/indent/tex.vim file doesn't see it and it is
      > > also executed. Since the system indent/tex.vim is sourced
      > > after my indentation script (as revealed by the output of :scriptnames) it
      > > overwrites my script setting ('indentexpr').
      > >
      > > At the very beginning of both scripts I added:
      > > let g:{variable_name} = (exists("b:did_indent") ? 'INDENT EXISTS' : 'INDENT DOES NOT EXISTS') . ' for ' . expand('%:p')
      > >
      > > with two different variable names local_indent (in my script) and vim_indent
      > > (in the vim script). After opening a tex file both variables are set to:
      > >
      > > 'INDENT DOES NOT EXISTS for /tmp/n.tex'
      > >
      > > Can someone advise me what's going on?
      > >
      > > Best,
      > > Marcin
      >
      > The following patch to indent.vim fixes the issue.

      That's the wrong solution. This way if you do ":set ft=foo" while a
      filetype was already set, it won't reload the indent script.

      The solution is to create an indent script separate from the ftplugin.


      --
      MESKIMEN'S LAW
      There's never time to do it right, but always time to do it over.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" 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
    Your message has been successfully submitted and would be delivered to recipients shortly.