LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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-31-2006, 10:51 PM   #1
kachmi
LQ Newbie
 
Registered: Feb 2006
Posts: 6

Rep: Reputation: 0
Wink can you search "." in vi editor by using ? or / ?


can you search the "." (dot) in vim editor by using ? or / ?
 
Old 10-31-2006, 11:39 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
If you're looking for a dot "." you'd type /\. or ?\.- the "/" or "?" starts the search command and the "\" escapes the "." so it's treated as a literal dot.

Was that what you meant?
 
Old 11-01-2006, 07:12 AM   #3
ayteebee
Member
 
Registered: Jul 2005
Location: Derbyshire
Distribution: Originally Suse 9.1 Professional, currently Knoppix 3.7, migrating to Slackware
Posts: 75

Rep: Reputation: 16
The dot "." is recognised by vim as being a regular expression operator, so it needs to be escaped with a backslash "\" to be read as a literal dot. It's worth finding out about regular expressions, because they're really cool and useful; having said that, it's one of those things I still need to get around to...
 
Old 11-01-2006, 07:15 AM   #4
Bharatsoni
LQ Newbie
 
Registered: Jun 2004
Posts: 3

Rep: Reputation: 0
Thumbs up searching "." in vi

Hi,
for vi U can find a "." by typing /\. in the file.
 
Old 11-01-2006, 11:14 AM   #5
reiki33
LQ Newbie
 
Registered: Dec 2005
Posts: 8

Rep: Reputation: 0
another useful way to delimit characters

Another useful technique of delimiting characters comes when you get a windows file and want to remove all of the ^M (ctrl-M) at the end of a line. You need to enter the ^M literally and not have it get taken as an end-of-line input. You can use the :%s/^v^M//g command. The ctrl-v tells vi to take the next character literally, so you can input it into the command. The s command invokes sed and will change all of the occurrences (the g part) of ^M on all (the % part) of the lines.
 
Old 11-03-2006, 07:58 AM   #6
hufemj
LQ Newbie
 
Registered: Aug 2006
Posts: 5

Rep: Reputation: 0
vim and Windows

Quote:
Originally Posted by reiki33
Another useful technique of delimiting characters comes when you get a windows file and want to remove all of the ^M (ctrl-M) at the end of a line. You need to enter the ^M literally and not have it get taken as an end-of-line input. You can use the :%s/^v^M//g command. The ctrl-v tells vi to take the next character literally, so you can input it into the command. The s command invokes sed and will change all of the occurrences (the g part) of ^M on all (the % part) of the lines.
Okay. I know this is a Linux forum. But the thread is about vi, which I also use on Windows and which has a peculiar quirk that took me a long time to figure out. With vim on windows, the ^v is used for something else. Instead, ^q is used as the escape character.

- Mark
 
  


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
"HOWTO Change Colour of Comments in VIM editor" manikantha Linux - General 8 07-16-2013 04:36 AM
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
Tip for non-Power Users: Moving from "less" directly into an editor rickh Linux - General 1 10-11-2006 11:16 AM
Installed jEdit, only get "Starting Programmer's Text Editor" Nathan1993 Ubuntu 6 03-29-2006 01:02 AM
Linux Partition Table Editor - Need to change "Hidden Sectors" value Ouch_Taser Linux - Newbie 3 02-11-2004 11:03 AM


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