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

Dealing with virtual indent inside a function

Expand Messages
  • AK
    I have an insert mapping for tab key that works right for existing lines, but does not work right for a new line with virtual indent level. Normally, if it s
    Message 1 of 1 , Oct 2, 2011
    • 0 Attachment
      I have an insert mapping for tab key that works right for existing
      lines, but does not work right for a new line with 'virtual' indent
      level.

      Normally, if it's in a mapping, it can be fixed by adding any key and
      then backspace to erase it. I'm trying to do the same inside of a
      function, and nothing I've tried works for me.

      fun! TriggerSnippet()
      if getline('.') =~ '^\s*$'
      call feedkeys("x", 't')
      :redraw
      call feedkeys("\<bs>\<tab>", 'n') | return ''

      ...
      endfu

      This is at the top of snipmate's TriggerSnippet, by the way. I think
      snipmate has some way of dealing with this but I don't know where it is
      or how it works, so if someone can point this out, that might help.
      Because I have another function that closes popup menu before triggering
      snippet when tab key is pressed, snipmate's workaround for this does not
      work.

      Any help appreciated!

      -ak

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