Hacker News new | past | comments | ask | show | jobs | submit login
Snake: Full Python Scripting in Vim (github.com/amoffat)
154 points by daenz on May 17, 2015 | hide | past | favorite | 20 comments



Nice work! The pip/virtualenv loader is really great, and can make the plugin dev more purely focused on the plugin. I think this part can be a great standalone project.

But I don't know about the boilerplate functions, some of them feel useful (like output capturing, state preserving), while others are just shallow abstractions over the vim API, which is almost never good. Abstraction over API is only useful when it provides different and better semantics, like jQuery over DOM.


This looks great! I know vimscript is painful, and even though I'm not sure how easy the existing Python solutions are, this seems like a breeze.


Isn't this also one of the goals of NeoVim? That you can script from any language.


Sure, and you can in Vim for the most part too. Snake has some excellent ideas how to use idiomatic Python, however, which would likely rest upon a more low level exposure of NeoVim anyway.


How does this differ from the Python support Vim already has?


It looks to me like boilerplate that allows you to more easily interface between the python world and the vim world. So instead of putting a bunch of python in your ~/.vimrc, you would install this plugin, and then put your relevant python in your ~/.vimrc.py.


Adding to this answer, it looks like this will handle virtualenvs requested for dependencies as well (albeit not completely yet). This is a pretty big deal in order for almost anything non-trivial since libraries like requests quickly come into play.


This is so cool, thanks! I wonder what the limitations are?


Your imagination. :D


So, Emacs running in a lisp interpreter running in python inside vim?


I'm looking forward to playing around with this. Vim is my editor of choice, and it would be nice to configure/extend it in something other than vimscript. Gives me a good reason to familiarize myself with Python as well.

Not to mention I'm a huge Metal Gear fan. =]


Isn't this actually "Vim scripting in Python"?


English is a very flexible and versatile language. The word "in" may be used in either of those senses, among many others.

Dictionary.com lists examples of both meanings:

1. (used to indicate inclusion within space, a place, or limits): walking in the park.

5. (used to indicate means): sketched in ink; spoken in French.

http://dictionary.reference.com/browse/in


I never wrote Vimscript or Python plugins for vim. What's the difference between snake and vim's normal python plugins?


Currently feeling very deep nastalgia for Metal Gear


True that! When I first saw the starting credits of MGS i was like ...whoooaaaa !


Is there some way I can pop into pdb when doing this? That would solve the biggest problem I have when writing vim scripts.


This might finally get me to switch from Sublime Text 3 to VIM. Been looking for an excuse to make the jump anyway.


There are no pathogen instructions. Can I just clone it into bundle directory? Will this work?

[Edit]: Grammar


BTW what are your tips for programming python with vim?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: