Vi: Visual Studio like tooltip summary of lib/api/object/function - vim

Like Visual Studio when you type-in a tooltip shows you the summary (documentation) of lib/objects/functions etc.
Suppose, I'm experimenting with DataMapper. I would like to see what it has and what each of them can do (purpose) without leaving vim. Is this possible?

Although I'm doing PHP development, not Ruby, I think this will also work for Ruby:
For PHP (Drupal) I generate a tags file with ctags and configure vim to use this tagfile by setting the tags-option. (see :help tags).
Now when I start typing a function-name I can press CTRL-X CTRL-O to start Omnicompletion. Vim show a list of all possible completions and you can select next/previous suggestions with CTRL-N and CTRL-P. When selecting a completion Vim also shows the function declaration in a preview window.
You can close the preview window with the :pclose-command.
The preview will only show up if the completeopt-settings contains the preview value (see :help 'completeopt')

Related

plugin to vim that shows definition of function/macro/struct in a popup box?

Im using vim with ctag+tagbar plugin to navigate through kernel code and its amazing ! Thanks to a guide I saw here.
I read here about some nice shortcuts for ctags that helps a lot, but I couldnt find a way that a definition(of structs/function etc) would show in popup box - something like eclipse ide.
Is there a way to do so with ctag? is there a plug-in I can add to vim that would that ? so when the mouse cursor(or also keyboard cursor) on function a popup box next to it will show?
Thanks!
Generally, you should avoid trying to use Vim as an IDE. It's meant to be a modular text editor.
Having said that, if you are looking for eclipse functionality inside of Vim, you may want to consider eclim. Another good set of plugins are the Clang based tools, like clang-format and YouCompleteMe.
ctags is very useful plugin, but if you also use ctags you can then copy file http://cscope.sourceforge.net/cscope_maps.vim to your ~/.vim/plugin directory and this will add keymappings that will allow you to jump to definition or show it in horizontal or vertical split.
I also added to my cscope_maps file an extra set of mappings like so:
nmap <C-h>g :tab cs find g <C-R>=expand("<cword>")<CR><CR>
to open my search in a new tab.
Example above allows you to use Ctrl+h and then g to "find global definition(s) of the token under cursor" and open it in a new tab.
Consider using cscope- it can also work with ctags (I always use both).
I know that this is not a pop-up window, but vim is not an IDE.

Vim binding in browsers

I have been googling for a way to use vim bindings inside normal text fields in chrome. I've tried vmium and cVim but I can't figure out whether they have the functionality I'm looking for.
An example is this exact text area in which I'm typing my question. I'd like to be able to press Esc and go to vim command mode in here, and start deleting a line pressing dd.
Would that be possible? Or those plugins are just for navigation shortcuts?
Here's the answer!
Those plugins are for navigation only. If you want a Vi-like
experience in Chrome's textareas, try Wasavi. – #romainl
The cVim plugin allows for keyboard shortcuts to manipulate text inside text boxes. However, the shortcuts are not the same as vim and there are not as many. After installing the extension type ":help" to see the list of shortcuts.

Toggling preview tab for pydoc

I am new to VIM and I had this happened on few occasions. I am using these plug-ins:
nerdcommenter-master
vim-autoclose-master
vim-multiple-cursors-master
nerdtree-master
vim-autocomplpop
Sometimes I am typing python commands and autocomplete comes up, and I accidentally hit something. This new tab pop-ups with help text, describing the autocompleted command, basically like using pydoc. I'd like to know what this is called and how can I invoke it (I find it very useful).
What you see is the omni completion from the Python filetype plugin that ships with Vim, in $VIMRUNTIME/autoload/pythoncomplete.vim. It is automatically triggered by the AutoComplPop plugin. You can also explicitly invoke it by pressing <C-x><C-o> in insert mode; :help i_CTRL-X_CTRL-O.
The preview comes courtesy of :set completeopt+=preview.

Vim format source code from Visual mode

watching a screencast (can't link it since you need to have a peepcode pro subscription) I've seen a developer indenting his source code (a ruby file) graphically using the visual mode inside vim. He did the following steps: press "v" selecting lines and then pressing something else I didn't get (because there is no representation of what's being pressed on the keyboard), then he got the whole source perfectly indented, without the need to write something on the command line.
Is there a plugin you know to do it that way from visual mode?
You can press = in visual mode to automatically indent your code.
Or you can use > and < in visual mode to change the indentation level
of the selected code.
This plugin does exactly what you want: https://github.com/Chiel92/vim-autoformat.
That would be V(motion)=.
See :help = for details.

Vim JSDoc, PHPDoc, JavaDoc, RDoc info

Here is the deal,
If you've used Aptana, Eclipse or even Microsoft Expression Web editor, then you've seen that they feature a Balloon Text or Intellisense popup showing hints/info of built-in and custom objects, methods, etc.
They get the info thru JSDoc, PHPDoc, JavaDoc, RDoc, etc.
I'd like to get these feature in Vim, maybe implemented as omnicompletion and also since Mac/GVim supports balloon text, as this as well.
This feature actually exists and is defined in each file type's Omni-completion. For example, enabling PHP's omni-completion will show completions in a popup window as well as the method definition in a smaller buffer which opens at the top of the current tab-frame.
Activate it by adding the following to your .vimrc
filetype plugin on
au FileType php set omnifunc=phpcomplete#CompletePHP
And then using C-x C-o for completion. (I find many people like to remap this to C-space to mimic Visual Studio)
More information and links about omnicompletion can be found at http://vim.wikia.com/wiki/Omni_completion

Resources