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

numeric argument passed to 'set xxx='

Expand Messages
  • Steven Woody
    Hi, I want to do this in my script: function IdentLvl(n) set tabstop=a:n set shiftwidth=a:n set softtabstop=a:n endfunc then, call IdentLvl(4). But it simply
    Message 1 of 3 , Sep 28, 2009
    View Source
    • 0 Attachment
      Hi,

      I want to do this in my script:

      function IdentLvl(n)
          set tabstop=a:n
          set shiftwidth=a:n
          set softtabstop=a:n
      endfunc

      then, call IdentLvl(4).

      But it simply raises an error, "a number required".   What's wrong with it? 

      Thanks.

      --
      Life is the only flaw in an otherwise perfect nonexistence
         -- Schopenhauer

      narke
      public key at http://subkeys.pgp.net:11371 (narkewoody@...)

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

    • Tinou
      ... Hello, ... Two solutions: 1. let &tabstop=a:n let &shiftwidth=a:n let &softtabstop=a:n 2. exe set tabstop= .a:n exe set shiftwidth= .a:n exe set
      Message 2 of 3 , Sep 28, 2009
      View Source
      • 0 Attachment
        On Mon, Sep 28, 2009 at 18:02, Steven Woody <narkewoody@...> wrote:
        > Hi,

        Hello,

        > I want to do this in my script:
        > function IdentLvl(n)
        >     set tabstop=a:n
        >     set shiftwidth=a:n
        >     set softtabstop=a:n
        > endfunc
        > then, call IdentLvl(4).
        > But it simply raises an error, "a number required".   What's wrong with it?
        > Thanks.

        Two solutions:

        1.
        let &tabstop=a:n
        let &shiftwidth=a:n
        let &softtabstop=a:n

        2.
        exe 'set tabstop='.a:n
        exe 'set shiftwidth='.a:n
        exe 'set softtabstop='.a:n

        Kind regards,

        --
        Étienne

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Steven Woody
        ... It works! Thanks. -- Life is the only flaw in an otherwise perfect nonexistence -- Schopenhauer narke public key at http://subkeys.pgp.net:11371
        Message 3 of 3 , Sep 29, 2009
        View Source
        • 0 Attachment
          On Tue, Sep 29, 2009 at 12:23 AM, Tinou <tinoucas@...> wrote:

          On Mon, Sep 28, 2009 at 18:02, Steven Woody <narkewoody@...> wrote:
          > Hi,

          Hello,

          > I want to do this in my script:
          > function IdentLvl(n)
          >     set tabstop=a:n
          >     set shiftwidth=a:n
          >     set softtabstop=a:n
          > endfunc
          > then, call IdentLvl(4).
          > But it simply raises an error, "a number required".   What's wrong with it?
          > Thanks.

          Two solutions:

          1.
          let &tabstop=a:n
          let &shiftwidth=a:n
          let &softtabstop=a:n

          2.
          exe 'set tabstop='.a:n
          exe 'set shiftwidth='.a:n
          exe 'set softtabstop='.a:n

          Kind regards,

          It works! Thanks.


          --
          Life is the only flaw in an otherwise perfect nonexistence
             -- Schopenhauer

          narke
          public key at http://subkeys.pgp.net:11371 (narkewoody@...)

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