Operating System - HP-UX
1823975 Members
3869 Online
109667 Solutions
New Discussion юеВ

Cut-and-paste and indents in "vi"

 
SOLVED
Go to solution
Ian Dennison_1
Honored Contributor

Cut-and-paste and indents in "vi"

Had a query from a DBA about why his cut and paste of a .sql script from one vi screen to another put so many indents in the new file.

I figured the short cut around this (tried as a different user ie. root) but cannot find the config items for vi formatting to correct this.

Can anyone provide a hint? Can I buy a vowel? Share and Enjoy! Ian
Building a dumber user
3 REPLIES 3
Peter Nikitka
Honored Contributor

Re: Cut-and-paste and indents in "vi"

Hi Ian,

there are many ways to put the content of one file into another via 'vi'.
- include the content of a file (:r otherfile)
- include the output of a command; non-empty lines e.g. :r!awk NF otherfile

Or remove trailing spaces after a paste
:%s/^ *//

Else SQL-output can be formatted in many many ways...

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Andrew Merritt_2
Honored Contributor
Solution

Re: Cut-and-paste and indents in "vi"

Hi Ian,
I would guess that he has the autoindent feature enabled. From within vi, you turn this off with:

:se noai

It is set in the .exrc file as

set autoindent

It's documented under 'man ex'.

Andrew
Ian Dennison_1
Honored Contributor

Re: Cut-and-paste and indents in "vi"

Andrew,

Magic answer, thanks for that. Problem solved.

Share and Enjoy! Ian
Building a dumber user