{ "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 :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Text Editors" ], "description": "====================================\nvim_bridge3 - a Python-to-Vim bridge\n====================================\n\nPython 3 port of the *original for Python 2:* ``_\n\n\nWhat is it?\n-----------\n\n*vim_bridge3* is a Python-to-Vim bridge decorator that allows transparent calls\nto Python functions in native Vim scripts.\n\n\nInstallation\n------------\n\nInstall the `vim_bridge3`_ Python package, using setuptools,\n``easy_install``, or ``pip``.\n\n\n.. _`vim_bridge3`: http://pypi.python.org/pypi/vim_bridge3/\n\n\nUsage\n-----\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 python3 << 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---------\n\nThe following data types have proven to work:\n\n* Strings\n* Integers\n* Lists\n* Exceptions\n\n\nMore examples\n-------------\n\nPassing in a list::\n\n python3 << 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 python3 << 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\nUsing Python stdlib functions to do work that would be more difficult\nusing pure Vim scripting::\n\n python3 << endpython\n import os.path\n from vim_bridge import bridged\n\n @bridged\n def NormalizePath(path):\n return os.path.realpath(path)\n endpython\n\n echo NormalizePath(\"/this/../or/./.././that/is/./a/.//very/../obscure/..//././long/./../path/name\")\n echo NormalizePath(\"..\")\n\nYou can use the bridged function definitions within a Python block\nitself, or from inside Vim, it does not matter. In this example,\nNormalizePath is called from both Python and Vim::\n\n python3 << endpython\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 endpython\n\n \" ...or from here\n echo NormalizePath(\"/this/../or/./.././that/is/./a/.//very/../obscure/..//././long/./../path/name\")\n echo RealPath(\"..\")\n\nSince vim_bridge 0.4, the function name casing convention is\nautomatically converted to match Vim's conventions (and *requirement*\neven, since function names **must** start with a capital letter).\nBesides casing, prefixing the Python function with an underscore will\nlead to the function being defined in the Vim context as a\n````-prefixed function (i.e. a \"private\" function that cannot be\ncalled from outside the script)::\n\n python3 << endpython\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 endpython\n\n echo Public()\n echo s:Private()\n echo MyNameIsAutoConverted()\n echo s:LongPrivateName()\n\n\nChanges\n-------\n\n- Original code by Vincent Driessen (@nvie) in 2010. BSD License.\n- Support for Python2 and Python3 by Roland Puntaier (@rpuntaie) in 2016.\n- Support for Python3 by Walter Doekes (@wdoekes) in 2017.\n- vim_bridge3 for pypi by Roland Puntaier (@rpuntaie) in 2018.\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/rpuntaie/vim_bridge", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "vim-bridge3", "package_url": "https://pypi.org/project/vim-bridge3/", "platform": "any", "project_url": "https://pypi.org/project/vim-bridge3/", "project_urls": { "Homepage": "http://github.com/rpuntaie/vim_bridge" }, "release_url": "https://pypi.org/project/vim-bridge3/0.6/", "requires_dist": null, "requires_python": "", "summary": "A Python3-to-Vim bridge decorator that allows transparent calls to Python 3 functions in native Vim scripts.", "version": "0.6" }, "last_serial": 3561691, "releases": { "0.6": [ { "comment_text": "", "digests": { "md5": "d8632f3776ecd106c2c0409d48fdff8a", "sha256": "7fe470eecb8f04ad08749c33a40d855fd60825cf24a1176a160c9914ad98b2a2" }, "downloads": -1, "filename": "vim_bridge3-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "d8632f3776ecd106c2c0409d48fdff8a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6540, "upload_time": "2018-02-07T20:53:51", "url": "https://files.pythonhosted.org/packages/4d/81/6c32e8ca86c85ac65a98741461e6510664f2bf8e2a8031852e3dddb82121/vim_bridge3-0.6-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d8632f3776ecd106c2c0409d48fdff8a", "sha256": "7fe470eecb8f04ad08749c33a40d855fd60825cf24a1176a160c9914ad98b2a2" }, "downloads": -1, "filename": "vim_bridge3-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "d8632f3776ecd106c2c0409d48fdff8a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6540, "upload_time": "2018-02-07T20:53:51", "url": "https://files.pythonhosted.org/packages/4d/81/6c32e8ca86c85ac65a98741461e6510664f2bf8e2a8031852e3dddb82121/vim_bridge3-0.6-py3-none-any.whl" } ] }