Skip to content

Instantly share code, notes, and snippets.

View benknoble's full-sized avatar
💚
reproductive rights are human rights

D. Ben Knoble benknoble

💚
reproductive rights are human rights
View GitHub Profile
@benknoble
benknoble / Vim_autoreply.md
Last active November 23, 2022 17:41 — forked from g0xA52A2A/Vim_autoreply.md
Vim autoreply

A modified version of George's gist which I recommend checking out.

A modified version of Romain's gist which I recomend checking out.

Instead we pull the last line from the command history with ~~~histget()~~~ getcmdline() and use fullcommand() to get the command name. This gives us the proper command name which we can match against literally.

Also rather than always having to return a carriage return and whatever else in an expression I've opted to use an autocmd.

This also fixes what could be considered a minor bug at the time of writting in the original the dlist and ilist mapping. The pattern may have spaces so rather than increment the cursor backwards move it to the start then increment it forwards to the correct destination.