{ "info": { "author": "Vincent Driessen", "author_email": "vincent@datafox.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Text Editors" ], "description": "=====================================\n vim_bridge - a Python-to-Vim bridge\n=====================================\n\nWhat is it?\n-----------\nvim_bridge_ is a Python-to-Vim bridge decorator that allows transparent calls\nto Python functions in native Vim scripts.\n\n\nInstallation\n------------\nSimply install the vim_bridge_ Python package, using setuptools,\n``easy_install``, or ``pip``.\n\n\n.. _vim_bridge: http://pypi.python.org/pypi/vim_bridge/\n\n\nUsage\n-----\nIn a Vim script, decorate your Python functions as follows to expose them as\nnative Vim callables. Both arguments and return values are casted so it should\nbe transparent::\n\n python << endpython\n from vim_bridge import bridged\n\n @bridged\n def SayHello(first, last):\n return \"Hello, %s %s!\" % (first, last)\n\n endpython\n\n \" Now call directly into the Python function!\n echo SayHello(\"John\", \"Doe\")\n \" prints \"Hello, John Doe!\"\n\n\nSupported\n---------\nThe following data types have proven to work:\n\n* Strings\n* Integers\n* Lists\n* Exceptions\n\n\nMore examples\n-------------\nPassing in a list::\n\n python << endpython\n from vim_bridge import bridged\n\n @bridged\n def GetLongest(list):\n return max(map(lambda s: len(s), list))\n\n endpython\n\n echo GetLongest(['one', 'two', 'three', 'four'])\n \" returns 5 (because \"three\" is 5 chars long)\n\n\nCatching exceptions::\n\n python << endpython\n from vim_bridge import bridged\n\n @bridged\n def WillCauseException():\n raise Exception(\"Oops\")\n\n endpython\n\n \" This will throw an error to the user...\n echo WillCauseException()\n\n \" But here's how you can catch that in Vim\n try\n echo WillCauseException()\n catch\n echo \"Something went wrong. Aborting.\"\n finally\n echo \"Cleaning up.\"\n endtry\n\n\nUsing Python stdlib functions to do work that would be more difficult using\npure Vim scripting::\n\n python << END\n import os.path\n from vim_bridge import bridged\n\n @bridged\n def NormalizePath(path):\n return os.path.realpath(path)\n END\n\n echo NormalizePath(\"/this/../or/./.././that/is/./a/.//very/../obscure/..//././long/./../path/name\")\n echo NormalizePath(\"..\")\n\n\nYou can use the bridged function definitions within a Python block itself, or\nfrom inside Vim, it does not matter. In this example, NormalizePath is called\nfrom both Python and Vim::\n\n python << END\n import os.path\n from vim_bridge import bridged\n\n @bridged\n def NormalizePath(path):\n return os.path.realpath(path)\n\n @bridged\n def RealPath(path):\n # It does not matter if you call NormalizePath from here...\n return NormalizePath(path)\n END\n\n \" ...or from here\n echo NormalizePath(\"/this/../or/./.././that/is/./a/.//very/../obscure/..//././long/./../path/name\")\n echo RealPath(\"..\")\n\n\nSince vim_bridge 0.4, the function name casing convention is automatically\nconverted to match Vim's conventions (and *requirement* even, since function\nnames **must** start with a capital letter). Besides casing, prefixing the\nPython function with an underscore will lead to the function being defined in\nthe Vim context as a ````-prefixed function (i.e. a \"private\" function\nthat cannot be called from outside the script)::\n\n python << eop\n import os\n import vim\n from vim_bridge import bridged\n\n @bridged\n def public():\n return \"I am public.\"\n\n @bridged\n def _private():\n return \"I am private (available in the current script only).\"\n\n @bridged\n def my_name_is_auto_converted():\n return \"In Python, I'm called my_name_is_auto_converted, \" + \\\n \"but in Vim, I'm called MyNameIsAutoConverted :)\"\n\n @bridged\n def _long_private_name():\n return \"I'm private, and my case is converted automatically.\"\n eop\n\n echo Public()\n echo s:Private()\n echo MyNameIsAutoConverted()\n echo s:LongPrivateName()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/nvie/vim_bridge", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "vim_bridge", "package_url": "https://pypi.org/project/vim_bridge/", "platform": "any", "project_url": "https://pypi.org/project/vim_bridge/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/nvie/vim_bridge" }, "release_url": "https://pypi.org/project/vim_bridge/0.5/", "requires_dist": null, "requires_python": null, "summary": "A Python-to-Vim bridge decorator that allows transparent calls to Python functions in native Vim scripts.", "version": "0.5" }, "last_serial": 663321, "releases": { "0.1": [], "0.2": [], "0.3": [], "0.4": [ { "comment_text": "", "digests": { "md5": "935e7e09f0f1ed2334c7dae6e69769ad", "sha256": "94ac2e1e58abdd7bd480973bc91311988b4e00b4f71af3bc97ed06d31a64461f" }, "downloads": -1, "filename": "vim_bridge-0.4.tar.gz", "has_sig": false, "md5_digest": "935e7e09f0f1ed2334c7dae6e69769ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3324, "upload_time": "2010-07-28T09:00:34", "url": "https://files.pythonhosted.org/packages/f2/db/de1f1a639162dd096619ad14a811beecd0f70e6269b57f9a457946ba9fbd/vim_bridge-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "bb96c4cb0e64279a71368d5625dbe495", "sha256": "d2cd47ac8e6b052add7b51b2a964e46c6f7696018545c2bf0ad8a3fb16b431e4" }, "downloads": -1, "filename": "vim_bridge-0.5.tar.gz", "has_sig": false, "md5_digest": "bb96c4cb0e64279a71368d5625dbe495", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3662, "upload_time": "2010-11-14T08:05:18", "url": "https://files.pythonhosted.org/packages/38/d1/bc58e7dc4f98457593b90f1e6b04b0a1f58875a47a4ce0da29714c4b9b52/vim_bridge-0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bb96c4cb0e64279a71368d5625dbe495", "sha256": "d2cd47ac8e6b052add7b51b2a964e46c6f7696018545c2bf0ad8a3fb16b431e4" }, "downloads": -1, "filename": "vim_bridge-0.5.tar.gz", "has_sig": false, "md5_digest": "bb96c4cb0e64279a71368d5625dbe495", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3662, "upload_time": "2010-11-14T08:05:18", "url": "https://files.pythonhosted.org/packages/38/d1/bc58e7dc4f98457593b90f1e6b04b0a1f58875a47a4ce0da29714c4b9b52/vim_bridge-0.5.tar.gz" } ] }