Monday, December 12, 2011

RE: use of redir => variable

rodinski wrote:
> It works well except it seems to expand horizontal tabs to
> spaces.

The code you posted uses :redir to capture the output of a
command. I imagine that tab characters are converted to spaces
before the command's output is displayed, so the captured output
would have no tabs. In other words, using :redir means certain
special characters in the output will be lost.

For the specific job, here is an alternative:

qaq
:g/\t/y A
:tabe
"ap

Typing qaq is a trick to clear the a register (:help q).

The :g command executes ':y A' on all lines containing a tab
(appending all such lines to register a).

The :tabe creates a new tab and the last command pastes the
contents of the a register.

John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: