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

Re: compatibility with Sun's original vi for command :su

Expand Messages
  • glts
    On Tue, Jun 25, 2013 at 1:16 PM, Tony Mechelynck ... Here s another way of looking at it. If by abbreviating a command you mean to save on keystrokes then the
    Message 1 of 7 , Jun 25, 2013
      On Tue, Jun 25, 2013 at 1:16 PM, Tony Mechelynck
      <antoine.mechelynck@...> wrote:
      > Looks like a feature, not a bug, to me. Vim does not always follow what the
      > POSIX pundits decreed from their high thrones that vi “must” do, especially
      > not in 'nocompatible' mode but not even in 'compatible' mode, unless
      > $VIM_POSIX is set (or the individual POSIX flags are set in addition to the
      > 'compatible' ones).
      >
      > The Vim documentation clearly specifies :s[ubstitute], :sus[pend], st[op],
      > which, in the notation used in Vim help files, means that:
      > :s
      > :su
      > :sub
      > :subs
      > :subst
      > :substi
      > :substit
      > :substitu
      > :substitut
      > :substitute
      > all mean the same,
      >
      > and (since :stop and :suspend are synonymous not only in Vim but also in vi
      > and ex):
      > :sus
      > :susp
      > :suspe
      > :suspen
      > :suspend
      > :st
      > :sto
      > :stop
      > also all mean the same.
      >
      > IMHO the mention of s[ubstitute] and su[spend] in the POSIX manual is where
      > the bug lies, since it implies that :su would mean _both_ :suspend and
      > :substitute. Since the popular :s command is a well-known abbreviation for
      > :substitute, it follows (by analogy with all other ex-commands used in Vim)
      > that :su, :sub, :subs, etc. mean the same. An additional letter must be used
      > for :sus[pend] to avoid ambiguity, or people who want to press as few keys
      > as possible, :st[op] comes to the rescue.
      >
      > To have :s = :substitute, :su = :suspend, :sub = :substitute would be
      > illogical and would add an element of surprise for people like me, who never
      > used legacy vi.

      Here's another way of looking at it. If by abbreviating a command you
      mean to save on keystrokes then the POSIX behaviour is indeed optimal;
      :s gives :substitute, :su gives :suspend. Now the POSIX behaviour
      becomes a feature: maximum efficiency, minimum keystrokes.

      Anyway, I'd be surprised if somebody preferred :su over :s to abbreviate
      :substitute.

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Christian Brabandt
      ... No it isn t. The standard allows either :su or :suspend but none of the other ways. The same is true for :substitute, either use :s or :substitute. There
      Message 2 of 7 , Jun 25, 2013
        On Tue, June 25, 2013 13:16, Tony Mechelynck wrote:
        > On 25/06/13 11:15, Christian Brabandt wrote:
        >> On Mon, June 24, 2013 23:54, Paul Maier wrote:
        >>> Hi,
        >>>
        >>> the original vi on Sun took :su as :suspend,
        >>> whereas vim takes :su as :substitute.
        >>>
        >>> I am very used to typing :su.
        >>>
        >>> Would it be possible for VIM 7.4 to add a new compatibility flag to
        >>> cpoptions
        >>> about the meaning of :su ?
        >>>
        >>> suggested compatible flag: :su = :suspend, :s = :substitute
        >>> without the flag: :su = :substitute
        >>>
        >>
        >> Looks like a bug to me. POSIX also requires :su to be used for
        >> :suspend (http://pubs.opengroup.org/onlinepubs/007908799/xcu/ex.html)
        >>
        >> Do we need a new cpo setting here, or should it be enough to
        >> patch vim to take :su as :suspend?
        >
        > Looks like a feature, not a bug, to me. Vim does not always follow what
        > the POSIX pundits decreed from their high thrones that vi “must” do,
        > especially not in 'nocompatible' mode but not even in 'compatible' mode,
        > unless $VIM_POSIX is set (or the individual POSIX flags are set in
        > addition to the 'compatible' ones).
        >
        > The Vim documentation clearly specifies :s[ubstitute], :sus[pend],
        > st[op], which, in the notation used in Vim help files, means that:
        > :s
        > :su
        > :sub
        > :subs
        > :subst
        > :substi
        > :substit
        > :substitu
        > :substitut
        > :substitute
        > all mean the same,
        >
        > and (since :stop and :suspend are synonymous not only in Vim but also in
        > vi and ex):
        > :sus
        > :susp
        > :suspe
        > :suspen
        > :suspend
        > :st
        > :sto
        > :stop
        > also all mean the same.
        >
        > IMHO the mention of s[ubstitute] and su[spend] in the POSIX manual is
        > where the bug lies, since it implies that :su would mean _both_ :suspend
        > and :substitute.

        No it isn't. The standard allows either :su or :suspend
        but none of the other ways. The same is true for :substitute,
        either use :s or :substitute. There is no ambiguity as you claim.

        > Since the popular :s command is a well-known
        > abbreviation for :substitute, it follows (by analogy with all other
        > ex-commands used in Vim) that :su, :sub, :subs, etc. mean the same. An

        We also already have :si (which is short for :s using i flag), but :sil
        is used for :silent and :sl is used for sleep.

        > additional letter must be used for :sus[pend] to avoid ambiguity, or
        > people who want to press as few keys as possible, :st[op] comes to the
        > rescue.
        > To have :s = :substitute, :su = :suspend, :sub = :substitute would be
        > illogical and would add an element of surprise for people like me, who
        > never used legacy vi.

        Why. Do you use :su instead of :s? I don't see how that would be surprising
        but instead it would be more logically to users of the old vanilla vi.

        > A cabbrev has been given for those who want it this way nevertheless. Do
        > we need an additional POSIX flag in 'cpoptions' and a change in the C
        > code? I personally doubt its utility.

        regards,
        Christian

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Ben Fritz
        ... FWIW, there is an explicit :help tag for :su meaning :substitute. -- -- You received this message from the vim_dev maillist. Do not top-post! Type your
        Message 3 of 7 , Jun 25, 2013
          On Tuesday, June 25, 2013 7:36:34 AM UTC-5, Christian Brabandt wrote:
          > On Tue, June 25, 2013 13:16, Tony Mechelynck wrote:
          >
          > > IMHO the mention of s[ubstitute] and su[spend] in the POSIX manual is
          >
          > > where the bug lies, since it implies that :su would mean _both_ :suspend
          >
          > > and :substitute.
          >
          >
          >
          > No it isn't. The standard allows either :su or :suspend
          >
          > but none of the other ways. The same is true for :substitute,
          >
          > either use :s or :substitute. There is no ambiguity as you claim.
          >
          >
          >
          > > Since the popular :s command is a well-known
          >
          > > abbreviation for :substitute, it follows (by analogy with all other
          >
          > > ex-commands used in Vim) that :su, :sub, :subs, etc. mean the same. An
          >
          >
          >
          > We also already have :si (which is short for :s using i flag), but :sil
          >
          > is used for :silent and :sl is used for sleep.
          >

          FWIW, there is an explicit :help tag for :su meaning :substitute.

          --
          --
          You received this message from the "vim_dev" 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_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Bram Moolenaar
          ... The POSIX spec has a bug: it says that :s means :substitute, which means anything starting with :s means :substitute, including :su. But then ... Relevant
          Message 4 of 7 , Jun 25, 2013
            Christian Brabandt wrote:

            > On Mon, June 24, 2013 23:54, Paul Maier wrote:
            > > Hi,
            > >
            > > the original vi on Sun took :su as :suspend,
            > > whereas vim takes :su as :substitute.
            > >
            > > I am very used to typing :su.
            > >
            > > Would it be possible for VIM 7.4 to add a new compatibility flag to
            > > cpoptions
            > > about the meaning of :su ?
            > >
            > > suggested compatible flag: :su = :suspend, :s = :substitute
            > > without the flag: :su = :substitute
            > >
            >
            > Looks like a bug to me. POSIX also requires :su to be used for
            > :suspend (http://pubs.opengroup.org/onlinepubs/007908799/xcu/ex.html)
            >
            > Do we need a new cpo setting here, or should it be enough to
            > patch vim to take :su as :suspend?

            The POSIX spec has a bug: it says that :s means :substitute, which means
            anything starting with :s means :substitute, including :su. But then
            :suspend can be abbreviated to :su, that's a conflict.

            Relevant quotes:

            For each of the commands listed below, the command can be
            entered as the abbreviation (those characters in the Synopsis
            command word preceding the [), the full command (all characters
            shown for the command word, omitting the [ and ]), or any subset
            of the characters of the full command down to the abbreviation.
            For example, the args command (shown as ar[gs] in the Synopsis)
            can be entered as ar, arg or args.

            [...]

            Substitute

            Synopsis: [range] s[ubstitute] [/pattern/repl/[options] [count] [flags]]

            [...]

            Suspend

            Synopsis: su[spend][!]


            Making an exception for :su to mean :suspend instead of :substitute
            would be weird.

            --
            GALAHAD: No. Look, I can tackle this lot single-handed!
            GIRLS: Yes, yes, let him Tackle us single-handed!
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ an exciting new programming language -- http://www.Zimbu.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --
            --
            You received this message from the "vim_dev" 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_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Marcin Szamotulski
            ... Hi, You can use my command alias plugin and type :su and get :suspend: http://www.vim.org/scripts/script.php?script_id=4250 (it is also on github:
            Message 5 of 7 , Jun 25, 2013
              On 22:54 Tue 25 Jun , Bram Moolenaar wrote:
              >
              > Christian Brabandt wrote:
              >
              > > On Mon, June 24, 2013 23:54, Paul Maier wrote:
              > > > Hi,
              > > >
              > > > the original vi on Sun took :su as :suspend,
              > > > whereas vim takes :su as :substitute.
              > > >
              > > > I am very used to typing :su.
              > > >
              > > > Would it be possible for VIM 7.4 to add a new compatibility flag to
              > > > cpoptions
              > > > about the meaning of :su ?
              > > >
              > > > suggested compatible flag: :su = :suspend, :s = :substitute
              > > > without the flag: :su = :substitute
              > > >
              > >
              > > Looks like a bug to me. POSIX also requires :su to be used for
              > > :suspend (http://pubs.opengroup.org/onlinepubs/007908799/xcu/ex.html)
              > >
              > > Do we need a new cpo setting here, or should it be enough to
              > > patch vim to take :su as :suspend?
              >
              > The POSIX spec has a bug: it says that :s means :substitute, which means
              > anything starting with :s means :substitute, including :su. But then
              > :suspend can be abbreviated to :su, that's a conflict.
              >
              > Relevant quotes:
              >
              > For each of the commands listed below, the command can be
              > entered as the abbreviation (those characters in the Synopsis
              > command word preceding the [), the full command (all characters
              > shown for the command word, omitting the [ and ]), or any subset
              > of the characters of the full command down to the abbreviation.
              > For example, the args command (shown as ar[gs] in the Synopsis)
              > can be entered as ar, arg or args.
              >
              > [...]
              >
              > Substitute
              >
              > Synopsis: [range] s[ubstitute] [/pattern/repl/[options] [count] [flags]]
              >
              > [...]
              >
              > Suspend
              >
              > Synopsis: su[spend][!]
              >
              >
              > Making an exception for :su to mean :suspend instead of :substitute
              > would be weird.

              Hi,

              You can use my command alias plugin and type :su and get :suspend:

              http://www.vim.org/scripts/script.php?script_id=4250

              (it is also on github: https://github.com/coot/cmdalias_vim)

              Best regards,
              Marcin

              --
              --
              You received this message from the "vim_dev" 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_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+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.