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

How to retrigger 'autocmd' ?

Expand Messages
  • narke
    Hi, When I vimgrep on a large file tree, I usually turn of autocmd by :noau vimgrep /xxx/ **/*.c . Then I got c file open in a buffer but without the
    Message 1 of 8 , Jun 28, 2011
      Hi,

      When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
      ':noau vimgrep /xxx/ **/*.c'. Then I got c file open in a buffer but
      without the syntax highlighting (maybe also other good things). So I
      think what I need to do is to retriggle those 'autocmd' that would
      been usually executed if I don't do 'noau ...'. Can anyone tell me
      how to, if possible?

      Thanks in advance.


      --
      Life is the only flaw in an otherwise perfect nonexistence
          -- Schopenhauer

      narke
      public key at http://subkeys.pgp.net:11371 (narkewoody@...)

      --
      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
    • kongo2002
      ... Hi, usually I just reload the file by entering :e without arguments. Cheers, Gregor -- You received this message from the vim_use maillist. Do not
      Message 2 of 8 , Jun 28, 2011
        2011/6/28 narke <narkewoody@...>:
        > Hi,
        >
        > When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
        > ':noau vimgrep /xxx/ **/*.c'.   Then I got c file open in a buffer but
        > without the syntax highlighting (maybe also other good things). So I
        > think what I need to do is to retriggle those 'autocmd' that would
        > been usually executed if I don't do 'noau ...'.  Can anyone tell me
        > how to, if possible?
        >
        > Thanks in advance.
        >
        >
        > --
        > Life is the only flaw in an otherwise perfect nonexistence
        >     -- Schopenhauer
        >
        > narke
        > public key at http://subkeys.pgp.net:11371 (narkewoody@...)
        >
        > --
        > 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
        >

        Hi,
        usually I just reload the file by entering :e without arguments.

        Cheers,
        Gregor

        --
        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
      • Ben Schmidt
        ... perhaps? Or ... which will call :setfiletype and thereby retrigger the autocommands? Ben. -- You received this message from the vim_use maillist. Do not
        Message 3 of 8 , Jun 28, 2011
          >> When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
          >> ':noau vimgrep /xxx/ **/*.c'. Then I got c file open in a buffer but
          >> without the syntax highlighting (maybe also other good things). So I
          >> think what I need to do is to retriggle those 'autocmd' that would
          >> been usually executed if I don't do 'noau ...'. Can anyone tell me
          >> how to, if possible?

          :doau Filetype c

          perhaps? Or

          :doau BufRead

          which will call :setfiletype and thereby retrigger the autocommands?

          Ben.



          --
          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
        • Tim Chase
          ... I recommend Ben s answer over using :e because it shouldn t lose various state (such as jump-lists, undo-history, marks, manual folds, etc which can be
          Message 4 of 8 , Jun 28, 2011
            On 06/28/2011 06:11 AM, Ben Schmidt wrote:
            >>> think what I need to do is to retriggle those 'autocmd' that would
            >>> been usually executed if I don't do 'noau ...'. Can anyone tell me
            >>> how to, if possible?
            >
            > :doau Filetype c
            >
            > perhaps? Or
            >
            > :doau BufRead
            >
            > which will call :setfiletype and thereby retrigger the autocommands?

            I recommend Ben's answer over using ":e" because it shouldn't
            lose various state (such as jump-lists, undo-history, marks,
            manual folds, etc which can be lost in an ":e") and it can be
            used on a modified buffer without losing the changes.

            -tim


            --
            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
          • kongo2002
            ... Hi, in case the buffer was already opened before there is no need to retrigger the autocommands anyway. Cheers, Gregor -- You received this message from
            Message 5 of 8 , Jun 28, 2011
              2011/6/28 Tim Chase <vim@...>:
              > On 06/28/2011 06:11 AM, Ben Schmidt wrote:
              >>>>
              >>>> think what I need to do is to retriggle those 'autocmd' that would
              >>>> been usually executed if I don't do 'noau ...'.  Can anyone tell me
              >>>> how to, if possible?
              >>
              >> :doau Filetype c
              >>
              >> perhaps? Or
              >>
              >> :doau BufRead
              >>
              >> which will call :setfiletype and thereby retrigger the autocommands?
              >
              > I recommend Ben's answer over using ":e" because it shouldn't lose various
              > state (such as jump-lists, undo-history, marks, manual folds, etc which can
              > be lost in an ":e") and it can be used on a modified buffer without losing
              > the changes.
              >
              > -tim
              >

              Hi,
              in case the buffer was already opened before there is no need to
              retrigger the autocommands anyway.

              Cheers,
              Gregor

              --
              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
            • Andy Wokula
              ... -- Andy -- 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
              Message 6 of 8 , Jun 28, 2011
                Am 28.06.2011 13:11, schrieb Ben Schmidt:
                >>> When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
                >>> ':noau vimgrep /xxx/ **/*.c'. Then I got c file open in a buffer but
                >>> without the syntax highlighting (maybe also other good things). So I
                >>> think what I need to do is to retriggle those 'autocmd' that would
                >>> been usually executed if I don't do 'noau ...'. Can anyone tell me
                >>> how to, if possible?
                >
                > :doau Filetype c
                >
                > perhaps? Or
                >
                > :doau BufRead
                >
                > which will call :setfiletype and thereby retrigger the autocommands?
                >
                > Ben.

                Or (which I think is the recommended command):

                :filetype detect

                --
                Andy

                --
                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
              • Ben Fritz
                ... I normally add the j flag to my vimgrep to avoid an automatic jump to the first match. Then I can use the quickfix window with :copen, or just use
                Message 7 of 8 , Jun 28, 2011
                  On Jun 28, 4:31 am, narke <narkewo...@...> wrote:
                  > Hi,
                  >
                  > When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
                  > ':noau vimgrep /xxx/ **/*.c'.   Then I got c file open in a buffer but
                  > without the syntax highlighting (maybe also other good things). So I
                  > think what I need to do is to retriggle those 'autocmd' that would
                  > been usually executed if I don't do 'noau ...'.  Can anyone tell me
                  > how to, if possible?
                  >
                  > Thanks in advance.
                  >

                  I normally add the 'j' flag to my vimgrep to avoid an automatic jump
                  to the first match. Then I can use the quickfix window with :copen, or
                  just use :cnext/:cprev/:ccurrent to navigate. When these commands load
                  a new file, it triggers all the proper autocmds.

                  --
                  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
                • narke
                  ... Thanks for all your inputs. At the end, I so much like Ben s solution: using the j flag of vimgrep. Cheers! narke -- Life is the only flaw in an
                  Message 8 of 8 , Jun 30, 2011
                    On 29 June 2011 11:08, Ben Fritz <fritzophrenic@...> wrote:
                    >
                    >
                    > On Jun 28, 4:31 am, narke <narkewo...@...> wrote:
                    >> Hi,
                    >>
                    >> When I 'vimgrep' on a large file tree, I usually turn of 'autocmd' by
                    >> ':noau vimgrep /xxx/ **/*.c'.   Then I got c file open in a buffer but
                    >> without the syntax highlighting (maybe also other good things). So I
                    >> think what I need to do is to retriggle those 'autocmd' that would
                    >> been usually executed if I don't do 'noau ...'.  Can anyone tell me
                    >> how to, if possible?
                    >>
                    >> Thanks in advance.
                    >>
                    >
                    > I normally add the 'j' flag to my vimgrep to avoid an automatic jump
                    > to the first match. Then I can use the quickfix window with :copen, or
                    > just use :cnext/:cprev/:ccurrent to navigate. When these commands load
                    > a new file, it triggers all the proper autocmds.
                    >
                    > --
                    > 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
                    >

                    Thanks for all your inputs. At the end, I so much like Ben's
                    solution: using the 'j' flag of vimgrep.

                    Cheers!
                    narke


                    --
                    Life is the only flaw in an otherwise perfect nonexistence
                        -- Schopenhauer

                    narke
                    public key at http://subkeys.pgp.net:11371 (narkewoody@...)

                    --
                    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
                  Your message has been successfully submitted and would be delivered to recipients shortly.