[email protected] ,
March 8, 2001 14:51
see vimtip #5 for more detail
[email protected] ,
August 17, 2001 9:22
Oh boy! What a great discovery! I too wish I knew it earlier...but better late than never.
[email protected] ,
September 12, 2001 4:44
if you find "*" useful check out '#' does the same thing but in reverse order ;-)
Regards
Jags
Anonymous ,
January 4, 2002 14:00
Jags, you're my hero!!! That was my next question...
[email protected] ,
March 1, 2002 12:44
if you like "#" and "*", and you do lots of nested loops, try using "%"
[email protected] ,
March 3, 2002 9:27
U can also search patterns by just left clicking the mouse on the word U want to search while keeping the shift button pressed !!!
--- sachin
[email protected] ,
April 4, 2002 20:44
Another thing worth knowing that is related to this: when entering a search, hit <C-R><C-W> and the word under the cursor will appear in your search. This is very useful if you want to search for some variation of the word under the cursor.
--Gavin
[email protected] ,
April 19, 2002 3:59
If you have already searched anything, type '/' or '?' and use arrow up/down to get the last search patterns/commands.
[email protected] ,
May 3, 2002 6:57
In addition to / and arrow keys you can also just type "n" to search (again) for the next instance.
[email protected] ,
May 14, 2002 3:36
Here's a mapping that lets */# search for the selected text in VISUAL MODE. Put this into your .vimrc file:
" Search for selected text in visual mode with */#
" effect: overrides unnamed register
" Simplest version: vnoremap * y/<C-R>"<CR>
" Better one: vnoremap * y/\V<C-R>=escape(@@,"/\\")<CR><CR>
" This is so far the best, allowing all selected characters and multiline selection:
" Atom \V sets following pattern to "very nomagic", i.e. only the backslash has special meaning.
" As a search pattern we insert an expression (= register) that
" calls the 'escape()' function on the unnamed register content '@@',
" and escapes the backslash and the character that still has a special
" meaning in the search command (/|?, respectively).
" This works well even with <Tab> (no need to change ^I into \t),
" but not with a linebreak, which must be changed from ^M to \n.
" This is done with the substitute() function.
vnoremap * y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>
vnoremap # y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
[email protected] ,
July 12, 2002 19:05
I discovered the "#" and "*" commands after forgetting to go to insert mode at the beginning of a new c source file about seventy times. I'd start to type "#include", and get the error message: "No string under cursor." I finally decided to look it up.
[email protected] ,
July 26, 2002 2:42
This is really great.
I feel I've entered into a new world of VIm
Thx
[email protected] ,
August 13, 2002 4:12
Please pardon me, but I can't understand how on earth "*" command can save me typing. Could somebody provide example scenarios where it may be helpful?
[email protected] ,
August 19, 2002 2:25
You normally would search for the occurence of a word by typing "/_Your_Very_Big_And_Untidy_Word_That_Has_A_Lot_Of_UnderScores_<CR>" followed by 'n's and 'p's. If you have the word you want to search for under the cursor, you can just press '*' or '#' to go to the next or previous occurence of that word.
[email protected] ,
September 4, 2002 3:27
That is just great. Thanks for giving this tip.
[email protected] ,
September 10, 2002 4:37
bahut aacha hai bhaiya .
koi ghotala nahi
Anonymous ,
September 12, 2002 22:43
stated using, looking at VIM today...good tip to start out with!
Anonymous ,
October 15, 2002 7:32
...and for those n00bs out there (like myself...) it's NOT the mouse cursor we're talking about here! duh...
[email protected] ,
October 15, 2002 19:21
Oh, now I see, always wondered how to do that. What is it 2002, I started using vim exclusively in 1995, quick learner aren't I!!!
That is an exceptional tip, it should be kept back from newer vim users to avoid them gaining an unfair advantage over old coots like me.
Cheers and many thanks,
Matt
Anonymous ,
October 23, 2002 14:19
Ha! I started using vim a few days ago and I just learned this. :P
Anonymous ,
November 8, 2002 4:57
To heck with "*", in reading this thread I just found out how to put comments in my _vimrc file for all those cryptic commands I'm assigning to F-keys. RTFM? Hah! A real engineer only resorts to documentation when the keyboard dents on the forehead get too noticeable.
[email protected] ,
November 24, 2002 10:42
Brilliant.. nothing but brilliant!
[email protected] ,
January 11, 2003 0:43
fortunately..I have known #,*... ...I just say.that you do "gD" on the word. :) I think this is also great!
Anonymous ,
January 19, 2003 8:46
The fingers usually are closer to the gd combination than the '*', that's why I don't find '*' to be such a great enhancment...
[email protected] ,
January 22, 2003 1:36
I use "*" for to find out where a particular variable has been used down the file. But when I have done through its occurences, I want to get back to the line where I first used "*" and continue with the source. I usually just keep hitting "*" a many more times so that it cycles around the file and comes to the line where I left off. How can I shorten this ?
[email protected] ,
January 23, 2003 0:00
Set a mark before you start roaming with *. Press m[a-zA-Z]. That is, m followed by any letter. To return to the mark, press backquote ( ` ) followed by the same letter. Single quote takes you to the start of the line containing the mark. Capital letters work across different files, too.
:marks lets you see the lines on which marks are set.
[email protected] ,
January 24, 2003 2:44
About going back after you've moved to the first '#' or '*'-hit:
typ `` (2 times a backtick) to go back to the last place.
This always works after every jump you make.
In this discussion it works only when you don't move around all #- or *-hits of course.
[email protected] ,
February 5, 2003 7:26
this thing is *huge* !)
Anonymous ,
April 23, 2003 11:53
>> I use "*" for to find out where a particular variable has been used down the file. But when I have done through its occurences, I want to get back to the line where I first used "*" and continue with the source. I usually just keep hitting "*" a many more times.
As a side comment: You can simply press 'n' instead of pressing '*' to continue your search and move on to the next hit. '*' involves holding down shift, while 'n' does not.
Anonymous ,
April 23, 2003 11:54
>> [email protected] , Another thing worth knowing that is related to this: when entering a search, hit <C-R><C-W> and the word under the cursor will appear in your search. This is very useful if you want to search for some variation of the word under the cursor.
This is just about as phenomenal (if not more) as the '*' and '#' commands themselves !! Thanks dude!
Anonymous ,
April 27, 2003 16:58
can anybody please tell me what <C-R><C-W> means?
thanks
vario uneseny
Anonymous ,
April 30, 2003 3:12
<C-R><C-W> means 'Hold down CTRL, press R, press W, release CTRL'. Or, verbally, Control R, Control W.
anon,
May 24, 2003 2:26
Regarding getting back to where you first pressed * from.. I good idea is to press (capital) N which does the search in reverse. Might be quicker and easier than pressing n several times until you wrap.
Setting hlsearch is good too.
Also, * is just one keypress on most keyboards... on the numeric keypad.
Anonymous ,
June 15, 2003 10:04
thanks for reminding that * is one stroke
Anonymous ,
July 3, 2003 15:51
err... someone knows how to unmark words previously marked with '*' , '#' or '/' ?
My way is /~ (not always works of course)
BIG THX
Anonymous ,
July 3, 2003 19:12
i found vimtip #14 about it.
[email protected] ,
July 7, 2003 0:54
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
مرحبا كيفكو بسبر ستار انا كتير كتير معجبني سبر ستار ياريت اروح الى سبر ستار
شكراً
[email protected]
[email protected] ,
July 25, 2003 11:41
مرحبا انا معجب جدا بهدا البرنامج وشكرا
vimbigot at fastmail.fm,
August 5, 2003 23:29
you can also jump backwards after a * by using <C-o> as in control-o. control-i will let you jump forward again. You guessed it, it is a jump stack.
also I toggle highlighting when doing a search, and turn it off when I have stopped searching. The next search turns it back on again.
from my _vimrc
" don't leave highlighting on for ever, but turn back when a new search
" starts or the last one is repeated
nnoremap <F7> :se nohls<cr>
nnoremap n :set hls<CR>n
nnoremap N :set hls<CR>N
nnoremap * :set hls<CR>*
nnoremap # :set hls<CR>#
nnoremap / :set hls<CR>/
nnoremap ? :set hls<CR>?
Anonymous ,
August 8, 2003 2:52
Your mapping is not necessary, except F7. Instead of using ":set noh" use ":noh". Rest is done automaticaly.
Anonymous ,
September 29, 2003 15:59
many thanks to [email protected] for the visual mode version of this.
here's a tweak of that which works in --SELECT-- mode:
vnoremap <M-/> y/\V<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR>gV
vnoremap <M-?> y?\V<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>gV
(note that i map the commands to META-/ and META-? instead of * and # because i want to keep the option of replacing the selection with */#.)
[email protected] ,
October 13, 2003 10:47
COME ON PEOPLE !!!! It's just another command! Don't have an orgasm over it! Ooooooh! That's what it's all about!!!???
Rodge
[email protected] ,
December 1, 2003 12:52
"tha_code_buster" Rodge's juvenile comment notwithstanding, thanks to all for the great tips!
[email protected] .,
December 12, 2003 19:32
Go get a life without a #nerds*, stop worshipping vim
and start using it.
[email protected] ,
January 15, 2004 15:14
From my .vimrc :
" Clears search highlighting by just hitting a return.
" The <BS> clears the command line.
" (From Zdenek Sekera [[email protected] ] on the vim list.)
" I added the final <cr> to restore the standard behaviour of
" <cr> to go to the next line
:nnoremap <CR> :nohlsearch<CR>/<BS><CR>
I like this approach: <CR> is more likely than most other keys, at least when in normal mode, and you don't loose any key with this approach. (Thanks Zdenek).
[email protected] ,
March 1, 2004 18:51
How would I use the '*' command to search for an word that has '-' characters within it. I find it only searches for the partial word delimited by '-'
[email protected] ,
April 22, 2004 10:56
set iskeyword to include '-' and the dash will be considered as a part of the word.
[email protected] ,
May 1, 2004 17:17
I've been using * and # to search, but I wish I can find the matching word IN THE OTHER WINDOW (when in a split window mode). Is there anyway to accomplish that ?
willsmithnet yahoo co uk,
May 13, 2004 2:34
On UK keyboards, <Shift>-<3> works just like # for searching backwards.
That's because <Shift>-<3> gives # on most other countries keyboards,
although it gives the pound currency symbol on UK keyboards.
Touch typists should appreciate this because it is the left-hand equivalent of
how you type * with <Shift>-<8>, whereas the # on UK keyboards is way over
next to the return key.
kazanova_20102003,
May 30, 2004 7:57
انا معجب بهذا البرنا مج جدا انا اتمتا ان اشترك فيه
[email protected] ,
June 11, 2004 14:45
انا معجب جدا بى برنامج سوبر ستار وا جمل صوت وشكل طلع فى االبرنا مج هو الفنان رضاء جعفر رضاء جعفر
[email protected] ,
June 22, 2004 4:06
رضاء جعفر لقد غنى فلا اعذب نت صوته واطرب واشجى له كل مواصفات النجم الحلة طلعة بهية ولمن لايعرف رضاء جعفر فهو انسان خلوق جدا وطيب جدا جدا ومحبوب وهادئ ىاستمعوا له بقلب بغض النظر عن بلده وجنسيته او اي شئ فقط هو رضاء لك حبنا
سلمى الدائمي