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

iabbrev for templates

Expand Messages
  • Archibald Chase
    Hi In a french magazine an article presents a lot of vim features. For a simple use of templates it says that html template could be use this abbrev : iabbrev
    Message 1 of 4 , Mar 1, 2009
    • 0 Attachment
      Hi
      In a french magazine an article presents a lot of vim features. For a
      simple use of templates it says that html template could be use this
      abbrev :
      iabbrev <img> <img src='!cursor!' alt='<+Message de remplacement+>' /><CR><ESC>
      :call search('!cursor!', 'b')<CR>cf!

      It's suppose to put the cursor instead of !cursor! after inserting the
      tag. But it doesn't work ! Also if i put the two lines in one.

      I don't understand
      Excuse me for my english, i'm french ....
      Can you help Me
      Thanks
      Archibald
      --
      Archibald Chase
      - A quoi tu penses ?
      - Je pense que le jour où on mettra les cons sur orbite, t'as pas fini
      de tourner.
      -+- Michel Audiard -+-

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Luc Hermitte
      Hello, ... When written on two lines, mappings/abbreviations/... must use a in front on each new line. ... BTW: there already exist frameworks that help
      Message 2 of 4 , Mar 1, 2009
      • 0 Attachment
        Hello,

        "Archibald Chase" <archibald.chase@...> a écrit :
        > In a french magazine an article presents a lot of vim features. For a
        > simple use of templates it says that html template could be use this
        > abbrev :
        > iabbrev <img> <img src='!cursor!' alt='<+Message de remplacement+>'
        > /><CR><ESC>
        > :call search('!cursor!', 'b')<CR>cf!

        When written on two lines, mappings/abbreviations/...
        must use a '\' in front on each new line.
        :h line-continuation

        BTW: there already exist frameworks that help define such
        mappings, like mine for instance:
        http://code.google.com/p/lh-vim/wiki/lhBrackets#The_VimL_library

        With InsertSeq(), your mapping will be written as follow:
        inoremap <buffer> <img>
        \ <c-r>=InsertSeq('<img>', "<img src=!cursorhere! alt='!mark!'/>")<cr>

        (I suppose it will be defined into {rtp}/ftplugin/html_snippets.vim
        as you probably won't like to see the mapping exists when editing
        C++ files, see :h map-<buffer>, :h ftplugin)

        --
        Luc Hermitte
        http://lh-vim.googlecode.com/
        http://hermitte.free.fr/vim/

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • JuanPablo
        Archibald, a good option for snippets is http://code.google.com/p/vim-cca/ -- Best Regards JuanPablo --~--~---------~--~----~------------~-------~--~----~ You
        Message 3 of 4 , Mar 3, 2009
        • 0 Attachment
          Archibald, 
            a good option for snippets is
          http://code.google.com/p/vim-cca/

          --
          Best Regards
          JuanPablo

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---

        • Ben Fritz
          There are TONS of snippet/template/skeleton plugins/tips out there. See: http://vim.wikia.com/wiki/Category:Automated_Text_Insertion
          Message 4 of 4 , Mar 4, 2009
          • 0 Attachment
            There are TONS of snippet/template/skeleton plugins/tips out there.
            See:

            http://vim.wikia.com/wiki/Category:Automated_Text_Insertion
            http://vim.wikia.com/wiki/Category:Templates
            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.