Skip to main content

A tool for converting code snippets from Ultisnips to YASnippet format

Project description

Ultyas - UltiSnips to YASnippet Conversion Tool

Ultyas is a command-line tool designed to simplify the process of converting code snippets from UltiSnips (Vim) to YASnippet format (Emacs).

With Ultyas, you can effortlessly migrate your code snippets to the YASnippet format, saving you valuable time and effort.

Installation

Here is how to install Ultyas locally to ~/.local/bin/ultyas using pip:

pip install --user ultyas

Command usage example

To use Ultyas, simply run the command with the appropriate input and output files. Here is a basic example:

~/.local/bin/ultyas ~/.vim/UltiSnips/python.snippets -o ~/.emacs.d/snippets/python-mode/

This command takes an UltiSnips file python.snippets and converts it to a directory that contains YASnippet snippets at ~/.emacs.d/snippets/python-mode/.

Options and flags

usage: ultyas <file.snippets> -o <yasnippet-major-mode-dir>

A command-line tool for converting code snippets from UltiSnips to YASnippet format.

positional arguments:
  ultisnips_file        The UltiSnips .snippets file (e.g. '~/.vim/UltiSnips/python.snippets')

options:
  -h, --help            show this help message and exit
  -o YASNIPPET_DIR, --yasnippet-dir YASNIPPET_DIR
                        The YASnippet snippets major mode directory (e.g. '~/.emacs.d/snippets/python-mode/')
  -i {auto,fixed,nothing}, --yas-indent-line {auto,fixed,nothing}
                        Add one of the following comments to the YASnippet snippets that will be generated: "# expand-env: ((yas-indent-line 'fixed))" or "# expand-env: ((yas-indent-line
                        'auto))". For more information on 'yas-indent-line', visit: https://joaotavora.github.io/yasnippet/snippet-reference.html#yas-indent-line
  -t CONVERT_TABS_TO, --convert-tabs-to CONVERT_TABS_TO
                        Convert the tabs that are in the generated snippets to the string passed to this option (Default: The indentation marker '$>')
  -v, --verbose         Verbose mode
  -q, --quiet           Quiet mode

Example of an UltiSnips snippet that could be converted to Yasnippet

Here is an example of an UltiSnips snippet that can be converted by Ultyas from the UltiSnips format to the Yasnippet format:

priority 50

snippet if
if ${1:True}:
	${2:pass}
endsnippet

snippet for
for ${1:_} in ${2:[]}:
	${3:pass}
endsnippet

snippet while
while ${1:True}:
	${2:pass}
endsnippet

License

Copyright (c) James Cherti

Distributed under terms of the GNU General Public License version 3.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ultyas-1.0.7.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ultyas-1.0.7-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file ultyas-1.0.7.tar.gz.

File metadata

  • Download URL: ultyas-1.0.7.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for ultyas-1.0.7.tar.gz
Algorithm Hash digest
SHA256 ff89613c9abc43143bf28b31f43e3758d65b0e145e468a31f50f36519123e8f8
MD5 0eb4b888eac0a53c2b16bdcb1e8df641
BLAKE2b-256 e5085b7ff21e20071d445cfb2dd9c4dfae84933478f8dddcac2dd3314a9668c8

See more details on using hashes here.

File details

Details for the file ultyas-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: ultyas-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for ultyas-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ab6168a2e33a5dd1001e244af8bdb0b2ccc27ffe8f227eca7ade224fc12a7e68
MD5 baa8f9bc148c9d7a9b3f6cc0d45a8468
BLAKE2b-256 d3eb12f8bf18bd0f9116291a6124e20c0615db0427f3da8f44c17ed51e934b9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page