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

Inserting at cursor from command mode

Expand Messages
  • Yakov Lerner
    Let s say I want to insert at the cursor, from the script. I tried these, and it does not work: norm i does not work insert does not work --
    Message 1 of 5 , Mar 1, 2004
    • 0 Attachment
      Let's say I want to insert <cr> at the cursor, from the script.
      I tried these, and it does not work:
      norm i<cr> " does not work
      insert " does not work -- inserts but not at cursor

      .
      I found this but it's ugly:
      map ;;; i<cr><esc>
      norm ;;;
      Is it possible to insert <cr> at cursor from script without
      introducing temporary mapping ?

      Yakov
    • Michael Naumann
      ... I guess you need ... HTH, Michael
      Message 2 of 5 , Mar 1, 2004
      • 0 Attachment
        On Monday 01 March 2004 12:56, Yakov Lerner wrote:
        > Let's say I want to insert <cr> at the cursor, from the script.
        > I tried these, and it does not work:
        > norm i<cr> " does not work
        > insert " does not work -- inserts but not at cursor
        >
        > .
        > I found this but it's ugly:
        > map ;;; i<cr><esc>
        > norm ;;;
        > Is it possible to insert <cr> at cursor from script without
        > introducing temporary mapping ?
        >
        > Yakov

        I guess you need
        :map ;;; :exe "norm i\<cr>"

        HTH, Michael
      • gumnos (Tim Chase)
        ... Another possibility (sorry if this one s been mentioned and I didn t see it fly by) would be to do ... where all characters are entered literally -tim
        Message 3 of 5 , Mar 1, 2004
        • 0 Attachment
          > I guess you need
          > :map ;;; :exe "norm i\<cr>"

          Another possibility (sorry if this one's been mentioned and I didn't see
          it fly by) would be to do

          :nnoremap ;;; :s/\%#/\r<cr>

          where all characters are entered literally

          -tim
        • Mikolaj Machowski
          ... Try normal! i ^ m. -- - Squeak? - SQUEAK.
          Message 4 of 5 , Mar 1, 2004
          • 0 Attachment
            Dnia Monday 01 of March 2004 12:56, Yakov Lerner napisaƂ:
            > Let's say I want to insert <cr> at the cursor, from the script.
            > I tried these, and it does not work:
            > norm i<cr> " does not work
            > insert " does not work -- inserts but not at cursor

            Try
            normal! i<cr>
            ^

            m.
            --
            - Squeak?
            - SQUEAK.
          • Charles E. Campbell, Jr.
            ... exe norm! r If you just want a new line (not wanting to break a line): put = Regards, Chip Campbell
            Message 5 of 5 , Mar 1, 2004
            • 0 Attachment
              Yakov Lerner wrote:

              > Let's say I want to insert <cr> at the cursor, from the script.
              > I tried these, and it does not work:
              > norm i<cr> " does not work
              > insert " does not work -- inserts but not at cursor
              >
              > .
              > I found this but it's ugly:
              > map ;;; i<cr><esc>
              > norm ;;;
              > Is it possible to insert <cr> at cursor from script without
              > introducing temporary mapping ?


              exe "norm! r\<cr>"

              If you just want a new line (not wanting to break a line):

              put =''

              Regards,
              Chip Campbell
            Your message has been successfully submitted and would be delivered to recipients shortly.