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

Multiple commands for -c option

Expand Messages
  • Hiroshi Iwatani
    Could we specify two or more commands in the -c option? If the answer is yes, then how? ... and ... for a particulat type of file. TIA -- Hiroshi Iwatani
    Message 1 of 6 , Feb 28, 2004
      Could we specify two or more commands in the -c option? If the
      answer is yes, then how?

      Specifically I'd like to do:

      :set fenc=cp932

      and

      :e ++enc=cp932

      for a particulat type of file.

      TIA

      --
      Hiroshi Iwatani

      *stop cruelty* Annual number of institutionally euthanized cats and dogs
      including kittens and puppies: US 5 million, JP 500 thousand. How about your
      country? *for our better karma*
      ---------------------
    • Yakov Lerner
      ... I think there are two ways to do this (1) vim -c cmd1 -c cmd2 ... (2) vim -c cmd1|cmd2 ... However, if this is for particular type of file why would
      Message 2 of 6 , Feb 29, 2004
        Hiroshi Iwatani wrote:
        > Could we specify two or more commands in the -c option? If the
        > answer is yes, then how?
        >
        > Specifically I'd like to do:
        >
        > :set fenc=cp932
        >
        > and
        >
        > :e ++enc=cp932
        >
        > for a particulat type of file.

        I think there are two ways to do this
        (1) vim -c 'cmd1' -c 'cmd2' ...
        (2) vim -c 'cmd1|cmd2' ...

        However, if this is for particular type of file why
        would you use -c option and not filetype-specific scripts ?

        Yakov
      • Hiroshi Iwatani
        Thanks Yakov. ... Specificity is not explicit, like file name extension. ... I tried before posting the question and I got an weird error: First change is not
        Message 3 of 6 , Feb 29, 2004
          Thanks Yakov.

          > filetype-specific scripts ?
          Specificity is not explicit, like file name extension.

          > (1) vim -c 'cmd1' -c 'cmd2' ...
          > (2) vim -c 'cmd1|cmd2' ...
          I tried before posting the question and I got an weird error:
          "First change is not saved" ... something like that.

          May I ask a collateral question:

          If you have specified an

          :e ++enc=xxx

          setting fenc isn't necessary? (redundant?)

          Yakov Lerner wrote:
          > Hiroshi Iwatani wrote:
          >
          >> Could we specify two or more commands in the -c option? If the
          >> answer is yes, then how?
          >>
          >> Specifically I'd like to do:
          >>
          >> :set fenc=cp932
          >>
          >> and
          >>
          >> :e ++enc=cp932
          >>
          >> for a particulat type of file.
          >
          >
          > I think there are two ways to do this
          > (1) vim -c 'cmd1' -c 'cmd2' ...
          > (2) vim -c 'cmd1|cmd2' ...
          >
          > However, if this is for particular type of file why
          > would you use -c option and not filetype-specific scripts ?
          >
          > Yakov
          >
          >
          >

          --
          Hiroshi Iwatani

          *stop cruelty* Annual number of institutionally euthanized cats and dogs
          including kittens and puppies: US 5 million, JP 500 thousand. How about your
          country? *for our better karma*
          ---------------------
        • Yakov Lerner
          ... Indeed some combinations of these two commands do not work as you expect. Try not to use set fenc=cp932 because doc says (in help fenc): To read a file
          Message 4 of 6 , Feb 29, 2004
            Hiroshi Iwatani wrote:
            >> Hiroshi Iwatani wrote:
            >>
            >>> Could we specify two or more commands in the -c option? If the
            >>> answer is yes, then how?
            >>>
            >>> Specifically I'd like to do:
            >>>
            >>> :set fenc=cp932
            >>>
            >>> and
            >>>
            >>> :e ++enc=cp932


            Indeed some combinations of these two commands do not work as you expect.

            Try not to use 'set fenc=cp932' because doc says (in help fenc):

            To read a file in a certain encoding it won't work by setting
            'fileencoding', use the |++enc| argument.

            I think this will work for you:

            vi -c 'e ++enc=cp932 ..File..'

            Yakov
          • Hiroshi Iwatani
            ... Yes. gvim -c e ++enc=cp932 file does work. But only anxiety is whether this command could also play the function of set fenc. In other words, -c set
            Message 5 of 6 , Feb 29, 2004
              > I think this will work for you:
              >
              > vi -c 'e ++enc=cp932 ..File..'
              Yes.

              gvim -c "e ++enc=cp932" file

              does work. But only anxiety is whether this command could also
              play the function of set fenc. In other words,

              -c "set fenc=cp932" -c "e ++enc=cp932"

              is unnecessarily redundant?

              Yakov Lerner wrote:
              > Hiroshi Iwatani wrote:
              >
              >>> Hiroshi Iwatani wrote:
              >>>
              >>>> Could we specify two or more commands in the -c option? If the
              >>>> answer is yes, then how?
              >>>>
              >>>> Specifically I'd like to do:
              >>>>
              >>>> :set fenc=cp932
              >>>>
              >>>> and
              >>>>
              >>>> :e ++enc=cp932
              >
              >
              >
              > Indeed some combinations of these two commands do not work as you expect.
              >
              > Try not to use 'set fenc=cp932' because doc says (in help fenc):
              >
              > To read a file in a certain encoding it won't work by setting
              > 'fileencoding', use the |++enc| argument.
              >
              > I think this will work for you:
              >
              > vi -c 'e ++enc=cp932 ..File..'
              >
              > Yakov
              >
              >

              --
              Hiroshi Iwatani

              *stop cruelty* Annual number of institutionally euthanized cats and dogs
              including kittens and puppies: US 5 million, JP 500 thousand. How about your
              country? *for our better karma*
              ---------------------
            • Antoine J. Mechelynck
              ... [...] Yes. ++enc sets the fileencoding option for the file concerned (as with ... HTH, Tony.
              Message 6 of 6 , Feb 29, 2004
                Hiroshi Iwatani <HGA03630@...> wrote:
                > > I think this will work for you:
                > >
                > > vi -c 'e ++enc=cp932 ..File..'
                > Yes.
                >
                > gvim -c "e ++enc=cp932" file
                >
                > does work. But only anxiety is whether this command could also
                > play the function of set fenc. In other words,
                >
                > -c "set fenc=cp932" -c "e ++enc=cp932"
                >
                > is unnecessarily redundant?
                [...]

                Yes. ++enc sets the 'fileencoding' option for the file concerned (as with
                :setlocal fileencoding), see ":help ++opt"

                HTH,
                Tony.
              Your message has been successfully submitted and would be delivered to recipients shortly.