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

87913Unable to get syntax highlighting to work for root account

Expand Messages
  • YGirouard
    Feb 29, 2008
    • 0 Attachment
      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.

      The command "echo $TERM" returns "xterm" as both root and my own account.

      I also tried to force "syntax on" in /etc/vimrc (adding it at the end,
      outside the IF block that usually sets it), and it does nothing. I compared
      the environment variables for both users (my own and root) and I can't see
      anything that would cause this...

      I restarted my server and still doesn't work... I'm out of things to look at
      and google isn't much of a friend this time... I managed to find ONE post
      from someone with the same problem, but nobody was able to provide him with
      a working solution...

      Additional info:
      SSH Client: Putty (in Windows Xp Pro)
      OS: Fedora Core 7
      VIM Packages installed (obtained using command: yum list installed vim*):

      vim-common.i386, 2:7.1.211-1.fc7, installed
      vim-enhanced.i386, 2:7.1.211-1.fc7, installed
      vim-minimal.i386, 2:7.1.211-1.fc7, installed

      Content of my /etc/vimrc file (the BEGIN and END lines are not part of the
      if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
      set fileencodings=utf-8,latin1

      set nocompatible " Use Vim defaults (much better!)
      set bs=indent,eol,start " allow backspacing over everything in
      insert mode
      "set ai " always set autoindenting on
      "set backup " keep a backup file
      set viminfo='20,\"50 " read/write a .viminfo file, don't store more
      " than 50 lines of registers
      set history=50 " keep 50 lines of command line history
      set ruler " show the cursor position all the time

      " Only do this part when compiled with support for autocommands
      if has("autocmd")
      " In text files, always limit the width of text to 78 characters
      autocmd BufRead *.txt set tw=78
      " When editing a file, always jump to the last cursor position
      autocmd BufReadPost *
      \ if line("'\"") > 0 && line ("'\"") <= line("$") |
      \ exe "normal! g'\"" |
      \ endif

      if has("cscope") && filereadable("/usr/bin/cscope")
      set csprg=/usr/bin/cscope
      set csto=0
      set cst
      set nocsverb
      " add any database in current directory
      if filereadable("cscope.out")
      cs add cscope.out
      " else add database pointed to by environment
      elseif $CSCOPE_DB != ""
      cs add $CSCOPE_DB
      set csverb

      " Switch syntax highlighting on, when the terminal has colors
      " Also switch on highlighting the last used search pattern.
      if &t_Co > 2 || has("gui_running")
      syntax on
      set hlsearch

      filetype plugin on

      if &term=="xterm"
      set t_Co=8
      set t_Sb=^[[4%dm
      set t_Sf=^[[3%dm

      " Don't wake up system with blinking cursor:
      " http://www.linuxpowertop.org/known.php
      let &guicursor = &guicursor . ",a:blinkon0"

      Please help... I miss the pretty colors when I'm root *sniff*

      View this message in context: http://www.nabble.com/Unable-to-get-syntax-highlighting-to-work-for-root-account-tp15767467p15767467.html
      Sent from the Vim - General mailing list archive at Nabble.com.

      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