LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Vi alternatives (https://www.linuxquestions.org/questions/linux-general-1/vi-alternatives-359902/)

Gins 09-03-2005 02:58 PM

Vi alternatives
 
If you write a letter or a few words using 'vi' editor , it will be written or rather save as a ANSI text.

When you press :wq at the end of your letter, it will save.

My question is whether it is possible to save in other formats. I would like to save as a HTML file.

F0ul_Olli 09-03-2005 03:12 PM

If you write your html source in VI and then save it as file.html, its then saved in that format.

e.g.
"<title>your document </title>"
"<body> This is what I want on my page etc </body>"

If on the otherhand, you are trying to write a document and then save it preformatted in html you should use something else like Openoffice or Abiword.

Have I understood your question properly?

Gins 09-03-2005 03:42 PM

Thanks F0UI

I meant to write some html tags.
If I wrote the following tags and saved, it will save as ANSI document. If I can save as .htm document, for example '' testing.htm or testing.html '', I could open it on my browser.

Is it possible to save as html document?




<html>
<head>
<title>My homepage</title>
</head>
<body>
Hello everybody. Welcome to my homepage.
</body>
</html>

Komakino 09-03-2005 03:46 PM

Quote:

Originally posted by Gins
Thanks F0UI

I meant to write some html tags.
If I wrote the following tags and saved, it will save as ANSI document. If I can save as .htm document, for example '' testing.htm or testing.html '', I could open it on my browser.

Is it possible to save as html document?




<html>
<head>
<title>My homepage</title>
</head>
<body>
Hello everybody. Welcome to my homepage.
</body>
</html>

You mean ASCII (American Standard Code for Information Interchange), not ANSI (American National Standards Institute)
Of course you can save it as HTML. HTML IS in ASCII, it just has a .html (or .htm) file extension. You could call it mypage.blah and it would still open in most web browsers! In vi just do
Code:

:w myfile.html
to save it to the file called myfile.html, or better still when you start vi, start it by appending the filename, i.e.:
Code:

vi myfile.html

Gins 09-03-2005 03:51 PM

Oh! great advice Komakino. I will try the way you have suggested.

Gins 09-03-2005 04:07 PM

Komakino

It worked beautifully. I owe you a lot. You are living in Somerset. I would like to pay you 10 pounds. It was a really a great, great , great help.

Is this possible in Emacs too?

Komakino 09-03-2005 04:26 PM

Quote:

Originally posted by Gins
Komakino

It worked beautifully. I owe you a lot. You are living in Somerset. I would like to pay you 10 pounds. It was a really a great, great , great help.

Is this possible in Emacs too?

lol, danke, bitte schön :)

Yes, you can do it in any text editor. HTML is just ASCII text with html tags in it. Any editor that can save in plain text (that is, without word processor formatting) can save an HTML file.

Gins 09-03-2005 04:39 PM

Thanks Komakino

I am sure you have the freeware wordprocessor for Linux and Solaris. It is called 'Open office'
I tried in vain to write those tags in that program.

Does it work there too? I doubt it very much.

In any case, now it is getting late here. I must sleep. I will try more and more tomorrow and come back to you when necessary.

Tomorrow is Sunday. I am free. Only thing I am going to do is training at the gym. Rest of the time I would spend on this.

I profoundly appreciate all the help. As I said before I don't mind paying 10 pounds for the help.

Komakino 09-03-2005 04:43 PM

Quote:

Originally posted by Gins
Thanks Komakino

I am sure you have the freeware wordprocessor for Linux and Solaris. It is called 'Open office'
I tried in vain to write those tags in that program.

Does it work there too? I doubt it very much.

In any case, now it is getting late here. I must sleep. I will try more and more tomorrow and come back to you when necessary.

Tomorrow is Sunday. I am free. Only thing I am going to do is training at the gym. Rest of the time I would spend on this.

I profoundly appreciate all the help. As I said before I don't mind paying 10 pounds for the help.

It is possible to write html in Openoffice and save it as plain text. When you save the file choose "Text (txt)" as the file type and uncheck the box that says "Automatic file name extension". Then call your file something like index.html and it should all be fine.

And of course I'm flattered that you think my advice is worth paying for but as with everything linux it's experimental but free :D

jayemef 09-05-2005 10:29 AM

Don't forget also that you can specify the file extension when opening the file, even if it doesn't exist. So if you wanted to create a new HTML file in Vi, you could simply do
Code:

$ vi index.html
and anytime you save the file, it will write to index.html. This notation should work for most, if not all text editors.

On the side, I would NOT recommend writing any form of code, including HTML, in a word processor for several reasons. Firstly, your code won't be readable. This is why forums like this one provide a Code block for people to enter code. It makes the font monowidth, which is important when looking at spacing, indentation, etc. Secondly, word processors won't help you with syntax in any way. Simple editors like Vi(m), Bluefish, etc at least highlight syntax properly, and there are "smarter" ones out there that could be classified as structure editors, which are aware of the proper syntax of whatever language you are working with and will inform you when you have errors.


All times are GMT -5. The time now is 12:40 PM.