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

mapping a function with key

Expand Messages
  • rudrab
    I am trying to put insrt_frame at the current cursor position when F12 is pressed what should i do? map : call insrt_frame() fun! insrt_frame() ... endf
    Message 1 of 7 , Feb 8, 2013
      I am trying to put insrt_frame at the current cursor position when F12 is pressed
      what should i do?
      map <F12>: call insrt_frame()
      fun! insrt_frame()
      :put='\begin{frame}'
      :put='\frametitle{Motivation}'
      :put='\end{frame}'
      endf

      --
      --
      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.
    • Marcin Szamotulski
      ... In VimL user functions must start with an uppercase letter, unless it is a function from autoload directory. So after renaming the function to Insr_frame
      Message 2 of 7 , Feb 8, 2013
        On 04:27 Fri 08 Feb , rudrab wrote:
        > I am trying to put insrt_frame at the current cursor position when F12 is pressed
        > what should i do?
        > fun! insrt_frame()
        > :put='\begin{frame}'
        > :put='\frametitle{Motivation}'
        > :put='\end{frame}'
        > endf
        >
        > --
        > --
        > 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.
        >

        In VimL user functions must start with an uppercase letter, unless it is
        a function from autoload directory. So after renaming the function to
        Insr_frame the map should be:

        map <F12> :call Insrt_frame()

        i.e. you need to put a space between the key and the ':', otherwise vim
        will try to map the key combination '<F12>:'.

        Which LaTeX plugin do you use?

        Best,
        Marcin

        --
        --
        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.
      • Rudra Banerjee
        Thanks for your reply. I use vim-Latex suite ... -- -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text
        Message 3 of 7 , Feb 8, 2013
          Thanks for your reply.
          I use vim-Latex suite
          On Fri, 2013-02-08 at 14:30 +0000, Marcin Szamotulski wrote:
          > On 04:27 Fri 08 Feb , rudrab wrote:
          > > I am trying to put insrt_frame at the current cursor position when F12 is pressed
          > > what should i do?
          > > fun! insrt_frame()
          > > :put='\begin{frame}'
          > > :put='\frametitle{Motivation}'
          > > :put='\end{frame}'
          > > endf
          > >
          > > --
          > > --
          > > 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.
          > >
          >
          > In VimL user functions must start with an uppercase letter, unless it is
          > a function from autoload directory. So after renaming the function to
          > Insr_frame the map should be:
          >
          > map <F12> :call Insrt_frame()
          >
          > i.e. you need to put a space between the key and the ':', otherwise vim
          > will try to map the key combination '<F12>:'.
          >
          > Which LaTeX plugin do you use?
          >
          > Best,
          > Marcin
          >
          > --


          --
          --
          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.
        • Rudra Banerjee
          So, now it looks like map :execute Insrt_frame() function! Insrt_frame() ... endfunction and still not working. ... -- -- You received this message from
          Message 4 of 7 , Feb 8, 2013
            So, now it looks like
            map <F12> :execute Insrt_frame()
            function! Insrt_frame()
            :0put='\begin{frame}'
            :put='\frametitle{Motivation}'
            endfunction

            and still not working.
            On Fri, 2013-02-08 at 15:12 +0000, Rudra Banerjee wrote:
            > Thanks for your reply.
            > I use vim-Latex suite
            > On Fri, 2013-02-08 at 14:30 +0000, Marcin Szamotulski wrote:
            > > On 04:27 Fri 08 Feb , rudrab wrote:
            > > > I am trying to put insrt_frame at the current cursor position when F12 is pressed
            > > > what should i do?
            > > > fun! insrt_frame()
            > > > :put='\begin{frame}'
            > > > :put='\frametitle{Motivation}'
            > > > :put='\end{frame}'
            > > > endf
            > > >
            > > > --
            > > > --
            > > > 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.
            > > >
            > >
            > > In VimL user functions must start with an uppercase letter, unless it is
            > > a function from autoload directory. So after renaming the function to
            > > Insr_frame the map should be:
            > >
            > > map <F12> :call Insrt_frame()
            > >
            > > i.e. you need to put a space between the key and the ':', otherwise vim
            > > will try to map the key combination '<F12>:'.
            > >
            > > Which LaTeX plugin do you use?
            > >
            > > Best,
            > > Marcin
            > >
            > > --
            >
            >
            > --


            --
            --
            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.
          • rudrab
            Ah...I managed to fix it almost with nmap in place of map. But one problem is still there: it inserts the lines at the top of the file. How can I make it
            Message 5 of 7 , Feb 8, 2013
              Ah...I managed to fix it almost with nmap in place of map. But one problem is still there: it inserts the lines at the top of the file.
              How can I make it insert at the cursor position?

              --
              --
              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.
            • Marcin Szamotulski
              ... Functions should be called not executed: map :call Insrt_fram() the :execute is to execute a string as an Ex command, for example to do ... You can
              Message 6 of 7 , Feb 8, 2013
                On 15:29 Fri 08 Feb , Rudra Banerjee wrote:
                > So, now it looks like
                > map <F12> :execute Insrt_frame()
                > function! Insrt_frame()
                > :0put='\begin{frame}'
                > :put='\frametitle{Motivation}'
                > endfunction
                >
                > and still not working.

                Functions should be called not executed:

                map <f12> :call Insrt_fram()

                the :execute is to execute a string as an Ex command, for example to do
                what you want with execute would look like:

                :map <f12> :exe ':call InsrtFram()'

                You can check one day http://atp-vim.sf.net, which I am an author of.

                Best,
                Marcin

                --
                --
                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.
              • John Beckett
                ... Here is the complete code. In normal mode, press F12 to insert the three lines after the current line. nnoremap :call Insert_frame() function!
                Message 7 of 7 , Feb 8, 2013
                  rudrab wrote:
                  > I am trying to put insrt_frame at the current cursor position
                  > when F12 is pressed what should i do?
                  > map <F12>: call insrt_frame()
                  > fun! insrt_frame()
                  > :put='\begin{frame}'
                  > :put='\frametitle{Motivation}'
                  > :put='\end{frame}'
                  > endf

                  Here is the complete code. In normal mode, press F12 to insert
                  the three lines after the current line.

                  nnoremap <F12> :call Insert_frame()<CR>
                  function! Insert_frame()
                  put='\begin{frame}'
                  put='\frametitle{Motivation}'
                  put='\end{frame}'
                  endfunction

                  John

                  --
                  --
                  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.