Troy Piggins wrote:
[...]
Filter looks promising.  If you have figlet on your system, how do
you use it?  Do you ever use it within vim?  Do you have keys
mapped, or scripts?
[...]

You can replace a range of lines by its figlet representation: Here are a few examples:

        <Visual>!figlet
or
        <Visual>:!figlet
which appears as
        :'<,'>!figlet
                replace the (linewise) Visual selection

        :.,.+5!figlet
or
        6!!figlet
                replace the current line and the 6 lines following it

        :%!figlet
                replace the whole editfile

        :1,3!figlet
                replace the first three lines in the editfile

        :/\<begin\>/+1;/\<end\>/-1!figlet
from the line after next line containing the word "begin" (after the cursor) until, but not including, the first line with the word "end" following it

see
        :help filter
        :help [range]


In all the above examples, add after "!figlet" any command-line parameters required by the figlet command (which takes its input on stdin and writes its output to stdout, Vim takes care of that).

For instance, after typing the following 4 lines in an empty buffer:

Mary had a little lamb,
Its fleece was white as snow,
And everywhere that Mary went,
The lamb was sure to go.

followed by <Esc> (to go back to Normal mode) and ":1,2!figlet" (without the quotes) you'll see that the edit buffer now contains (best viewed in a fixed font):

 __  __                    _               _           _ _ _   _   _
|  \/  | __ _ _ __ _   _  | |__   __ _  __| |   __ _  | (_) |_| |_| | ___
| |\/| |/ _` | '__| | | | | '_ \ / _` |/ _` |  / _` | | | | __| __| |/ _ \
| |  | | (_| | |  | |_| | | | | | (_| | (_| | | (_| | | | | |_| |_| |  __/
|_|  |_|\__,_|_|   \__, | |_| |_|\__,_|\__,_|  \__,_| |_|_|\__|\__|_|\___|
                   |___/
 _                 _
| | __ _ _ __ ___ | |__
| |/ _` | '_ ` _ \| '_ \
| | (_| | | | | | | |_) |
|_|\__,_|_| |_| |_|_.__( )
                       |/
 ___ _          __ _
|_ _| |_ ___   / _| | ___  ___  ___ ___  __      ____ _ ___
 | || __/ __| | |_| |/ _ \/ _ \/ __/ _ \ \ \ /\ / / _` / __|
 | || |_\__ \ |  _| |  __/  __/ (_|  __/  \ V  V / (_| \__ \
|___|\__|___/ |_| |_|\___|\___|\___\___|   \_/\_/ \__,_|___/

          _     _ _
__      _| |__ (_) |_ ___    __ _ ___   ___ _ __   _____      __
\ \ /\ / / '_ \| | __/ _ \  / _` / __| / __| '_ \ / _ \ \ /\ / /
 \ V  V /| | | | | ||  __/ | (_| \__ \ \__ \ | | | (_) \ V  V /
  \_/\_/ |_| |_|_|\__\___|  \__,_|___/ |___/_| |_|\___/ \_/\_( )
                                                             |/
And everywhere that Mary went,
The lamb was sure to go.



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
211. Your husband leaves you...taking the computer with him and you
     call him crying, and beg him to bring the computer back.

Reply via email to