VI and VIM Syntax Highlighting on Fedora / CentOS / Red Hat (RHEL) - Comment Page: 1

This is guide, howto enable Vi and Vim text editor syntax Highlighting on Fedora / CentOS / Red Hat (RHEL). Actually on Fedora, CentOS and Red Hat (RHEL) does only have Vim (Vi IMproved), but if you run vi command it works, because it runs small/minimal version of Vim, which is like original Vi. I have seen too many guides howto enable Vi/Vim syntax highlighting, which says that you can turn syntax highlighting on/off with using :syntax on and :syntax off. It's almost true, but actually on Fedora, CentOS and RHEL you can't turn Vi syntax highlighting on with any command, because Vi (Vim minimal) does not have syntax highlighting feature included. If you run following command: vi...

27 comments on “VI and VIM Syntax Highlighting on Fedora / CentOS / Red Hat (RHEL) - Comment Page: 1

1 2
    1. Thanks JR!

      This is really awesome guide!
      I really appreciate it that you can explain these things. :)

      Reply
    2. Thank’s Bro….. !!!

      You are safe my life from colour blindness :)

      Reply
    3. the syntax in ~./bashrc would be
      alias vi=’vim’

      Reply
      • Hi akshay,

        Both works, because it’s just single command (without any parameters).

        Reply
    4. Great tip!
      Do you know how to get auto-indenting working in vi/vim on Fedora 16?

      Reply
    5. Why in fedora?I think this way can work for all Linux !

      Reply
      • Hi seatle,

        Yes, it works on any distro, but step 2 is just Fedora/RHEL/CentOS specific.

        Reply
    6. Oh,I see,the default version is small version for fedora,But Huge version is default for Ubuntu.

      Reply
      • Yes, it’s biggest reason why this guide exists. ;)

        Reply
    7. thank you
      thank you
      thank you

      Reply
    8. Frustration averted, thanks!

      Reply
    9. I am able to change the colorscheme of vi and i can see the highlighting on, but its just on for the comments of my coding and not like your picture where everything is assigned a different color. I uninstalled it and reinstalled it and nothing is there anything missing here?? I am using Fedora 19 Desktop any advice would be great thanks.

      Reply
      • Hi Ricardo,

        I just checked and here is used VIM default color scheme and Gnome-Terminal with Built-in schemes: Gray on black (or White in black) and Gnome-Terminal Palette is Tango.

        Personally I use VIM Solarized dark theme, but you can of course select your favorite color scheme.

        Reply
    10. Awesome.

      JR would you know why the /etc/virc file still exists in addition to /etc/vimrc, highlighting works everywhere(so far) except when I view /etc/virc file?

      Thanks

      Reply
      • Hi miguel,

        Thanks!

        I think that there is not highlighting file for virc, but you could use vimrc highlighting files. Add following line to your .vimrc to enable .virc/virc highlighting:

        
        au BufRead,BufNewFile .virc,virc set filetype=vim
        
        Reply
      • > view

        I always wondered why `vi` had an alias in /etc/profile.d/vim.sh but not `view`

        I just add

        $ vi .bashrc
        alias view=’vi -R’

        But I have to keep doing it every new system.

        Mike
        mrdvt92

        Reply
    11. Thanks, each time I reinstall the server I forget how to do those simple steps.

      Reply
1 2

Leave a Reply to kyo Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close