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

col() in insert mode

Expand Messages
  • KONTRA Gergely
    Hi! Can anybody tell me how to get the cursor position in insert mode? The problem is the last column. When after and before the last column, the returned
    Message 1 of 8 , Jan 24, 2002
    • 0 Attachment
      Hi!

      Can anybody tell me how to get the cursor position in insert mode?
      The problem is the last column. When after and before the last column,
      the returned value is the same. :(

      Gergo

      +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
      | Email: CHANGED! kgergely@... kgergely@... (old) |
      | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
      +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
      .
      Magyar php mirror es magyar php dokumentacio: http://hu.php.net
    • Benji Fisher
      ... Did you try =col( . ) ? HTH --Benji Fisher
      Message 2 of 8 , Jan 24, 2002
      • 0 Attachment
        KONTRA Gergely wrote:
        >
        > Hi!
        >
        > Can anybody tell me how to get the cursor position in insert mode?
        > The problem is the last column. When after and before the last column,
        > the returned value is the same. :(
        >
        > Gergo

        Did you try <C-R>=col(".")<CR> ?

        HTH --Benji Fisher
      • KONTRA Gergely
        ... Then try :echo col( . ) after the last char :))) Gergo +-[Kontra Gergely @ Budapest University of Technology and Economics]-+ ... +------- Olyan
        Message 3 of 8 , Jan 24, 2002
        • 0 Attachment
          > Did you try <C-R>=col(".")<CR> ?
          Then try <C-o>:echo col('.')<CR> after the last char :)))

          Gergo

          +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
          | Email: CHANGED! kgergely@... kgergely@... (old) |
          | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
          +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
          .
          Magyar php mirror es magyar php dokumentacio: http://hu.php.net
        • Benji Fisher
          ... I know that there are problems with , which is why I suggested using . --Benji Fisher
          Message 4 of 8 , Jan 24, 2002
          • 0 Attachment
            KONTRA Gergely wrote:
            >
            > > Did you try <C-R>=col(".")<CR> ?
            > Then try <C-o>:echo col('.')<CR> after the last char :)))

            I know that there are problems with <C-O>, which is why I suggested using
            <C-R>.

            --Benji Fisher
          • KONTRA Gergely
            ... What if I must issue a normal command after getting this column number? I see no way to do this ;( I mean no easy way... Gergo +-[Kontra Gergely @ Budapest
            Message 5 of 8 , Jan 25, 2002
            • 0 Attachment
              >> Can anybody tell me how to get the cursor position in insert mode?
              >> The problem is the last column. When after and before the last column,
              >> the returned value is the same. :(
              > Did you try <C-R>=col(".")<CR> ?
              What if I must issue a normal command after getting this column number?
              I see no way to do this ;(
              I mean no easy way...

              Gergo

              +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
              | Email: CHANGED! kgergely@... kgergely@... (old) |
              | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
              +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
              .
              Magyar php mirror es magyar php dokumentacio: http://hu.php.net
            • KONTRA Gergely
              ... I want to highlight the matching parent before the cursor (in insert mode). So the task is (in my opinion) - Figure out current position - See the
              Message 6 of 8 , Jan 28, 2002
              • 0 Attachment
                >it may not be too bad, depending on what you're trying to do. can you
                >elaborate, please?
                I want to highlight the matching parent before the cursor (in insert
                mode).
                So the task is (in my opinion)
                - Figure out current position
                - See the character under the cursor
                - If it is a bracket, issue a % command
                - Mark the current char as a Search highlight (or what you want)
                - Go back to the cursor position

                Maybe I will solve it with a mapping: eg:
                imap ) )<Esc>:call MyMatchParen<CR>a


                Gergo


                +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
                | Email: CHANGED! kgergely@... kgergely@... (old) |
                | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
                .
                Magyar php mirror es magyar php dokumentacio: http://hu.php.net
              • lwwickla@rockwellcollins.com
                Have you looked at matchtime and showmatch yet? Will those do what you re looking for? I have the following in my vimrc: In order to show matches and to
                Message 7 of 8 , Jan 28, 2002
                • 0 Attachment
                  Have you looked at 'matchtime' and 'showmatch' yet? Will those do what
                  you're looking for?

                  I have the following in my vimrc:
                  " In order to show matches and to format (), [], and {} nicely when they
                  " appear on multiple lines.
                  set showmatch matchtime=15
                  inoremap } }<bs>}
                  inoremap ) )<bs>)
                  inoremap ] ]<bs>]





                  KONTRA Gergely <kgergely@...> on 01/28/2002 06:01:16 AM

                  To: "HALIM,SALMAN (HP-NewJersey,ex2)" <salman@...>
                  cc: vim@...

                  Subject: RE: col() in insert mode


                  >it may not be too bad, depending on what you're trying to do. can you
                  >elaborate, please?
                  I want to highlight the matching parent before the cursor (in insert
                  mode).
                  So the task is (in my opinion)
                  - Figure out current position
                  - See the character under the cursor
                  - If it is a bracket, issue a % command
                  - Mark the current char as a Search highlight (or what you want)
                  - Go back to the cursor position

                  Maybe I will solve it with a mapping: eg:
                  imap ) )<Esc>:call MyMatchParen<CR>a


                  Gergo


                  +-[Kontra Gergely @ Budapest University of Technology and Economics]-+
                  | Email: CHANGED! kgergely@... kgergely@... (old) |
                  | URL: turul.eet.bme.hu/~kgergely Mobile: (+36 20) 356 9656 |
                  +-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"------+
                  .
                  Magyar php mirror es magyar php dokumentacio: http://hu.php.net
                • Benji Fisher
                  ... Try something like this: =Foo() where you have defined Foo() already, fun! Foo() let c = col( . ) Do stuff with c return endfun HTH
                  Message 8 of 8 , Feb 1, 2002
                  • 0 Attachment
                    KONTRA Gergely wrote:
                    >
                    > >> Can anybody tell me how to get the cursor position in insert mode?
                    > >> The problem is the last column. When after and before the last column,
                    > >> the returned value is the same. :(
                    > > Did you try <C-R>=col(".")<CR> ?
                    > What if I must issue a normal command after getting this column number?
                    > I see no way to do this ;(
                    > I mean no easy way...
                    >
                    > Gergo

                    Try something like this:

                    <C-R>=Foo()<CR>

                    where you have defined Foo() already,

                    fun! Foo()
                    let c = col(".")
                    " Do stuff with c
                    return ""
                    endfun

                    HTH --Benji Fisher
                  Your message has been successfully submitted and would be delivered to recipients shortly.