How can I import more code completion in vim? - vim

I program using java and vim and I want to figure out how to do code completion in vim. I downloaded the vim plugin javacompletion and it works, but it only for j2se but not for android source code.
Is there any code completion in vim for andriod source code? I would like that when I, for example, enter "TextView." (the class in android.jar) and press ctrl+x ctrl+o, it should show the functions in TextView.

Have look at Vjde vim plugin.
I remember using it before and you just have to tell it to also look inside android.jar for the stuff to autocomplete.

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 omnicomplete open documentation on demand

I used Jedi-vim for vim python auto-completion and it works well. It has shortcut to show preview/documentation of a function on demand.
I'm working on C++ projects now and I'm trying to use original omnicomplete+ctag to accomplish the same thing. But I can't find functions similar to in Jedi-vim.
I don't want to show preview window all the time by doing ":set completeopt+=preview", and I don't want to use huge autocompletion plug-in like "YouCompleteMe", I just simply want to open/jump to preview on demand. Is there any way to accomplish it? Thanks in advance!
I think you will find :help preview-window interesting.
" shows the definition of foo in the preview window
:ptag foo
" shows the definition of the symbol under the cursor in the preview window
<C-w>}
You'll need to index your project with ctags or some compatible program for that feature to work, though.
" doesn't need ctags
:psearch foo

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.

how to configure vim commands to windows style?

My job involves working on Windows, *ix and with variety of IDE's like Eclipse, Visual Studio. Sometimes I really don't want to open Eclipse for little editing so I would prefer simple text editor like Vim, but the keys for the commands are horrible to me, I would like to setup Vim command keys to simple and modern style.
Can someone guide me how to configure Vim commands to simple keys like Ctrl+C or Ctrl+V for copy paste (through clipboard) or Shift+→, Shift+← for selecting text.
See this question: How do I configure VIM for using Ctrl-C Ctrl-V as copy paste to and from system buffer in ubuntu?
and the over all help on how to do key mapping here: How to make a keymap
It's not the answer you're looking for, but I'm with hammar. For example the Mac version of vim has the standard Mac-style copy/paste shortcut keys "baked in" yet I use the default vim keybindings now, since, like yourself, I hop about Linux/Windows/Mac, and having the same vim keyboard shortcuts.
Conversely, you'll find managing your personalized, if unorthodox, key bindings more onerous than simply "going vim."
I presume you've "worked" the vimtutor?

Resources