Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My solution is as follows:</p> <pre><code>set stl=%f%h%m%r\ %{Options()}%=%l,%c-%v\ %{line('$')} fu! PlusOpt(opt) let option = a:opt if option return "+" else return "-" endif endf fu! Options() let opt="ic".PlusOpt(&amp;ic) let opt=opt." ".&amp;ff let opt=opt." ".&amp;ft if &amp;ft==?"cpp" || &amp;ft==?"perl" let text = " {" . FindCurrentFunction() . "}" let opt= opt.text endif return opt fu! FindCurrentFunction() let text ='' let save_cursor = getpos(".") let opening_brace = searchpair('{','','}','bWr', '', '', 100) if opening_brace &gt; 0 let oldmagic = &amp;magic let &amp;magic = 1 let operators='operator\s*\%((\s*)\|\[]\|[+*/%^&amp;|~!=&lt;&gt;-]=\?\|[&lt;&gt;&amp;|+-]\{2}\|&gt;&gt;=\|&lt;&lt;=\|-&gt;\*\|,\|-&gt;\|(\s*)\)\s*' let class_func_string = '\(\([[:alpha:]_]\w*\)\s*::\s*\)*\s*\%(\~\2\|'.operators let class_func_string = class_func_string . '\|[[:alpha:]_]\w*\)\ze\s*(' let searchstring = '\_^\S.\{-}\%('.operators let searchstring = searchstring.'\|[[:alpha:]_]\w*\)\s*(.*\n\%(\_^\s.*\n\)*\_^{' let l = search(searchstring, 'bW', line(".")-20 ) if l != 0 let line_text = getline(l) let matched_text = matchstr(line_text, class_func_string) let matched_text = substitute(matched_text, '\s', '', 'g') let text = matched_text endif call setpos('.', save_cursor) let &amp;magic = oldmagic endif return text endfunction </code></pre> <p>I'm actually attempting to match the C/C++/Java allowed names for functions. This generally works for me (including for overloaded operators) but assumes that the opening { is at column 0 on a line by itself.</p> <p>I just noticed today that it fails if included in a namespace {}, even if otherwise formatted as expected.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload