LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 10-17-2003, 02:33 PM   #1
doncrawley
LQ Newbie
 
Registered: Sep 2003
Location: Seattle, Washington
Distribution: Fedora, CentOS, Slackware, Ubuntu, Debian
Posts: 11

Rep: Reputation: 0
Highlighted text in Vi


This seems to happen fairly often. When using vi, I do something that causes certain text strings to be highlighted. I can't figure out what I did to turn it on and, obviously, can't figure out what to do to turn it off. The only clue I can provide is that each time the text string appears, it is highlighted. Any thoughts?
 
Old 10-17-2003, 02:44 PM   #2
andrew001
Member
 
Registered: Nov 2002
Distribution: Slackware 9.0
Posts: 321

Rep: Reputation: 30
You probably have the option to highlight searched text on. You can override the defaults in the vimrc by making a .vimrc file in you home directory. Here's one I nabbed from one of the servers here at school that I use. Notice I commented out the lign to highlight search strings.

" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2002 May 28
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if vrogname =~? "evim"
finish
endif

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

set autoindent " always set autoindenting on
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" 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

" Only do this part when compiled with support for autocommands.
if has("autocmd")

" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on

" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif

endif " has("autocmd")


~Andrew
 
Old 10-18-2003, 09:26 AM   #3
pablob
Member
 
Registered: Apr 2003
Location: Madrid
Distribution: RHAS, Kubuntu, Solaris, TRU64
Posts: 381

Rep: Reputation: 31
I guess that vimrc would be the right way after customizing to your needs, but if you want it the fast way, after editing a file do:

: syntax off
 
Old 10-18-2003, 09:37 AM   #4
arunshivanandan
Member
 
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643

Rep: Reputation: 30
may be the highlighting is due to pressing of '/'.'/blahblah' will search for blahblah will search for blahblah in the file and will highlight it.
 
  


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
All messages are highlighted in Kopete! Bjorne Linux - Software 2 08-18-2005 06:31 AM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 08:15 PM
Corrupt file, highlighted in red BPT73 Linux - Newbie 2 05-06-2005 08:30 PM
/lib/modules/2.4.20-6/ contains an entry called "build" which is highlighted in red - Simon Bridge Linux - Software 1 01-24-2004 10:46 PM
can't get rid of highlighted items in vi vinfekshen Linux - Newbie 5 10-31-2003 06:21 AM


All times are GMT -5. The time now is 08:17 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration