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

Re: col() in insert mode

Expand Messages
  • 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 1 of 8 , Feb 1, 2002
      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.