2008/11/23 Gary Johnson <[EMAIL PROTECTED]>: > On 2008-11-23, David <[EMAIL PROTECTED]> wrote: > >> Every time I try to use :help I become frustrated. I have just spent a >> couple of hours trying in vain to find out some elementary things. I >> tried :help comment. I was indeed able to learn what the default >> comment symbol was, but only by paying careful attention, because this >> passage was clearly written for someone who already knew that the >> comment symbol is a double quote mark. >> Q1. Where is the article that explains to a beginner that the default >> comment symbol is a double quote mark? > > I finally found it here: > > :help vim-script-intro > > and then searched for "comment". I can understand your frustration. > >> Q2. How should I have proceeded to find that section of help? > > I don't know. After trying the "obvious" places, as you did, I > decided to look in whatever section covered writing configuration > (e.g., .vimrc) or script files. > > I finally did find the definitive help topic on this: > > :help :" > > or > > :help :quote > > Unfortunately, that topic can only be found if you already know that > " is used for vim comments. I found it by knowing that : begins > every help topic on ex commands and that " is used within ex > commands. > >> Q3. Suppose there are 25 sections of help that discuss comment >> symbols. Is there a convenient way to find them all? And how could I >> conveniently work through them systematically? > > If you want to find all the help keywords containing "comment", type > > :help comment > > then type Ctrl-D for a list of matches. This is mentioned near the > top of > > :help > > and under > > :help help > > as are other techniques. For example, you can execute ":help" then > > :tag /comment > > and traverse the resulting list of tags. You can use ":helpgrep" to > search the help files for a pattern and traverse the resulting > quickfix list. > >> Q4. Does the format *:comment* have a particular significance? It must >> have, because one finds it everywhere in the help files. What is less >> apparent is what it means and whether one can use it to jump to a >> suitable topic. > > Those are help tags. They are the targets of jumps. The tags you > can jump to are surrounded by || as described at the top of ":help". > Unfortunately, recent releases of vim seem to highlight the * and | > characters used for help tags with the Ignore highlight group for > the sake of "readability", so you may not see them and may have to > rely on other highlighting cues to recognize them. > >> >> In sample vimrc files on the web, I found entries as follows: >> set comments+=b:\" >> set comments+=n:: >> Q5. How could I find out what += means here? I mean by using vim help, >> not by asking this news group. I tried :help += and obtained an >> article on the use of :let, which I do not consider relevant. > > That's because that help command took you to the first article in > the help tags list containing "+=". If you had typed > > :help += > > followed by Ctrl-D, would have seen the ":set+=" tag as well. If > you had known about Ctrl-D, that is. Or you could have gone for > > :help :set > > and scrolled down a bit to find the entry discussing +=. > >> Q6. What is the meaning of += here? > > :help :set+= > >> Q7. What is the meaning of the b: and n: in this context? > > :help comments > > would refer you to > > :help format-comments > > which explains those. > >> >> Here is the problem I started with at the beginning of my 2 hours of >> frustration: >> I tried Unix>vim>following_command >> >> :.!date " and here I put a comment >> >> and received error messages. >> The problem is not, as I mistakenly thought, with the comment symbol, >> but, as you experts undoubtedly realise instantly, with the fact that >> vim is feeding back the whole line >> >> date " and here I put a comment >> >> to the Unix shell for interpretation. This brings me to my final >> question: >> Q8. Is there any way of telling vim not to feed the whole line to the >> Unix shell, but only the initial part? I tried shielding the comment >> part by inserting a | as shown to me by the vim online help response >> to :help comment, but it didn't work. (This all occurs in something I >> am trying to automate in a source file of vim commands, and that's why >> I do want to include a comment. I suppose I could give up and put the >> comment elsewhere, where vim would find it less puzzling, but a human >> reader would find it more puzzling.) > > You could use a shell comment instead of a vim comment, escaping the > # so that vim didn't expand it as the alternate file name, e.g., > > !date \# put comment here > > You could instead use :exe to execute the !date command and follow > that with a vim comment, but I think that would be even less > readable. > >> >> Thanks very much for your patience if you have managed to stick with >> me this far, and many thanks in advance for any help. Apologies for >> asking so many questions, but it might have been much more irritating >> if I had used 8 postings for my 8 questions. If there are any >> responders, I would be grateful if you could say which of my 8 >> questions you are answering. > > The customary technique for replying to questions in mailing lists > and newsgroups is to quote the questions and to reply to each > question immediately below the quoted question, as I have done here. > Most experienced users will follow this custom. > > I hope that's been helpful. There are other ways to search the help > files and others may discuss those. I tried to stay away from > techniques I don't use myself and those that might rely on my > customizations. > > Regards, > Gary
To those good answers, I would add that ":helpgrep" can be very useful. For example... :helpgrep comment ... then type use the quickfix commands to go through all matches such as ":cn" (to go the next match) or if there are many matches it can be more convenient to do ":copen" to open up a window with all the results of ":helpgrep". You can then move the cursor in the window of ":copen" and type <Enter> on a given match to go that that location. You can learn more by reading: ":help help" and ":help helpgrep". Hope that helps. -- Dominique --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
