5 ms·
Python Autocompletion for Vim, Emacs and TextMate
- rarrrrrr 17y agoI find it more comfortable to use tab for auto completion in Vim. Here's how: http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion http://vim.wikia.com/wiki/Smart_mapping_for_tab_completion
- peterlai 17y agoIs something like this available for PyDev (Eclipse)? Supposedly, PyDev already has autocompletion, but it doesn't seem very effective. Because of my experience with PyDev's autocompletion, I am also skeptical of PySmell's effectiveness. I'd love to see a screencast of it in action. Does anyone have first had experience with both PySmell's and PyDev's autcompletion? With Python IDEs, my biggest complaint is with this functionality.
- bad_user 17y agoVim, Emacs and Textmate aren't IDEs per se. They are general purpose text editors optimized for editing texts (although one could argue Emacs is an OS :)) The nature of Python is such that it's not possible to determine precisely all members of an object at compile time. I've used PyDev and I discovered that auto-completion in Python actually annoys me because it doesn't work all the time. For example, in Python you can add a method with a simple x.__dict__['method'] = some_method, not to mention magic methods like __getattr__. The trouble is many Python modules add members to classes through various meta-programming techniques. When using PyDev searching for a member name, instead of using the API's documentation, you can find yourself assuming that the member you're looking for does not exist, leading you in a wrong direction, and thus waisting more time. If the behavior of intellisense is unpredictable, it kind of stands in your way more than it helps. And without intellisense, it makes no sense to use a bloated IDE for Python (or dynamic languages in general). Dynamic languages have simple APIs anyway that can be learned easily. I have a shortcut defined for the "dir" and "help" commands in Python, and for "perldoc" in Perl, executed on the token under the cursor, and with the help of flymake-mode, it's more than enough. And in many instances it's even more productive ... if I don't remember the usage of DateTime::Format::Strptime in Perl I just look at the CPAN docs with perldoc, copy/pasting the example given.
- wesm 17y agoI used PyDev for a long time and recently switched to Wing IDE (had my company buy it for me). It's seriously like night and day when it comes to autocompletion and other IDE features that I found lacking in PyDev. Downside: not free.
- dryicerx 17y agoAnother fine addition to the emacs python setup is { Flymake+pylint, yasnippet } Now if someone can tell me how to get emacs to show the tabs visually... I will do anything for you. For example, visually showing the tabbed levels/scopes in different highlights.
- sharkbrainguy 17y agoYou mean something like this but for python? http://www.foldr.org/~michaelw/emacs/color-box.png http://www.foldr.org/~michaelw/emacs/color-box.png http://www.foldr.org/~michaelw/emacs/mwe-color-box.el http://www.foldr.org/~michaelw/emacs/mwe-color-box.el Indentation already is a visual indicator right?
- whacked_new 17y agoOh my, I was missing out on something awesome. Thanks!
- tudorachim 17y agoDo you happen to know if there exists something like this for vim?
- sharkbrainguy 17y agoThis doesn't even really exist for Emacs AFAIK, it makes the buffer read-only. it's really a proof of concept.
- durin42 17y agoAdd this to your load-path: http://www.emacswiki.org/emacs/show-wspace.el http://www.emacswiki.org/emacs/show-wspace.el Then add this to your .emacs: (require 'show-wspace) (add-hook 'python-mode-hook 'show-ws-highlight-tabs) (add-hook 'python-mode-hook 'show-ws-highlight-trailing-whitespace)
- dryicerx 17y agoJust realized that all my python code's tabs are converted in to 4 spaces (so the show-tabs is no dice... took me a while to realize what's going on. I guess the real usage I was looking for was, show/highlight indentations in python code.
- jussij 17y agoOn Windows the Zeus IDE tries to do something similar by using ctags.exe as its source of tag information: http://www.zeusedit.com/python.html http://www.zeusedit.com/python.html
- almost 17y agoThere's also ropemacs for Python auto-completion in Emacs. It also supports various automatic refactorings: http://rope.sourceforge.net/ropemacs.html http://rope.sourceforge.net/ropemacs.html It's not perfect but on the other hand it doesn't require that you run a tool to build the tag files each time (it just picks things up automatically).