Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I am useing Red Hat 9. I am trying to edit an XML file with vi. I have one line that wraps to the next line and puts a new line character in automatically. I tried to use a hard return and that does not work either. Anyway, the XML parser pukes when it sees any of these characters. Is there any way to avoid that?
If you want to make it permanent, edit (create) .vimrc and add (edit) the line.
You can also specify (although this may be vim only) a tw associated with a file type:
Something like this (in /etc/vimrc or .vimrc, up to you):
" Set some pre-defined text width's
autocmd BufRead *.txt set tw=78
" shell & programming
autocmd BufRead *.sh,*.bash,*.ksh,*csh,*zsh set tw=256
autocmd BufRead *.awk,*.c,*.cpp,*.perl,*.sed set tw=256
autocmd BufRead *.htm,*.html,*.xml set tw=128
autocmd BufRead *.php,*.css set tw=256
autocmd BufRead *.cf*,*.conf*,*sql set tw=128
In this example .html (.htm) and .xml have a tw of 128 chars.
In this version of vi the only thing I would look out for is "wrapmargin". If it is non-zero that will cause a problem: it will autowrap lines that value prior to the end of the visible line. Your version of vi may have other options that will affect each line.
Otherwise you shouldn't have any newlines inserted that you don't put in. Note that there is a limit to how long the line can be: on my system it is 4095 (plus the newline makes 4096).
I set tw to 128 and verified that when I went to set. I also verified that wrapmargin is set to 0. However, when I edited the file it still wrapped at the end of the line and the xml parser still does not like it.
Originally posted by gschrade I set tw to 128 and verified that when I went to set. I also verified that wrapmargin is set to 0. However, when I edited the file it still wrapped at the end of the line and the xml parser still does not like it.
Setting textwidth to a non-zero value is exactly what you don't want. It will break the line on whitespace to attempt to get a line the length you specified. The wrapmargin setting does essentially the same thing, but bases its linebreak from the width of the screen.
In vi type
to get more info.
You might also check out
which sets a number of settings to "safe" values for pasting text.