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

Re: Can 'set ' be elided? When?

Expand Messages
  • Gary Johnson
    ... :name value is not a setting, it is a command that accepts an argument. In :set syntax=php , syntax is an option. See ... In :syntax off , syntax is a
    Message 1 of 10 , Mar 22, 2013
    • 0 Attachment
      On 2013-03-23, Dotan Cohen wrote:
      > I notice that some settings use the format ':set name=value' and other
      > use ':name value'. For instance:
      > :set syntax=php
      > :syntax off
      >
      > Can the string 'set ' always be safely elided? If not, then what are
      > the guidelines?

      ':name value' is not a setting, it is a command that accepts an
      argument.

      In ":set syntax=php", syntax is an option. See

      :help 'syntax'

      In ":syntax off", syntax is a command. See

      :help :syn-qstart

      (I would normally have directed you to ":help :syntax", but that
      section is not very helpful in this regard.)

      The syntax option and the syntax command are two different things
      that happen to share the same name.

      Regards,
      Gary

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Tony Mechelynck
      ... In addition to the replies you already got, (e.g. that :set syntax=php sets an option while :syntax php gives error E410) I ll add that AFAIK there is
      Message 2 of 10 , Mar 23, 2013
      • 0 Attachment
        On 22/03/13 23:43, Dotan Cohen wrote:
        > I notice that some settings use the format ':set name=value' and other
        > use ':name value'. For instance:
        > :set syntax=php
        > :syntax off
        >
        > Can the string 'set ' always be safely elided? If not, then what are
        > the guidelines?
        >
        > Thanks.
        >
        In addition to the replies you already got, (e.g. that ":set syntax=php"
        sets an option while ":syntax php" gives error E410) I'll add that AFAIK
        there is exactly one case where an option may be modified by name
        without the word "set" being used, and that is in a modeline. Modelines,
        however, are never typed at the keyboard, they are among the first or
        last lines in the file to which they apply. There are two forms of
        modelines: one uses "set" and can end before the end of the line (so it
        can be used in a /* */ or <!-- --> comment without moving the comment
        end marker to the next line), the other doesn't and can't. The last line
        of helpfiles distributed with Vim is a modeline. For a more detailed
        explanation, see
        :help modeline
        :help 'modeline'


        Best regards,
        Tony.
        --
        [The rest of the ARMY stand around looking at a loss.]
        INSPECTOR END OF FILM: (picks up megaphone) All right! Clear off! Go on!
        "Monty Python and the Holy Grail" PYTHON (MONTY)
        PICTURES LTD

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Dotan Cohen
        ... Thank you, I did not realize the difference between commands and ... Paying attention to which or do is helping me sort this out. Thanks. -- Dotan
        Message 3 of 10 , Mar 25, 2013
        • 0 Attachment
          On Sat, Mar 23, 2013 at 12:58 AM, Paul Isambert <zappathustra@...> wrote:
          > Selon Dotan Cohen <dotancohen@...>:
          >
          >> I notice that some settings use the format ':set name=value' and other
          >> use ':name value'. For instance:
          >> :set syntax=php
          >> :syntax off
          >
          > Note that ":syntax php" doesn't work.
          >
          >> Can the string 'set ' always be safely elided?
          >
          > No.
          >
          >> If not, then what are the guidelines?
          >
          > As far as I can tell, there aren't any. Some commands have the same name as
          > options (e.g. :filetype and 'filetype', :confirm and 'confirm'), but they don't
          > do the same things.
          >
          > Best,
          > Paul
          >

          Thank you, I did not realize the difference between commands and
          options, as some of them have the same names:
          :set syntax=php is setting an option (_which_ syntax to use)
          :syntax off is running a command (_do_ enable syntax highlighting)

          Paying attention to 'which' or 'do' is helping me sort this out.

          Thanks.

          --
          Dotan Cohen

          http://gibberish.co.il
          http://what-is-what.com

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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Dotan Cohen
          ... Why is syntax an option yet colorscheme a command? -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- -- You received this message from
          Message 4 of 10 , Mar 31, 2013
          • 0 Attachment
            On Sat, Mar 23, 2013 at 12:58 AM, Paul Isambert <zappathustra@...> wrote:
            >> I notice that some settings use the format ':set name=value' and other
            >> use ':name value'. For instance:
            >> :set syntax=php
            >> :syntax off
            >
            > Note that ":syntax php" doesn't work.
            >
            >> Can the string 'set ' always be safely elided?
            >
            > No.
            >
            >> If not, then what are the guidelines?
            >
            > As far as I can tell, there aren't any. Some commands have the same name as
            > options (e.g. :filetype and 'filetype', :confirm and 'confirm'), but they don't
            > do the same things.
            >
            > Best,
            > Paul
            >

            I notice that the following doesn't work:
            :syntax php

            However the following does work:
            :colorscheme desert

            Why is "syntax" an option yet "colorscheme" a command?



            --
            Dotan Cohen

            http://gibberish.co.il
            http://what-is-what.com

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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Christian Brabandt
            Hi Dotan! ... Probably because colorschemes do not change the behaviour of Vim but rather change its appearance. But who really knows the reasoning why some
            Message 5 of 10 , Mar 31, 2013
            • 0 Attachment
              Hi Dotan!

              On So, 31 Mär 2013, Dotan Cohen wrote:

              > I notice that the following doesn't work:
              > :syntax php
              >
              > However the following does work:
              > :colorscheme desert
              >
              > Why is "syntax" an option yet "colorscheme" a command?

              Probably because colorschemes do not change the behaviour of Vim but
              rather change its appearance.

              But who really knows the reasoning why some commands are not options?

              regards,
              Christian

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

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Dotan Cohen
              ... Thank you. I did not realize that syntax actually changes the behaviour of VIM. I suppose that it could change things like indentation. -- Dotan Cohen
              Message 6 of 10 , Mar 31, 2013
              • 0 Attachment
                On Sun, Mar 31, 2013 at 7:34 PM, Christian Brabandt <cblists@...> wrote:
                >> Why is "syntax" an option yet "colorscheme" a command?
                >
                > Probably because colorschemes do not change the behaviour of Vim but
                > rather change its appearance.
                >
                > But who really knows the reasoning why some commands are not options?
                >

                Thank you. I did not realize that syntax actually changes the
                behaviour of VIM. I suppose that it could change things like
                indentation.


                --
                Dotan Cohen

                http://gibberish.co.il
                http://what-is-what.com

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

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Christian Brabandt
                Hi Dotan! ... Yes, loading syntax files could e.g. change the isk setting so syntax highlighting works better, but this might have other side effects. So in
                Message 7 of 10 , Mar 31, 2013
                • 0 Attachment
                  Hi Dotan!

                  On So, 31 Mär 2013, Dotan Cohen wrote:

                  > On Sun, Mar 31, 2013 at 7:34 PM, Christian Brabandt <cblists@...> wrote:
                  > >> Why is "syntax" an option yet "colorscheme" a command?
                  > >
                  > > Probably because colorschemes do not change the behaviour of Vim but
                  > > rather change its appearance.
                  > >
                  > > But who really knows the reasoning why some commands are not options?
                  > >
                  >
                  > Thank you. I did not realize that syntax actually changes the
                  > behaviour of VIM. I suppose that it could change things like
                  > indentation.

                  Yes, loading syntax files could e.g. change the 'isk' setting so syntax
                  highlighting works better, but this might have other side effects. So in
                  fact setting syntax (and therefore loading a special syntax file) might
                  in fact change the behaviour of Vim.

                  Actually I think the syntax option is a bad example here, since
                  :set syntax?
                  might not always give the exact syntax setting that is used.

                  regards,
                  Christian
                  --

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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • Tony Mechelynck
                  ... There is both a :syntax command and a syntax option, and they are not ... also other variants ... etc. Most of the variants of this command are for use
                  Message 8 of 10 , Mar 31, 2013
                  • 0 Attachment
                    On 31/03/13 17:24, Dotan Cohen wrote:
                    > On Sat, Mar 23, 2013 at 12:58 AM, Paul Isambert <zappathustra@...> wrote:
                    >>> I notice that some settings use the format ':set name=value' and other
                    >>> use ':name value'. For instance:
                    >>> :set syntax=php
                    >>> :syntax off
                    >>
                    >> Note that ":syntax php" doesn't work.
                    >>
                    >>> Can the string 'set ' always be safely elided?
                    >>
                    >> No.
                    >>
                    >>> If not, then what are the guidelines?
                    >>
                    >> As far as I can tell, there aren't any. Some commands have the same name as
                    >> options (e.g. :filetype and 'filetype', :confirm and 'confirm'), but they don't
                    >> do the same things.
                    >>
                    >> Best,
                    >> Paul
                    >>
                    >
                    > I notice that the following doesn't work:
                    > :syntax php
                    >
                    > However the following does work:
                    > :colorscheme desert
                    >
                    > Why is "syntax" an option yet "colorscheme" a command?
                    >
                    >
                    >
                    > --
                    > Dotan Cohen
                    >
                    > http://gibberish.co.il
                    > http://what-is-what.com
                    >

                    There is both a :syntax command and a 'syntax' option, and they are not
                    interchangeable: The command can be:

                    :syntax on
                    :syntax off
                    :syntax enable
                    :syntax list " with optional arguments
                    :syntax sync fromstart
                    :syntax sync clear
                    :syntax sync ccomment
                    " also other variants
                    :syntax sync " with no arguments: "tell me"

                    etc. Most of the variants of this command are for use in syntax scripts,
                    to define how the particular syntax of a certain filetype must be
                    highlighted. ":syntax on" can be used in your vimrc to enable syntax
                    highlighting. ":syntax sync" with no arguments and ":syntax list" are
                    used from the keyboard, to request information.



                    The 'syntax' option is something else: it defines which named syntax
                    applies to a given file. It can be set, usually by ":setlocal"; normally
                    this is done automatically as part of the FileType event handling. You
                    can also do it manually, for instance

                    :setlocal syntax=

                    to remove all syntax highlighting for one editfile only, until it is
                    reloaded.



                    As for the :colorscheme command, ":colorscheme foobar" is approximately
                    equivalent with (IIUC) ":doautocmd ColorScheme foobar | runtime
                    colors/foobar.vim" which is also a command. If you want to determine
                    which colorscheme is in use, you should check the global variable
                    colors_name which every properly constructed colorscheme will set to its
                    own filename (without the path and the .vim extension). You can do that
                    with ":colorscheme" with no argument, which (in a Vim with +eval
                    compiled-in) does something similar to ":if exists('g:colors_name') |
                    echo g:colors_name | else | echo 'default' | endif", another command.


                    Best regards,
                    Tony.
                    --
                    LETTERS TO THE EDITOR (The Times of London)

                    Dear Sir,

                    I am firmly opposed to the spread of microchips either to the home or
                    to the office. We have more than enough of them foisted upon us in
                    public places. They are a disgusting Americanism, and can only result
                    in the farmers being forced to grow smaller potatoes, which in turn
                    will cause massive unemployment in the already severely depressed
                    agricultural industry.

                    Yours faithfully,
                    Capt. Quinton D'Arcy, J. P.
                    Sevenoaks

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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  Your message has been successfully submitted and would be delivered to recipients shortly.