2

Follow below tips Copy text from one tmux pane to another (using vim) Seems all the heading tab will be replaced by space during copy-paste, I want to know is any tips to keep all the heading tab.

1 Answers1

0

Vim will output tabs as a sequence of spaces, so the terminal (or tmux in this case) will never see that this was originally a tab.

Part of the reasons for that are that you can configure arbitrary tab stops in Vim, different than 8 spaces. Also, you can have the text scroll horizontally, when not wrapping text. You can also have a column on the left gutter (such as line numbers) shifting text by a number of characters that's typically not a multiple of 8. So the easiest way for Vim to implement a flexible approach that will work in all these cases is to do all the processing of tab stops internally and always use just spaces when writing to the terminal.

If you yank from output of a command like cat, you should get the actual tab characters.

Other options are to open both files in Vim (use Vim splits rather than tmux panes), or use Vim support for the system clipboard (assuming it was built with the +clipboard feature), in which case you can use a Visual mode selection in Vim to write to the system clipboard using the "* and/or "+ registers.

filbranden
  • 21,751
  • 4
  • 63
  • 86