1

I recently launched a RHEL instance on an EC2 container.

I got the apache web server to launch, now I'm trying to write some html in /var/www/html to get my website going. I open index.html in vi , write my code, save it and it doesn't work. The text is all there but it looks similar to a regular .txt file, no color, no syntax hilighting.

I've tried to even rewrite the html file on my computer and scp the file to /var/www/html and still no results.

Hopefully its an easy fix, I'm new to all this so any help would be appreciated!

  • Do you mean show colors in the HTML source when you open it in Vim? Do you mean syntax highlighting? That's what isn't working on your ec2 container? If that's the case, what's the Linux distribution in your container? What does vim --version (or vi --version) return? – filbranden Feb 28 at 4:35
  • 2
    you most likely only got a tiny vi, If you need a fully featured vim, install the vim package. – Christian Brabandt Feb 28 at 8:20
  • 1
    @filbranden it returned that i had the small vi. To answer your other questions yes the only thing that wasnt working was syntax highlighting. The container is running rhel8. – esal Feb 28 at 17:09
  • 1
    @ChristianBrabandt Since I figured out i had small vi I just installed the vim package. Instantly solved my problem. Thank you! – esal Feb 28 at 17:10
  • 1
    @esal Please post an answer. It's fine to answer your own question. If you have the time, also edit your question (to make it clear syntax highlighting was what was missing) and include the output of vim --version before the fix. Thanks! – filbranden Feb 28 at 18:09
0

Have you tried ':syntax on'? If this works for you, add it to your ~/.vimrc so you don't have to do it manually each time.

Here is a reference page with more details if needed:

https://www.tecmint.com/enable-syntax-highlighting-in-vi-editor/

| improve this answer | |
2

As mentioned by Christian Brabandt, the OP has small vim. The solution is to install the vim package.

One can usually tell the difference with vim --version.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.