Loading ...
Sorry, an error occurred while loading the content.

87914Re: Unable to get syntax highlighting to work for root account

Expand Messages
  • Tony Mechelynck
    Feb 29, 2008
    • 0 Attachment
      YGirouard wrote:
      >
      > Problem description: Whenever I switch to the root account using "su - root",
      > the syntax highlighting in vi stops working. It works fine when I'm using my
      > own account since I added "syntax on" in the file ~/.vimrc, but I tried
      > adding the same file to the /root directory and it's not doing anything for
      > root. I also tried typing the "syntax on" in vi after launching it as root,
      > and nothing happens.
      [...]

      Is it for every filetype (including c, html, etc.) or only for some of them
      (such as help, which is set by a modeline)?

      Modelines are intentionally disabled for the root account starting at
      patchlevel 7.0.237 (see http://ftp.vim.org/pub/vim/patches/README and search
      for 7.0.237). This is how I enable them even for root:

      if exists("+modelines")
      " the following is required because of SuSE's paranoid /etc/vimrc
      " and to force 'modeline' on even for root in Vim 7.0.237 and later
      set modeline modelines=5
      " the following disables a dangerous modeline in one helpfile
      if has ('autocmd')
      au BufReadPost ada.txt setl nomodeline ft=help
      endif
      endif

      Beware that obnoxious modelines have been spotted time and again. The most
      dangerous options are disabled in them, but maybe some dangerous ones have
      been mistakenly allowed: if you enable them for the superuser, you're on your
      own. You may get no problems at all, but if bugs bite you, don't say you
      weren't warned.

      Also: Since you mention root and su, I assume you're on a Unix-like OS, but
      which one? (if Linux, which distro?) And what Vim/gvim version are you using?
      Please paste the first few files of the output of ":version". Only up to
      "Features included (+) or not (-)" ought to be enough.


      Best regards,
      Tony.
      --
      Pig, n.:
      An animal (Porcus omnivorous) closely allied to the human race
      by the splendor and vivacity of its appetite, which, however, is
      inferior in scope, for it balks at pig.
      -- Ambrose Bierce, "The Devil's Dictionary"

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 9 messages in this topic