Skip to main content

A tool for converting code snippets from Ultisnips to YASnippet format

Project description

Ultyas - UltiSnips to YASnippet Conversion Tool

License

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) 2023-2024 James Cherti

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

Links

Other Emacs packages by the same author:

  • minimal-emacs.d: This repository hosts a minimal Emacs configuration designed to serve as a foundation for your vanilla Emacs setup and provide a solid base for an enhanced Emacs experience.
  • vim-tab-bar.el: Make the Emacs tab-bar Look Like Vim’s Tab Bar.
  • outline-indent.el: An Emacs package that provides a minor mode that enables code folding and outlining based on indentation levels for various indentation-based text files, such as YAML, Python, and other indented text files.
  • easysession.el: Easysession is lightweight Emacs session manager that can persist and restore file editing buffers, indirect buffers/clones, Dired buffers, the tab-bar, and the Emacs frames (with or without the Emacs frames size, width, and height).
  • elispcomp: A command line tool that allows compiling Elisp code directly from the terminal or from a shell script. It facilitates the generation of optimized .elc (byte-compiled) and .eln (native-compiled) files.
  • tomorrow-night-deepblue-theme.el: The Tomorrow Night Deepblue Emacs theme is a beautiful deep blue variant of the Tomorrow Night theme, which is renowned for its elegant color palette that is pleasing to the eyes. It features a deep blue background color that creates a calming atmosphere. The theme is also a great choice for those who miss the blue themes that were trendy a few years ago.
  • dir-config.el: Automatically find and evaluate .dir-config.el Elisp files to configure directory-specific settings.

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.9.tar.gz (20.2 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.9-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ultyas-1.0.9.tar.gz
Algorithm Hash digest
SHA256 cb8831772da9a6af87cf64850f2b7a1f1bbc9bf5cf82cea323ccf84e39448672
MD5 9deecd37131daf8b63434070d2c78d33
BLAKE2b-256 4f0fabcd275cfd297a82b2fbc0609552304cacb076d06cf669cbee94a84c957c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ultyas-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b414074d8a4cfc21be7b1783e5c95cbe54c7bf58132d6c9fc9d05ca841de092c
MD5 ee19d9658b472527c4ffc0bdcaffd365
BLAKE2b-256 9819e8926fa375edd1ae51fc482368323e0a21dcedac428c8d5cc7c94364d6b2

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