I am using Emacs 23.1.1 on GNU/Linux with autocomplete.el 1.3 and Ropemacs 0.6.
In Lisp programming, autocomplete.el shows the documentation (known as 'QuickHelp' in autocomplete.el) of the suggested completions. Python completion with ropemacs works, but does not show quick help for the Python completion. Is it possible to enable it and did somebody make it work?
Ropemacs does the job : Use the function rope-show-doc over the symbol or use the keybinding C-c d. Simple :)
I stopped using all the autocomplete stuff in all my developing environments. They rarely do what I want. Either the lists is too long, or too short, or not sorted well. Therefore I use dabbrev-expand in all my modes global-set-key to tab.
This works even quote well for text. Usually it is enough to get a good expansion from the local buffer where you are in. If I start typing in an empty buffer I open a second one which expand can use to look up its suggestions. This is not language sensitive, not does depend on the object you want to call a method of, but its still a big boost, and you get used to it. Maybe its not, you don't get "quick help" this way.
Related
I am coding Python3 in Vim and would like to enable autocompletion.
I must use different computers without internet access. Every computer is running Linux with Vim preinstalled.
I dont want to have something to install, I just want the simplest way to enable python3 completion (even if it is not the best completion), just something easy to enable from scratch on a new Linux computer.
Many thanks
Unfortunately Vim, by default doesn't do what you want, you are pretty much limited to the Ctrl-P style, which is better than it seems once you get used to it.
However i also often find myself working on machines that are not allowed to access the internet or have other files placed on them and When i find myself in this situation and i am using an unfamiliar language i sometimes use Vim's dictionary completion: http://vim.wikia.com/wiki/VimTip91
To populate this dictionary i cat / trim / filter the man pages for the language to get a variety of keywords. I ram these into a filetype specific dictionary: au FileType * execute 'setlocal dict+=~/.vim/words/'.&filetype.'.txt'
Obviously this isn't the greatest solution and it is a bit heavy handed but it does provide a certain degree of "What is that function called" type stuff.
If you have compiled vim with +python3, you can try omnifunc.
Add following to your ~/.vimrc:
au FileType python setl ofu=python3complete#Complete
Then in insert mode, just type CtrlX + CtrlO.
See :help omnifunc.
by default, Ctrl-P in insert mode do an autocompletion with all the words already present in the file you're editing
I read that CTRL+P is the auto completion short cut in VI, but the recommendation given by the auto completion doesn't make that much sense to me.
Say from the re package there is a method called findall. Eclipse could recommend that method when I do CTRL+Space:
But When I tried the auto completion in VI, it could not find the findall method. the only recommendation seems like a command that I have typed before which has nothing to do with the re module.
Can Anyone give me some hints what is the auto completion story behind the CTRL+P in VI and how could I tune it up so it would be as good as Eclipse's auto completion.
(Every time I doubt the power of VI, the truth is always that it is me who lack the power to discover the beauty of VI)
Thanks!
In vim <C-p> is not the only completion shortcut available. Omni completion defined for python should be called with <C-x><C-o>, then use <C-n>/<C-p> to select variants. There are more completion types, all start with <C-x>, see :h ins-completion.
It is still better to use some third-party plugin (like jedi-vim or klen/python-mode) to get python completion as they are smarter. Note that at least klen/python-mode will not redefine <C-p>. They redefine <C-x><C-o> by setting 'omnifunc' option.
Without any additional modules, vim's autocompletion only searches the current file for occurences of the string you've started typing, regardless of whether it makes sense. If you use the tags file, via ctags or other, you're able to use strings across a variety of files, rather than just the current buffer.
Is there a emacs plugin which lists all the methods in the module in a side pane.
I am looking for a plugin which has keyboard shortcuts to show/hide all the methods in python module file currently opened.
I suggest using elpy.
C-c C-o runs elpy-occur-definitions which creates a new buffer with a list of all the class and function signatures.
You can navigate the list using C-n and C-p.
The mode works with next-error-follow minor mode.
So C-c C-f inside the buffer enables jumping to the class or function definition selected.
Here's an example of the contents of that buffer:
8 matches for "^ *\(def\|class\) " in buffer: leveling_utils.py
11:def leveling(episodes_with_potential_associations_by_member):
26:def _apply_leveling(sorted_episodes):
41:def _set_non_chronic_associations(episode):
73:def _apply_sub_to_procedural_association(assoc):
94:def _set_chronic_associations(episode):
102:def _set_associations_for_self(episode):
118:def _set_to_actual(association):
122:def _log_actual_associations(member, leveled_episodes):
By the way, it has many other useful features that to me, make it a necessary addition to python-mode.
For the first question, use M-xspeed-bar, like Alex suggested.
For the second, enable hs-minor-mode, M-xhs-minor-mode, and use C-cC-#C-S-h to hide all methods, and C-cC-#C-S-s to show.
You can look to ECB (it's better to take my fork of it, as it's adapted to fresh Emacs & CEDET) - it can display information about source code fetching it from Semantic (CEDET subpackage) or via imenu (for languages that aren't supported by Semantic).
Speedbar (included into GNU Emacs) can also show a list of top level objects, but doesn't show differences between imports, functions of other top-level stuff
For me, the easiest and most convenient method to quickly lookup methods is the command helm-occur (C-x c M-s o). You start typing the name of the method you want to jump to and suggestions start popping in as you type. Then you hit enter to select the one you want and your cursor jumps right there in the code. Helm-occur wasn't strictly written for this purpose, but works quite well that way.
Speedbar is good, and another nice alternative is helm-imenu. I've bind several keys to access it quicky from different contexts and use it most of the time
I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion working properly, for complete Vim newbies (for dummies?)?
There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs).
You may try Pydiction (Excerpt below)
Description Pydiction allows you to
Tab-complete Python code in Vim,
including: standard, custom and
third-party modules and packages. Plus
keywords, built-ins, and string
literals.
Pyflakes has a vim plugin that does this pretty awesomely. Unlike Pydiction, you don't need to build a dictionary beforehand (so if you're bouncing between different virtualenvs it's a bit less hassle.) I haven't been using it long but it seems very slick.
Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order.
In visual studio, I could just press ctrl+spacekey and the methods appeared. In Geany is there a way for me to get this functionality?
No, because is Python is dynamically typed language and quite hard to achieve that. Python plugins for netbeans do that partially, but I believe such plugin is not in geany developers plans. There are different things to be done ;-)
However, geany provides some completions support. First, it analyzes your imports in a file and uses it in completions; furthermore it completes functions from the std library. It also analyzes all you open files for suggestions, although you may need to apply it in preferences. Also you can get call tips, when you hit Ctrl+Shift+Space, which not everyone know about. They are quite good, because they appear in form <Class>.<method>(<args>), which is very helpful.
shortcut ctrl+space works for me. also, you can setup autocomplete suggestion length (ie how many letters you must type before the autocomplete tooltip pops up automatically - http://www.geany.org/manual/current/#editor-completions-preferences ).
this works only for method names. if i want to see the options for method parameters, i must type bracket ( after the method full name.