other plugins»,
sent 18:35:01 26 July 2011, Tuesday
by Arthur Lee:
You should not use :normal without a bang in a plugin (it may be the cause).
And you don't need any script-local variables here:
function WordCount()
let oldstatusmsg=v:statusmsg
try
execute "silent normal! g\<C-g>"
return +(split(v:statusmsg)[11])
finally
let v:statusmsg=oldstatusmsg
endtry
endfunction
Original message:
> function! WordCount()
> let s:old_status=v:statusmsg
> exe "silent normal g\<c-g>"
> let s:word_count=str2nr(split(v:statusmsg)[11])
> let v:statusmsg=s:old_status
> return s:word_count
> endfunction
No comments:
Post a Comment