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

Re: iabbrev for templates

Expand Messages
  • 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 1 of 4 , Mar 1, 2009
      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 2 of 4 , Mar 3, 2009
        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 3 of 4 , Mar 4, 2009
          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.