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

Re: Treat spaces as tabs only at the start of the line

Expand Messages
  • Ben Fritz
    ... You can return the , that s not one of the things that break insert mode. ... You should be able to use your current = mapping, or an
    Message 1 of 7 , Jul 1, 2012
    • 0 Attachment
      On Sunday, July 1, 2012 1:12:05 PM UTC-5, Gerardo Marset wrote:
      >
      > Thanks for the suggestion, but how could I insert a BS in the line without returning the function?

      You can return the <BS>, that's not one of the things that break insert mode.

      :help ins-special-special gives the list of things that do.

      You should be able to use your current <C-R>= mapping, or an <expr> mapping, to return <BS> plus an appropriate number of spaces.

      --
      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
    • Gerardo Marset
      ... Hmm... yes, I guess I could do it, but determining the appropriate number of spaces seems to get quite complicated. Vim seems to remove a single space if,
      Message 2 of 7 , Jul 4, 2012
      • 0 Attachment
        On Monday, July 2, 2012 1:21:57 AM UTC-3, Ben Fritz wrote:
        > On Sunday, July 1, 2012 1:12:05 PM UTC-5, Gerardo Marset wrote:
        > >
        > > Thanks for the suggestion, but how could I insert a BS in the line without returning the function?
        >
        > You can return the <BS>, that's not one of the things that break insert mode.
        >
        > :help ins-special-special gives the list of things that do.
        >
        > You should be able to use your current <C-R>= mapping, or an <expr> mapping, to return <BS> plus an appropriate number of spaces.

        Hmm... yes, I guess I could do it, but determining the appropriate number of spaces seems to get quite complicated.
        Vim seems to remove a single space if, between tab and space, space was the last key pressed in the current insert mode.
        I would have to map space to set a variable (l:space_last_pressed or something) to true, and also map Esc and Tab to set it to false, then use the variable's value to know how many spaces to make up for.
        A mess.

        As I said, I guess I could do it, but isn't there another way? :/

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