LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 04:28 PM   #1
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.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, 05:05 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

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 05:06 PM.
 
Old 01-04-2008, 05:18 PM   #3
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.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-04-2008, 11:50 PM   #4
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

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-04-2008 at 11:59 PM.
 
Old 01-05-2008, 03:26 AM   #5
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.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, 04:05 AM   #6
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.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, 07:05 AM   #7
MheAd
Member
 
Registered: Jun 2007
Distribution: Ubuntu 14.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, 02:35 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 05:19 PM   #9
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

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, 05:25 PM   #10
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

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, 08:01 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 11:41 AM   #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



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 09:03 PM
All messages are highlighted in Kopete! Bjorne Linux - Software 2 08-18-2005 05:31 AM
Corrupt file, highlighted in red BPT73 Linux - Newbie 2 05-06-2005 07:30 PM
can't get rid of highlighted items in vi vinfekshen Linux - Newbie 5 10-31-2003 05:21 AM
Highlighted text in Vi doncrawley Linux - Newbie 3 10-18-2003 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 AM.

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