Hi,

as already remarked in Tip #102, the provided versions do
not handle UTF-8 characters correctly. As it is not possible
to add a tip note currently, I post my new version here.

  function InsertMatch( direction)
    if match(getline( '.'),'\k\%'.virtcol('.').'v') >= 0
      let dir = a:direction
    else
      let dir = 0
    end
    if     dir < 0
      return "\<c-p>"
    elseif dir > 0
      return "\<c-n>"
    else
      return "\<tab>"
    endif
  endfunction

  inoremap <tab>   <c-r>=InsertMatch( -1)<cr>
  inoremap <s-tab> <c-r>=InsertMatch( +1)<cr>

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de

Reply via email to