Skip to content

Instantly share code, notes, and snippets.

@janosgyerik
Last active December 17, 2015 17:09
Show Gist options
  • Save janosgyerik/5644016 to your computer and use it in GitHub Desktop.
Save janosgyerik/5644016 to your computer and use it in GitHub Desktop.
Collecting ideas for a presentation about how awesome is Vim

Cool things other editors can't do or not easily, but easy in vim.

Create a macro to replace all occurences of:

{% url package.module.method %}

with:

{% url 'package.module.method' %}

Create a macro to replace all occurences of:

<a href="/media/some/image.png">

with:

<a href="{% static '/media/some/image.png' %}">

Consider that you likely have to do these in multiple files.

Transform a long list of lines like this:

pos.setName(fields[0].toUpperCase());
pos.setAnother(fields[1]);
pos.setCamelCase(parseDate(fields[2]));

to:

private static final String NAME = 0;
private static final String ANOTHER = 1;
private static final String CAMEL_CASE = 2;

Macro:

0:€ku^Mcf_private static final String ^[gUeewcf[ = ^[wwC;^[^M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment