i use cygwin and i have a program that was returning an error saying "undefined reference" and i figured out that i misspelled a word. how can i search for the misspelling in the input mode, if ive just completed a very large program and dont want to scroll through possibly 300+ lines of input? im not totally out the loop, but i know i can "vim program.cpp" to open the program, but before clicking "i" to actually edit, there must be a way to search a word
The "undef ref" is a linker error and object files have no "lines".
@tazzthetecj:
You essentially ask: "How to use vim?"
That is not the only editor. Nevertheless, my guess is / for "find regular expression". Check man vim
I would probably suggest a more user-friendly editor (such as gedit, or kate, or mousepad, or leafpad, or ...) Besides, you could also try a IDE like Code::Blocks or Eclipse (with CDT).
vim is an excellent editor, very professional but sometimes it is maybe... too professional! Anyway this is only my personal opinion!
ok, maybe i didnt word my question properly, but yes it does give an associated line, but honestly, the naked eye will miss two vowels being misaplced out of a 11 character word that you typed over and over again for the function call, this may not be the best place to ask for little tips and tricks, but ive been looking for shortcut ways to do things within the input mode not the terminal, just like " :wq " saves and exits, thats the type of command im looking for to be able to locate a word.
in response to @keskiverto no im not asking how to use vim, i know you use vim to open your program, then hit "i" to actually start typing, but after youve recieved an error and you reopen it, instaed of typing "i" to try and correct something, i was asking if there is a command to search for the specific word, just like i stated above with the ":wq: or the ":q!" i apologize if this isnt the place for those types of questions.
Your question was already answered. Press / (forward slash) then type the word you want to search for and press return. You can then use n and N to cycle through the search results (forwards and backwards). If you're planning on using Vim I'd highly recommend you go through the tutorial. Go to your terminal and type vimtutor
Some other tips while we're here: :wq can be shortened with ZZ (as in [shift] z z) #gg jump to a particular line(replace # with a line number)
> 11 character word that you typed over and over again
if you type <C-n> in insertion mode it would display a list of words that match the prefix.
(there is also omni completion)
- cursor on the word
- press *
- type ciw
- type in the word you want to use as a replacemente
- press n (move to next occurrence) then . (repeat change)
- repeat until the last occurrence
- cursor on the word (anywhere)
- yiw (yank inner word)
- :% s#<C-r>"#replacement#gc (paste the unnamed register, change all occurrences in the line, ask for confirmation)
@Lachlan Easton: perhaps I could get accustomed, ¿is there a way to put it on the left side instead?