On Sat, 17 Mar 2012, Dotan Cohen wrote:
This is my .vimrc file:
1 set nu
2 set laststatus=2
3
4 function! PHP_Cursor_Position()
5 let pos = getpos(".")
6 let curline = pos[1]
7 let win = winsaveview()
8 let decl = ""
9 let startline =
search('^\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(function\|class\)\s*&\=\w\+','cbW')
10 call search('{','cW')
11 sil exe "normal %"
12 let endline = line(".")
13 if curline >= startline && curline <= endline
14 let decl = getline(startline)
15 endif
16 call cursor(pos)
17 call winrestview(win)
18 return decl
19 endfunction
20
21 set statusline=%{PHP_Cursor_Position()}
22
(Minor nit: don't include line numbers -- it makes it slightly annoying
to copy-paste).
Initial thoughts:
9 let startline =
search('^\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(static\|public\|private\)\=\s*\(function\|class\)\s*&\=\w\+','cbW')
You left out 'protected'. And you can only have two of those in PHP,
not three (static/not) + (one visibility).
Also, there's an optional space after the return-by-reference marker.
Taking those two considerations, and using ___\{,2} instead of ___\= ___\=, you
get:
let startline =
search('^\s*\(\(static\|public\|private\|protected\)\s\+\)\{,2}\(function\|class\)\s*&\=\s*\w\+','cbW')
Just opening .vimrc and leaving the curso at the opening position
makes the console bell ring repeatedly. What might be the problem?
No idea. Doesn't happen here under Gentoo w/ 7.3.266 or OpenSUSE w/ 7.3.322
I also have these plugins and files installed:
Just listing what files you have installed doesn't help much. There's
no central registrar for Vim plugin filenames, so e.g. your ctags.vim
could be any of several such plugins.
If you think it's plugin-related, there are two things to try. First,
try disabling them all, by starting Vim with the --noplugin flag. Then,
try disabling them individually or in groups by adding 'finish' as the
first line of the one(s) you want to disable.
--
Best,
Ben
--
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