LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-04-2008, 05:28 PM   #1
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 11.04
Posts: 186

Rep: Reputation: 36
'l' letters are constantly highlighted in VIM?!


Hi there.
A weird problem here.
I think I've caused it myself by incorrectly forming a regular expression when I was searching for a string in a script file using VIM (although I can't recall at what occassion and what exactly I wrote). However, what I basically have here now is that all 'l' letters (NOT capital L though!) are marked / highlighted with yellow background. This occurs in every new VIM session as well, like I "told" VIM to do this as default. As soon as I type 'l' in VIM - it's highligted, simple as that! Any easy way to remove this? Perhaps a command that resets all VIM stuff to default?

Thanks in advance!
M.
 
Old 01-04-2008, 06:05 PM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
sounds like a highlight search has been set in your vimrc.

but I use Mdv and not sure where your distro puts the file or files so open a shell and commands

su (and passwd)
find / -name vimrc && find / -name .vimrc

the response for me (eg) is
/etc/vim/vimrc
/usr/share/vim/vimrc
/root/.vimrc

2) you did not menition if you were running vim as root or normal user but just use a text editor (root powers for the root one) to view each file

3) pay attention to "Syntax highlighting" and "set hlsearch"

4) if you can not decide what vimrc is been used you can run it with
vim -u /pathway to different vimrc or .vimrc (etc)

5) also make backups of your file before making a change
eg you may decide to use the /usr/share/vim/vimrc to make a copy and call it
/home/yourname/.vimrc

Last edited by aus9; 01-04-2008 at 06:06 PM.
 
Old 01-04-2008, 06:18 PM   #3
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 11.04
Posts: 186

Original Poster
Rep: Reputation: 36
Hi and thanks for the reply.
I use Fedora 7 and the only vimrc I found was located in /etc dir.
"Syntax highlighting" does not exist, while 'set hlsearch' does appear only in a conditional statement:

Code:
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif
I'm not so good at this and I'm quite certain I never touched this file before.

Weird...
 
Old 01-05-2008, 12:50 AM   #4
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
you have changed a setting but the settin was changed from the bash shell.

check out /usr/share/vim/doc/usr_06.txt

within vim run command

Code:
:syntax clear
and see if that clears the l highlight by pressing i to enter INSERT mode and then press l to see if hightlighted.

2) also check out /usr/share/vim/syntax which I should have found earlier. ....which loads values stored in /usr/share/vim/syntax/synload.vim

hopefully you will find a l in there when there should not be....but that assumes you ran the change while running vi/vim in root mode

Last edited by aus9; 01-05-2008 at 12:59 AM.
 
Old 01-05-2008, 04:26 AM   #5
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 11.04
Posts: 186

Original Poster
Rep: Reputation: 36
Code:
:syntax clear
didn't remove highligted 'l's. They are still highlighted when entered in insert mode (or already present in an old file).

I'm not finding anything that logically could be causing my problem in synload.vim either. Also, I'm pretty sure I was using my own account, not root, when this occured. Here's the listing of synload.vim.

Code:
if !has("syntax")
  finish
endif

" let others know that syntax has been switched on
let syntax_on = 1

" Set the default highlighting colors.  Use a color scheme if specified.
if exists("colors_name")
  exe "colors " . colors_name
else
  runtime! syntax/syncolor.vim
endif

" Line continuation is used here, remove 'C' from 'cpoptions'
let s:cpo_save = &cpo
set cpo&vim

" First remove all old syntax autocommands.
au! Syntax

au Syntax *             call s:SynSet()

fun! s:SynSet()
  " clear syntax for :set syntax=OFF  and any syntax name that doesn't exist
  syn clear
  if exists("b:current_syntax")
    unlet b:current_syntax
  endif

  let s = expand("<amatch>")
  if s == "ON"
    " :set syntax=ON
    if &filetype == ""
      echohl ErrorMsg
      echo "filetype unknown"
      echohl None
    endif
    let s = &filetype
  endif

  if s != ""
    " Load the syntax file(s).  When there are several, separated by dots,
    " load each in sequence.
    for name in split(s, '\.')
      exe "runtime! syntax/" . name . ".vim syntax/" . name . "/*.vim"
    endfor
  endif
endfun


" Handle adding doxygen to other languages (C, C++, IDL)
au Syntax cpp,c,idl
        \ if (exists('b:load_doxygen_syntax') && b:load_doxygen_syntax)
        \       || (exists('g:load_doxygen_syntax') && g:load_doxygen_syntax)
        \   | runtime! syntax/doxygen.vim
        \ | endif


" Source the user-specified syntax highlighting file
if exists("mysyntaxfile") && filereadable(expand(mysyntaxfile))
  execute "source " . mysyntaxfile
endif

" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save
 
Old 01-05-2008, 05:05 AM   #6
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 11.04
Posts: 186

Original Poster
Rep: Reputation: 36
Ok, just got a phonecall from buddy of mine. Apparently 'set nohlsearch' typed in VIM solved the problems. But I really appreciate your effort for trying helping me out. Thanks a lot!
 
Old 01-05-2008, 08:05 AM   #7
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 11.04
Posts: 186

Original Poster
Rep: Reputation: 36
...but apparently, this command only works in a current session. As soon as I close VIM and start a new one, the 'l' highlight is again activated. Any way to place this permanently (I'm really getting frustrated!)?

Thanks in advance!
 
Old 01-05-2008, 03:35 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,999
Blog Entries: 11

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Try a search within vim for a character that doesn't exist in
the file edited. ;}

My recollection is that vim remembers the last thing searched
for and will highlight it in a new file. And no, I don't know how
to change that default behaviour - it never bothered me.



Cheers,
Tink
 
Old 01-05-2008, 06:19 PM   #9
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
Tinkster how about edit of this line?
set history=50 " keep 50 lines of command line history
to 0 of course, in vimrc, edit with root powers.

The OP seems to suggest he has no .vimrc in home so he opens shell as normal user.
 
Old 01-05-2008, 06:25 PM   #10
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
Tinkster....or turn off syntax search colour searching in vimrc

change

" 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>>>>>>>>>>>>>>>>>>off
set hlsearch>>>>>>>>>>>>>>>>>>>>remove line
endif

again assuming OP only using vimrc from /usr/share area
 
Old 01-05-2008, 09:01 PM   #11
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
normally the vimrc is a hidden file in your home dir ie
/home/user/.vimrc
As suggested, take a copy, then examine /amend lines that look suspect eg hlsearch etc
 
Old 04-04-2012, 12:41 PM   #12
statikeffeck
LQ Newbie
 
Registered: May 2011
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by Tinkster View Post
Try a search within vim for a character that doesn't exist in
the file edited. ;}

My recollection is that vim remembers the last thing searched
for and will highlight it in a new file. And no, I don't know how
to change that default behaviour - it never bothered me.



Cheers,
Tink
Thanks this solved it for me
As a vim noob I starting typing text while not in insert mode. It was highlighting every lowercase "p" in the file. I just typed /blahblahblah[ENTER] and now the highlighting is gone.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
function not highlighted in vi editor in suse 10.1 manish_bioinfo Programming 3 09-13-2006 10:03 PM
All messages are highlighted in Kopete! Bjorne Linux - Software 2 08-18-2005 06:31 AM
Corrupt file, highlighted in red BPT73 Linux - Newbie 2 05-06-2005 08:30 PM
can't get rid of highlighted items in vi vinfekshen Linux - Newbie 5 10-31-2003 06:21 AM
Highlighted text in Vi doncrawley Linux - Newbie 3 10-18-2003 09:37 AM


All times are GMT -5. The time now is 10:48 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration