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

insert newline

Expand Messages
  • bill lam
    Hello, This should be a very simple question. How to insert newline in command mode and stay in command mode? O and o doesn t work because it changes to insert
    Message 1 of 10 , Mar 28 6:58 PM
    • 0 Attachment
      Hello,

      This should be a very simple question. How to insert newline in command mode and
      stay in command mode? O and o doesn't work because it changes to insert mode.

      thanks.

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tim Chase
      ... There s no in-built way to do it, but it s easy enough to map. I ... -tim --~--~---------~--~----~------------~-------~--~----~ You received this message
      Message 2 of 10 , Mar 28 7:01 PM
      • 0 Attachment
        > This should be a very simple question. How to insert newline
        > in command mode and stay in command mode? O and o doesn't work
        > because it changes to insert mode.

        There's no in-built way to do it, but it's easy enough to map. I
        like to use <enter>, plus, or minus as my keys for doing this:

        :nnoremap <cr> o<esc>
        :nnoremap - O<esc>

        -tim




        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • bill lam
        Thanks to all for quick help. I still a question, could that command then be preceded by a number to make it inserting a number of lines?
        Message 3 of 10 , Mar 28 7:17 PM
        • 0 Attachment
          Thanks to all for quick help. I still a question, could that command then be
          preceded by a number to make it inserting a number of lines?


          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Tim Chase
          ... With the mapping solution, you can prefix the command with a count, such as 10- to insert 10 blank lines above the current one. -tim
          Message 4 of 10 , Mar 28 7:30 PM
          • 0 Attachment
            > Thanks to all for quick help. I still a question, could that
            > command then be preceded by a number to make it inserting a
            > number of lines?

            With the mapping solution, you can prefix the command with a
            count, such as

            10-

            to insert 10 blank lines above the current one.

            -tim



            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • A.Politz
            ... There s no normal mapping for that. -ap -- ... --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist.
            Message 5 of 10 , Mar 28 7:31 PM
            • 0 Attachment
              bill lam wrote:

              >Hello,
              >
              >This should be a very simple question. How to insert newline in command mode and
              >stay in command mode? O and o doesn't work because it changes to insert mode.
              >
              >
              >
              :put=''

              There's no normal mapping for that.

              -ap

              --
              :wq


              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • bill lam
              ... I tested it worked and thank you for confirmation on key mapping behaviour. regards, --~--~---------~--~----~------------~-------~--~----~ You received
              Message 6 of 10 , Mar 28 7:41 PM
              • 0 Attachment
                Tim Chase wrote:
                > With the mapping solution, you can prefix the command with a
                > count, such as

                I tested it worked and thank you for confirmation on key mapping behaviour.

                regards,

                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              • Sadarax
                There is another method, though perhaps not as nice as the other mention. Just copy a blank like (with yy ) and then paste it. That works with all the number
                Message 7 of 10 , Mar 29 1:29 AM
                • 0 Attachment
                  There is another method, though perhaps not as nice as the other mention. Just copy a blank like (with 'yy') and then paste it. That works with all the number commands and most anything else you want.

                  -Sadarax

                  On Fri, Mar 28, 2008 at 7:41 PM, bill lam <cbill.lam@...> wrote:

                  Tim Chase wrote:
                  > With the mapping solution, you can prefix the command with a
                  > count, such as

                  I tested it worked and thank you for confirmation on key mapping behaviour.

                  regards,





                  --
                  How sad it would be to live a life less wonderful, if only because one were afraid of a little hard work. If you shy away from challenges, you shy away from some of the greatest achievements in life.
                  --~--~---------~--~----~------------~-------~--~----~
                  You received this message from the "vim_use" maillist.
                  For more information, visit http://www.vim.org/maillist.php
                  -~----------~----~----~----~------~----~------~--~---

                • Charles E Campbell Jr
                  ... Do you really mean command mode (and not normal mode )? If so, ... will put an empty line after the line the cursor is presently on and ... will put an
                  Message 8 of 10 , Apr 1, 2008
                  • 0 Attachment
                    bill lam wrote:
                    > Hello,
                    >
                    > This should be a very simple question. How to insert newline in command mode and
                    > stay in command mode? O and o doesn't work because it changes to insert mode.
                    >
                    Do you really mean "command mode" (and not "normal mode")? If so,

                    :put =''

                    will put an empty line after the line the cursor is presently on and

                    :put! =''

                    will put an empty line before the line the cursor is presently on.
                    Note: the characters following the "=" are *TWO* single quotes, '', not
                    a double quote.

                    However, I suspect you're interested in doing this operation in normal
                    mode as you mention using O and o -- which aren't particularly effective
                    in command mode by themselves.

                    Regards,
                    Chip Campbell


                    --~--~---------~--~----~------------~-------~--~----~
                    You received this message from the "vim_use" maillist.
                    For more information, visit http://www.vim.org/maillist.php
                    -~----------~----~----~----~------~----~------~--~---
                  • Tony Mechelynck
                    ... According to :help Normal , Normal mode is also known as command mode. (Not to be confused with Command-line mode, also called Cmdline mode, which is for
                    Message 9 of 10 , Apr 1, 2008
                    • 0 Attachment
                      Charles E Campbell Jr wrote:
                      > bill lam wrote:
                      >> Hello,
                      >>
                      >> This should be a very simple question. How to insert newline in command mode and
                      >> stay in command mode? O and o doesn't work because it changes to insert mode.
                      >>
                      > Do you really mean "command mode" (and not "normal mode")? If so,
                      >
                      > :put =''
                      >
                      > will put an empty line after the line the cursor is presently on and
                      >
                      > :put! =''
                      >
                      > will put an empty line before the line the cursor is presently on.
                      > Note: the characters following the "=" are *TWO* single quotes, '', not
                      > a double quote.
                      >
                      > However, I suspect you're interested in doing this operation in normal
                      > mode as you mention using O and o -- which aren't particularly effective
                      > in command mode by themselves.
                      >
                      > Regards,
                      > Chip Campbell

                      According to ":help Normal", Normal mode is also known as command mode.

                      (Not to be confused with Command-line mode, also called Cmdline mode,
                      which is for entering one ex-command; then you come back to Normal mode.)


                      Best regards,
                      Tony.
                      --
                      f y cn rd ths thn y cn hv grt jb n cmptr prgrmmng

                      --~--~---------~--~----~------------~-------~--~----~
                      You received this message from the "vim_use" maillist.
                      For more information, visit http://www.vim.org/maillist.php
                      -~----------~----~----~----~------~----~------~--~---
                    • bill lam
                      ... iirc when I first encountered vi some 20 years ago, that was called command mode and the command-line mode might be called colon mode . I m not sure
                      Message 10 of 10 , Apr 1, 2008
                      • 0 Attachment
                        >> Do you really mean "command mode" (and not "normal mode")? If so,

                        > According to ":help Normal", Normal mode is also known as command mode.

                        iirc when I first encountered vi some 20 years ago, that was called "command
                        mode" and the command-line mode might be called "colon mode". I'm not sure for
                        that. "insert mode" was called "input mode"

                        regards,




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