vimmacrosbufferfiglet

vim macro to convert current line to figlet


I wrote a macro to test calling it on a line to convert it to figlet (text ascii-art version)

I tryied working around something like

let @q='"add:r! figlet <c-r>a^M'

or

let @q='"add:r! figlet ^Ra^M'

and so on from the :help macro recommandations

I just can't find the good syntax for it

when I run it manually in session it works so I guess the issue is syntax only

a
toto
<esc>
qq
"add
:r! figlet ^Ra^M
q
k
@q

then got

| |_ ___ | |_ ___                                                                                                                                                                                                                             
| __/ _ \| __/ _ \                                                                                                                                                                                                                            
| || (_) | || (_) |                                                                                                                                                                                                                           
 \__\___/ \__\___/

this is the similar result I need to write as a macro


Solution

  • Your macro is way too complicated.

    Instead of all that deleting and inserting dance, you should use :help :range! directly to filter the current line:

    :.!figlet<CR>
    

    figlet

    which simplifies your macro tremendously:

    :let @q = ":.!figlet\<CR>"