Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a popup message when I hover on any word of a Ruby file?

Tags:

vim

editor

ruby

If I hover the mouse on any word of a Ruby file, I get a tooltip message.

A screenshot of that popup message is at popup message.

cat ~/.gvimrc returns:

function! SyntaxBalloon()
    let synID   = synID(v:beval_lnum, v:beval_col, 0)
    let groupID = synIDtrans(synID)
    let name    = synIDattr(synID, "name")
    let group   = synIDattr(groupID, "name")
    return name . "\n" . group
endfunction

set balloonexpr=SyntaxBalloon()
set ballooneval

"how syntax highlighting groups for word under cursor
nmap <F2> :call <SID>SynStack()<CR>
function! <SID>SynStack()
    if !exists("*synstack")
        return
    endif
    echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
like image 569
shibly Avatar asked Dec 16 '11 12:12

shibly


4 Answers

The cleanest simplest way is to put this in your .vimrc:

  • :set noballooneval

Place it after you initialize Syntastic and Pathogen, if you use those plugins.

In some instances people have had problems with setting noballooneval, there's a few work-arounds:

  • If something is overwriting your noballooneval setting you can use :verb set ballooneval? to watch changes to it.
  • :set balloondelay=100000
  • :setlocal balloonexpr=
  • Find the offending line in the plugin you're using and comment it out (grep for balloon).
  • If you are building your own Vim, balloon_eval is a compile-time configuration option, you can use that to enable or disable the feature.

References:

  • https://github.com/b4winckler/macvim/blob/master/runtime/ftplugin/ruby.vim#L62
  • http://vimdoc.sourceforge.net/htmldoc/debugger.html#balloon-eval
  • http://icy.io/osx/macvim-ruby-balloon-issue

See also: I get this window while editing Ruby Files in Vim. What is it?

like image 115
Anthony Michael Cook Avatar answered Oct 23 '22 18:10

Anthony Michael Cook


You're are using vim-ruby I guess. Well, this plugin defined a balloonexpr. You can read it here. Personally I find it quite annoying so I have disabled it with:

setlocal balloonexpr=

in my .vim/after/ftplugin/ruby.vim file.

like image 10
lucapette Avatar answered Oct 23 '22 18:10

lucapette


If you're using MacVim, the built-in netrw plugin will overwrite your set noballooneval setting. You have to do this:

" Disable hover tooltips
set noballooneval
let g:netrw_nobeval = 1
like image 5
Jarin Udom Avatar answered Oct 23 '22 17:10

Jarin Udom


What you see in the tooltip is the default output of ri when run without arguments.

I think I saw an almost identical problem here a few weeks ago: a ri vim script/macro that somehow didn't send the correct argument (word under cursor) to ri.

You should hunt down the script/plugin/macro/autocommand that is supposed to interact with ri and see if:

  1. It effectively grabs the word under cursor.
  2. Actually sends it to ri.
  3. Uses the right API to talk to ri.

Do you use Janus or some other "distro"?

like image 1
romainl Avatar answered Oct 23 '22 19:10

romainl