Loading ...
Sorry, an error occurred while loading the content.
 

cmap and :BufGrep from greputils.vim

Expand Messages
  • R. shankar
    Hi All, I am using GrepUtils utility by Hari Krishna. I want a simple mapping such that, I put a cursor under a word, and press a hot key, then the :BufGrep
    Message 1 of 2 , Dec 2, 2004
      Hi All,

      I am using GrepUtils utility by Hari Krishna.

      I want a simple mapping such that, I put a cursor under a word, and press a hot key,
      then the :BufGrep <cword> command is executed and the :Cfile command is also typed.

      I tried this.
      :cmap <C-G> BufGrep <cword><CR>:Cfile<CR>

      It works when I type this command and execute.
      I added this to the .vimrc and tried to issue the command :<C-G>. It executed the BufGrep command but did not execute the :Cfile command.

      I am not sure why this is happening.

      Also, it would be great, if get the quickfix window directly after executing the :BufGrep command instead of a preview window and then converting to the quickfix window. Any changes to be made to greputils.vim

      Regards,
      shankar
    • Hari Krishna Dara
      I was on vacation and couldn t respond immediately. It seems very strange that the map doesn t work. When I tried variations ... it works fine. I also verified
      Message 2 of 2 , Jan 4 10:18 AM
        I was on vacation and couldn't respond immediately.

        It seems very strange that the map doesn't work. When I tried variations
        like this:

        :cmap <C-G> BufGrep <cword><CR>:echo 'hello'<CR>

        and even executing a user command like this:

        :command -nargs=* Echo :echo <args>
        :cmap <C-G> BufGrep <cword><CR>:Echo 'hello'<CR>

        it works fine. I also verified that Vim is in the right buffer after
        BufGrep is executed, as :Cfile is local to the Grep Preview buffer. I
        have no clue on why it wouldn't work.

        But for your needs, if you always want Cfile to be executed at the end,
        you can just add the call to Cfile at the end of the s:VimGrep()
        function (untested). Let me know if this doesn't workout for you.

        --
        Thanks,
        Hari

        On Thu, 2 Dec 2004 at 10:15pm, R. shankar wrote:

        > Hi All,
        >
        > I am using GrepUtils utility by Hari Krishna.
        >
        > I want a simple mapping such that, I put a cursor under a word, and press a
        hot key,
        > then the :BufGrep <cword> command is executed and the :Cfile command is also
        typed.
        >
        > I tried this.
        > :cmap <C-G> BufGrep <cword><CR>:Cfile<CR>
        >
        > It works when I type this command and execute.
        > I added this to the .vimrc and tried to issue the command :<C-G>. It executed
        the BufGrep command but did not execute the :Cfile command.
        >
        > I am not sure why this is happening.
        >
        > Also, it would be great, if get the quickfix window directly after executing
        the :BufGrep command instead of a preview window and then converting to the
        quickfix window. Any changes to be made to greputils.vim
        >
        > Regards,
        > shankar
        >
        >
        >
        >



        __________________________________
        Do you Yahoo!?
        Yahoo! Mail - Easier than ever with enhanced search. Learn more.
        http://info.mail.yahoo.com/mail_250
      Your message has been successfully submitted and would be delivered to recipients shortly.