On 28/05/10 02:17, justlooks wrote:
i try to write a key map,it's function is when the cursor on the
word,and i hit F2,the vim will open a new window on top ,and dispaly
the info about ' perldoc "keyword"'

so i write the follow sentence

map<F2>   :let w="<cword>"<CR>:top new "help"<CR>:1! perldoc -t w<CR>

but no perldoc info display in new window,i do not know how to do to
let it work,any one can help?


I'm surprised there hasn't been an answer yet.

1. The variable w is set to the literal string "<cword>", not to the word at the cursor.

2. Your quotes (after :new) are treated as comment leaders, the value "help" is treated as a comment by Vim.

3. ":1!perldoc" means "pass the first line of the current file as input to perldoc, then replace it by the output of perldoc. Do you really want to replace the first line of any "help" file present in the current directory (assuming you remove the quotes around "help")?

4. ":!perldoc -t w" passes a literal w as the value of the -t argument to perldoc, not the value of the variable w, which is never used.

See:
        1) :help expand()
        2) :help :quote
        3) :help filter
           :help :new
        4) :help :exec

Also, I think you could profit from reading

        :help :bar
        :help :r!


Best regards,
Tony.
--
TALL KNIGHT: When you have found the shrubbery, then you must cut down the
             mightiest tree in the forest ... with a herring.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to