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

87919Re: Re (OOPS): Unable to get syntax highlighting to work for root account

Expand Messages
  • YGirouard
    Feb 29, 2008
    • 0 Attachment
      Ok, I fixed it... all I had to do was to add an alias for vi pointing to
      /usr/bin/vim in my /root/.bashrc file. Root was using /bin/vi which is the
      Small version, while other accounts were aliasing vi as vim, which is why it
      was working... I was also able to get syntax to work as root by using just
      "vim filename" instead of vi... Silly me... Thanks for pointing me in the
      right direction Tony! :)

      YGirouard wrote:
      > I think I found the issue, but I don't know how to fix it...
      > Looks like the root account is not using the same package of VI the other
      > accounts are using... This is what I get when I type vi --version as my
      > own account: (notice the +syntax instead of -syntax, and the Huge version
      > instead of Small...). How can I fix this for root???
      > VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 9 2008 08:28:18)
      > Included patches: 1-211
      > Modified by <bugzilla@...>
      > Compiled by <bugzilla@...>
      > Huge version without GUI. Features included (+) or not (-):
      > +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset
      > +cindent
      > -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info
      > +comments
      > +cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
      > +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
      > +find_in_path
      > +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
      > +jumplist
      > +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
      > +menu
      > +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm
      > -mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang
      > -mzscheme
      > -netbeans_intg -osfiletype +path_extra +perl +postscript +printer +profile
      > +python +quickfix +reltime +rightleft -ruby +scrollbind +signs
      > +smartindent
      > -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
      > -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar
      > +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
      > +vreplace
      > +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
      > -xterm_clipboard -xterm_save
      > system vimrc file: "/etc/vimrc"
      > user vimrc file: "$HOME/.vimrc"
      > user exrc file: "$HOME/.exrc"
      > fall-back for $VIM: "/usr/share/vim"
      > Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall
      > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
      > --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
      > -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
      > -D_FORTIFY_SOURCE=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/local/include
      > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm
      > -I/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE
      > -I/usr/include/python2.5 -pthread
      > Linking: gcc -Wl,-E
      > -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE
      > -L/usr/local/lib -o vim -lselinux -lncurses -lacl -lgpm -Wl,-E
      > -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE
      > -L/usr/local/lib
      > /usr/lib/perl5/5.8.8/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a
      > -L/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE -lperl -lresolv -lutil
      > -lc -L/usr/lib/python2.5/config -lpython2.5 -lutil -lm -Xlinker
      > -export-dynamic
      > YGirouard wrote:
      >> Thanks Tony,
      >> Not sure it applies to my issue though, as it's doing it for every
      >> filetype (conf files, php files, perl, etc). As for the additional
      >> details you asked, it was partially in the "Additional Info" section of
      >> my post but here goes anyway... let me know if that helps:
      >> I'm using Linux RedHat Fedora Core 7 on a virtual dedicated server. I
      >> only have shell access (no gui).
      >> The version output of vi echoes this (I put the whole thing anyway in
      >> case...):
      >> VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 9 2008 08:28:40)
      >> Included patches: 1-211
      >> Modified by <bugzilla@...>
      >> Compiled by <bugzilla@...>
      >> Small version without GUI. Features included (+) or not (-):
      >> -arabic -autocmd -balloon_eval -browse +builtin_terms -byte_offset
      >> -cindent -clientserver -clipboard -cmdline_compl +cmdline_hist
      >> -cmdline_info -comments
      >> -cryptv -cscope -cursorshape -dialog -diff -digraphs -dnd -ebcdic
      >> -emacs_tags -eval -ex_extra -extra_search -farsi -file_in_path
      >> -find_in_path -folding
      >> -footer +fork() -gettext -hangul_input +iconv -insert_expand +jumplist
      >> -keymap -langmap -libcall -linebreak -lispindent -listcmds -localmap
      >> -menu -mksession
      >> -modify_fname -mouse -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm
      >> -mouse_xterm +multi_byte -multi_lang -mzscheme -netbeans_intg -osfiletype
      >> -path_extra -perl -printer -profile -python -quickfix -reltime -rightleft
      >> -ruby -scrollbind -signs -smartindent -sniff -statusline -sun_workshop
      >> -syntax
      >> -tag_binary -tag_old_static -tag_any_white -tcl +terminfo -termresponse
      >> -textobjects -title -toolbar -user_commands -vertsplit -virtualedit
      >> +visual
      >> -visualextra -viminfo -vreplace +wildignore -wildmenu +windows
      >> +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
      >> system vimrc file: "/etc/virc"
      >> user vimrc file: "$HOME/.vimrc"
      >> user exrc file: "$HOME/.exrc"
      >> fall-back for $VIM: "/usr/share/vim"
      >> Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall
      >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
      >> --param=ssp-buffer-size=4 -m32 -
      >> march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE
      >> Linking: gcc -L/usr/local/lib -o vim -lselinux -lncurses -lacl
      >> Tony Mechelynck-2 wrote:
      >>> Tony Mechelynck wrote:
      >>>> 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
      >>> Oops! http://ftp.vim.org/pub/vim/patches/7.0/README
      >>>> 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.
      >>> >>>

      View this message in context: http://www.nabble.com/Unable-to-get-syntax-highlighting-to-work-for-root-account-tp15767467p15773080.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