1752727 Members
6029 Online
108789 Solutions
New Discussion юеВ

Re: vi tab/space

 
SOLVED
Go to solution
Tonatiuh
Super Advisor

vi tab/space

HP-UX
vi Editor

I view a text file and I copy some text lines.

Then I vi other file and try to paste the copied text lines. But it includes some tabs or spaces at the beginning of each line and the structure is TOTALLY altered. This does not happen with linux vi (just to mention another case).

how can I avoid the inclusion of this tabs/spaces at the beginning of each copied line?
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: vi tab/space

Hi:

I suspect that your copy buffer has the leading whitespace because of how you created the it. In the absence of specific details of how and from where you copy-and-paste (e.g. from a Windows PC?) it is difficult to answer.

Regards!

...JRF...
River Tarnell
Advisor

Re: vi tab/space

It's possible your vi is running in 'autoindent' mode, which will automatically intent new lines to match the previous line. This is very useful for interactive editing, but causes problems for copy+paste.

Before pasting, try running this in the destination vi: ":set noai" (without the quotes).

autoindent seems to be the default on HP-UX vi. Linux doesn't have a standard 'vi', but on most of them, 'ai' is not the default.

BTW, if you want to read an entire file into vi, you don't need to use copy/paste, you can simply use ":r /path/to/file". This also avoids other copy+paste issues, like tabs being converted to spaces.
Tonatiuh
Super Advisor

Re: vi tab/space

BINGO River!

The ":set noai" solved my problem.

THANK YOU!