{% macro funchighlight(func) -%} {% highlight 'zsh',lineno='table' %} function {{ func.name|quote }} () { {{ func.value|indent(first=True) }} } {% endhighlight %} {% endmacro %} {% macro printalias(alias) -%} {% if alias.type == 'git' %}

git {{ alias.name }}

{% else %}

{{ alias.name }}

{% endif %} {% if alias.description %} {% markdown %}{{ alias.description|safe }}{% endmarkdown %} {% endif %} {% if alias.type == 'git' %} {% highlight 'zsh' %}git config --global {{ ('alias.' + alias.name)|quote }} {{ alias.value|quote }}{% endhighlight %} {% elif alias.type == 'function' %} {% autoescape false %} {{ funchighlight(alias)|replace('\n', '
') }} {% endautoescape %} {% elif alias.type == 'alias' %} {% highlight 'zsh' %}alias {{ alias.name|quote }}={{ alias.value|quote }}{% endhighlight %} {% else %} {% highlight 'zsh' %}{{ alias.value }}{% endhighlight %} {% endif %} {%- endmacro %} {% macro section(title, slug='', description='', aliases=[]) -%}
back to top

{{ title }}

{% if description %} {% markdown %}{{ description|safe }}{% endmarkdown %} {% endif %} {% for alias in aliases|sort(attribute='name') %} {{ printalias(alias) }} {% endfor %}
{%- endmacro %}

the shell spellbook

{{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'alias')|list|length }} aliases, {{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'git')|list|length }} git aliases, {{ data.aliases|selectattr('private', 'eq', False)|selectattr('type', 'eq', 'function')|list|length }} functions
last updated: {{ timestamp }}

This page holds a collection of shell aliases and functions I use regularly. I will soon write a sync script to automatically update my alias collection on every computer I use to turn this into an over-engineered alias management system.

This is generated using jinja2 from a YAML file of mine. Note that some aliases might have a strange escaping because I escape them using Python's shlex module.

contents

{% for tag in data.tags|sort(attribute='name') %} {{ section(tag.name, tag.name|slug, tag.description, data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'eq', tag.name)|list) }} {% endfor %} {% if data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'none')|list|length %} {{ section('uncategorized', '__uncategorized__', '', data.aliases|selectattr('private', 'eq', False)|selectattr('tag', 'none')|list) }} {% endif %}