Vim multiple chain commands, first one uses range

vim

Solution

Using `execute` is the way to go, but you only have to quote the command for `:execute`, not the second one.

That is, replace:

:execute "'<,'>TOhtml" | "wq! ~/mylink"

With this:

:execute "'<,'>TOhtml" | wq! ~/mylink

Problem

Some Vim functions work on a range: ``` :'<,'>TOhtml ``` What is the syntax for the first command taking a range, and the latter commands pipe the result? In the comments on the wiki it suggests a plugin to allow the range to be run on by all the commands; but here I only need the first argument to handle the range. ``` # These are the commands I am attempting to chain :'<,'>TOhtml :w! ~/mylink :q! # The last two can chain or be one command :w! ~/mylink | q! :wq! ~/mylink # But these fail :'<,'>TOhtml | wq! ~/mylink :execute "'<,'>TOhtml" | "wq! ~/mylink" ```

Original source