Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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
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.
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
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!
...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!)?
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.
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
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.