On Sunday, April 8, 2012 7:13:22 PM UTC-5, dotancohen wrote:
> 
> :set statusline=%<%f%=%([%{Tlist_Get_Tagname_By_Line()}]%)
> 
> 
> set statusline=%{PHP_Cursor_Position()}
> function! PHP_Cursor_Position()
>         let pos = getpos(".")
>         let curline = pos[1]
>         let win = winsaveview()
>         let decl = ""
>         let startline =
> search('^\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(function\|class\)\s*&\=\w\+','cbW')
>         call search('{','cW')
>         sil exe "normal %"
>         let endline = line(".")
>         if curline >= startline && curline <= endline
>                 let decl = getline(startline)
>         endif
>         call cursor(pos)
>         call winrestview(win)
>         return decl
> endfunction
> 

Just a guess, but I'm betting one of these is causing your trouble. First I 
note with interest that the first of them is always overwritten by the second 
and thus shouldn't do anything. Then I note that the second will, every time 
the screen redraws, mess with the cursor position. Although it restores it 
later, I wonder if it causes problems anyway.

I bet it would be possible to rewrite this in a way that it never moves the 
cursor, using the 'n' flag on the search() commands, and a searchpair() to 
replace the normal % command. But if it isn't actually the culprit of your jump 
position problems then it probably doesn't make sense to mess with it, if it 
works as intended.

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to