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

Re: autocmd useage

Expand Messages
  • Nikolay Pavlov
    ... Wondering how feedkeys(, * n *) is supposed to execute a *mapping*. You should have suggested feedkeys(, t ). ... ca ... Groups ... an ...
    Message 1 of 7 , Jun 26, 2013
    • 0 Attachment


      On Jun 26, 2013 6:57 PM, "Xell Liu" <xell.liu@...> wrote:
      >
      > On Wed, Jun 26, 2013 at 10:36 PM, wangjun850725 <wangjun850725@...> wrote:
      > > Hi :
      > > I want to execute "\ca" when I opened gvim.
      > > I set:
      > > autocmd VimEnter * exe "normal \\ca"
      > > or
      > > autocmd VimEnter * normal \ca
      > > that are all failed.
      > >
      > > How to write this command?
      >
      > Maybe feedkeys() would help here, e.g. au VimEnter * call
      > feedkeys('\ca', 'n') or something like that. Good luck.

      Wondering how feedkeys(, *'n'*) is supposed to execute a *mapping*. You should have suggested feedkeys(, 't').

      > > "
      > > 3.2.11 Use alternate delims map
      > > *NERDComAltDelim*
      > > Default mapping: <leader>ca
      > > Mapped to: <plug>NERDCommenterAltDelims
      > > Applicable modes: normal.
      > >
      > > Changes to the alternative commenting style if one is available. For
      > > example,
      > > if the user is editing a c++ file using // comments and they hit <leader>ca
      > > then they will be switched over to /**/ comments.
      > >
      > > the plugin is NERDcomment
      > > "
      > >
      > > --
      > > --
      > > 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@....
      > > For more options, visit https://groups.google.com/groups/opt_out.
      > >
      > >
      >
      > --
      > --
      > 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@....
      > For more options, visit https://groups.google.com/groups/opt_out.
      >
      >

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • wangjun850725
      au VimEnter * call feedkeys( ca , t ) it is failed too! From: Nikolay Pavlov Date: 2013-06-26 23:14 To: vim_use Subject: Re: autocmd useage ... Wondering how
      Message 2 of 7 , Jun 26, 2013
      • 0 Attachment
        au VimEnter * call feedkeys('\ca', 't')
        it is failed too!
        Date: 2013-06-26 23:14
        To: vim_use
        Subject: Re: autocmd useage


        On Jun 26, 2013 6:57 PM, "Xell Liu" <xell.liu@...> wrote:

        >
        > On Wed, Jun 26, 2013 at 10:36 PM, wangjun850725 <
        href="mailto:wangjun850725@...">wangjun850725@...> wrote:
        > > Hi :
        > > I want to execute "\ca" when I opened
        gvim.
        > > I set:
        > > autocmd VimEnter * exe "normal
        \\ca"
        > > or
        > > autocmd VimEnter * normal \ca
        > >
        that are all failed.
        > >
        > > How to write this
        command?
        >
        > Maybe feedkeys() would help here, e.g. au VimEnter *
        call
        > feedkeys('\ca', 'n') or something like that. Good luck.

        Wondering how feedkeys(, *'n'*) is supposed to execute a *mapping*. You should have suggested feedkeys(, 't').

        > > "
        > > 3.2.11 Use alternate delims map
        > >

        *NERDComAltDelim*
        > > Default mapping: <leader>ca
        > >
        Mapped to: <plug>NERDCommenterAltDelims
        > > Applicable modes:
        normal.
        > >
        > > Changes to the alternative commenting style if
        one is available. For
        > > example,
        > > if the user is editing
        a c++ file using // comments and they hit <leader>ca
        > > then
        they will be switched over to /**/ comments.
        > >
        > > the
        plugin is NERDcomment
        > > "
        > >
        > > --
        > >
        --
        > > 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
        href="http://www.vim.org/maillist.php">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
        href="mailto:vim_use%2Bunsubscribe@...">vim_use+unsubscribe@....
        > > For more options, visit
        href="https://groups.google.com/groups/opt_out">https://groups.google.com/groups/opt_out.
        > >
        > >
        >
        > --
        > --
        > 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
        href="http://www.vim.org/maillist.php">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@....
        >
        For more options, visit https://groups.google.com/groups/opt_out.
        >
        >

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

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      • Charles Campbell
        ... Please bottom post! That s the consensus vim list policy. I believe your problem is that you re trying to execute a mapping, ca , that has not been
        Message 3 of 7 , Jun 26, 2013
        • 0 Attachment
          wangjun850725 wrote:
          > au VimEnter * call feedkeys('\ca', 't')
          >
          Please bottom post! That's the consensus vim list policy.

          I believe your problem is that you're trying to execute a mapping,
          '\ca', that has not been defined at the time the VimEnter event fires.

          What you want is for the mapping to execute -after- its been defined.
          It just so happens that vim supports that sort of thing.

          (untested) Try putting

          norm \ca

          in $HOME/.vim/after/plugin/NERDcomment.vim . You may have to create a
          directory or two.

          C 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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Nikolay Pavlov
          On Jun 26, 2013 7:43 PM, Charles Campbell ... that has not been defined at the time the VimEnter event fires. ... just so
          Message 4 of 7 , Jun 26, 2013
          • 0 Attachment


            On Jun 26, 2013 7:43 PM, "Charles Campbell" <Charles.E.Campbell@...> wrote:
            >
            > wangjun850725 wrote:
            >>
            >> au VimEnter * call feedkeys('\ca', 't')
            >>
            > Please bottom post!  That's the consensus vim list policy.
            >
            > I believe your problem is that you're trying to execute a mapping, '\ca', that has not been defined at the time the VimEnter event fires.
            >
            > What you want is for the mapping to execute -after- its been defined.  It just so happens that vim supports that sort of thing.
            >
            > (untested) Try putting
            >
            >   norm \ca
            >
            > in $HOME/.vim/after/plugin/NERDcomment.vim .  You may have to create a directory or two.
            >
            > C Campbell

            By the time of VimEnter all plugins should have been already loaded. It would not load though with something like yours AsNeeded (though mapping should still work as it will trigger autoload, right?) or with VAM activating plugins *not from vimrc* (additions to runtimepath are not handled correctly if they are done after vim started to load plugins from runtimepath; we have a workaround, but it uses VimEnter too and is likely to be launched after event from the vimrc).

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

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
             
             
          Your message has been successfully submitted and would be delivered to recipients shortly.