LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-08-2005, 01:37 AM   #1
init_linux
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Rep: Reputation: 0
Problem in vi editor


Hello everybody,

I have a strange problem with vi editor. The problem is with syntax highlighting.

When I logged as root, I am unable to get the syntax highlighting in the editor, eventhough after typing the vi command "syntax on". But it is working well, when I am working with non-root user i.e., I am able to see the syntax highlighting.

Because os this, I am unable to edit the conf files with ease. Plz provide me some solution.
 
Old 09-08-2005, 02:13 AM   #2
ag2uki
Member
 
Registered: Oct 2004
Location: Yogyakarta, Indonesia
Distribution: Mandrake 9.0, 9.1, 9.2, 10.0
Posts: 84

Rep: Reputation: 16
look at {$HOME}/.vimrc
Try to find the differences between them.
 
Old 09-08-2005, 02:23 AM   #3
init_linux
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
I dont have .vimrc file in both root and non-root users. I ma using Fedora Core 3.
 
Old 09-08-2005, 03:46 AM   #4
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
If your user has a .vimrc file, and root doesn't, try copying the users .vimrc to /root.

--Ian
 
Old 09-08-2005, 03:56 AM   #5
init_linux
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for the replies...

Neither my user nor the root user contain .vimrc file. I searched the complete Linux File system. I could not find it
I am unable to understand how it is working for my user and not for root, eventhough .vimrc file is not present.
Please help me in this case.
 
Old 09-08-2005, 04:06 AM   #6
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
you mean that
Code:
/etc/vimrc
doesn't exist??
regards,
slackie1000
ps. please, post the output of
Code:
vim --version
 
Old 09-08-2005, 04:16 AM   #7
init_linux
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
I mean the .vimrc at the home folder of root and non-root.

I have /etc/vimrc file

The out put for vim --version is as follows:



Code:
VIM - Vi IMproved 6.3 (2004 June 7, compiled Aug 10 2005 18:30:49)
Included patches: 1-21, 23-24, 26, 28-34, 36-37, 39-40, 42-43, 45-46, 49-51, 54-72, 74-76, 79, 81-82, 85-86
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
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 +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 -netbeans_intg -osfiletype
+path_extra +perl +postscript +printer +python +quickfix +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: i386-redhat-linux-gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -m32 -march=i386 -mtune=pentium4 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2   -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING  -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm  -I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE  -I/usr/include/python2.3 -pthread
Linking: i386-redhat-linux-gcc   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE   -L/usr/local/lib -o vim       -lncurses -lselinux  -lacl -lgpm -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE  -L/usr/local/lib /usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE -lperl -lresolv -lutil -lc -L/usr/lib/python2.3/config -lpython2.3 -lutil -lm -Xlinker -export-dynamic

For reference, I am giving the list of files in my home directory


Code:
[dileep@dileep ~]$ cd $HOME
[dileep@dileep ~]$ ls -ah
.               Desktop                        .gftp              .local          .netscape6               .sversionrc
..              .dmrc                          .gnochm            .macromedia     offline                  .themes
30.jpg          .eclipse                       .gnome             .mailcap        .openoffice-install-log  .thumbnails
.adobe          eclipse_workspace              .gnome2            maildb.conf     .openoffice-lock         .thunderbird
.anjuta         ed_create_virtual_mailuser.pl  .gnome2_private    .mcop           .qt                      .Trash
.bash_history   .eggcups                       .gnome_private     .mcoprc         .realplayerrc            .viminfo
.bash_logout    .emacs                         .gstreamer-0.8     .metacity       .recently-used           working_folder
.bash_profile   .esd_auth                      .gtkrc             .mime.types     .rhn-applet              .Xauthority
.bashrc         fdrive                         .gtkrc-1.2-gnome2  .mozilla        .rhn-applet.conf         .xchat2
.config         .fonts.cache-1                 .ICEauthority      my_docs         .rhopenoffice1.1         .xmms
.cpan           .gaim                          .icons             .mysql_history  RPMs                     .xscreensaver
.designer       .gconf                         installations      .nautilus       sns
.designerrctb2  .gconfd                        .kde               .netscape       .ssh
 
Old 09-08-2005, 07:06 AM   #8
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
... something is weird...
did you try with both users - root and non-root - with the same terminal?
what is the output for both users:
Code:
echo $TERM
be sure that your global vimrc file has
Code:
sy on
somewhere...
regards,
slackie1000
 
Old 09-08-2005, 07:43 AM   #9
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
You should be able to copy /etc/vimrc to ~/.vimrc for both user and root. At least, that's what I did :}

--Ian
 
Old 09-09-2005, 12:12 AM   #10
init_linux
LQ Newbie
 
Registered: Sep 2005
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for the Replies...

Hi slackie1000, as you asked I am giving the o/ps of the following

For root user

Code:
[root@dileep ~]# echo $TERM
xterm
For non-root user

Code:
[dileep@dileep oo_perl]$ echo $TERM
xterm
and I am providing the contents of my /etc/vimrc file. It does not contain "sy on" phrase, but it got the phrase "syntax on "..



Code:
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
   set fileencodings=utf-8,latin1
endif

set nocompatible	" Use Vim defaults (much better!)
set bs=2		" 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
endif

if has("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
   endif
   set csverb
endif

" 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
endif

if &term=="xterm"
     set t_Co=8
     set t_Sb=[4%dm
     set t_Sf=[3%dm
endif
 
Old 09-09-2005, 01:40 AM   #11
slackie1000
Senior Member
 
Registered: Dec 2003
Location: Brasil
Distribution: Arch
Posts: 1,037

Rep: Reputation: 46
hi there,
remove the red lines
Code:

" 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

endif
and check again if you don't have local definitions - .vimrc files - in home directories...
regards,
slackie1000
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vi editor problem sajith Programming 6 08-18-2014 07:46 AM
problem with Vi Editor sailu_mvn Linux - Software 1 08-09-2005 07:27 AM
Mandrake10.1-menu editor problem. akihandyman Mandriva 1 12-29-2004 06:15 AM
Problem with the EDITOR variable objorkum Slackware 2 10-19-2004 03:29 PM
Makefile with emacs editor problem? varala_kanth Linux - Software 0 04-03-2004 02:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration