On 16/02/10 8:39 AM, Ken Bloom wrote:
On Thu, 11 Feb 2010 12:42:48 -0500, Matt Wozniski wrote:

For one-time printings, other option (to avoid creation garbage files)
is to select desired columns with visual mode (using CTRL-v) and then
filter with your ferred printing utility with '!' command (for example
'!lpr'.

That won't work.  Try it with !cat - it will use the entire line, not
just the visually selected portion.

No, it will use the whole line, including highlighted but invisible
parts of lines, and in fact, even if you use a characterwise or
blockwise selection, unless you make use of Dr. Chip's VisVim plugin (I
think), it will use even the whole lines which are partially
highlighted, because Ex (colon) commands always work on whole lines.

Lpr may shorten lines, but that's nothing to do with Vim's visual
selection; passing appropriate options to lpr will make it wrap lines or
extend them across pages or whatever, I expect.

This will replace the selection with the output of the called comand,
but you can revert inmediately by undo with 'u'.

You can avoid the text being removed by using ':w !lpr' instead of just
'!lpr'. If you have a visual selection, it will look like

:'<,'>w !lpr

when you type it. The '<,'> means 'from the first line to the last line
of the visually selected area'. This simplistic method of restricting
the command to the visual area is why it always includes whole lines
even if you don't want it to.

Ben.




--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to