Friday, March 28, 2014

Re: expand tab when copying into x

On 2014-03-28 07:29, shawn wilson wrote:
> Generally when I copy something with hard tabs (a makefile right
> now) into X ("+y) I actually want soft tabs even if I don't have
> expandtab set for the file. But, if I paste into a console (IRC for
> instance) it tries to do an autocomplete. Is there a way to expand
> tabs for just this type of copy? Ie, I wouldn't want this
> functionality for yanks into other buffers.

You could write a mapping that expands tabs on the clipboard buffer,
something like

:nnoremap <f4> :let @+=substitute(@+,'\t',repeat(' ', &ts),'g')<cr>

So you'd copy your tabified text to the clipboard, then hit <f4> and
it would be re-copied to the clipboard with the tabs expanded.

-tim




--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment