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

open quickfix windows after csope and jump

Expand Messages
  • FlashBurn
    I have the following function 1 function! CscopeFind(action, word) 2 try 3 exe :cs f .a:action. .a:word 4 exe :copen 5 catch 6 echohl
    Message 1 of 10 , Mar 19, 2013
      I have the following function

      1 function! CscopeFind(action, word)
      2 try
      3 exe ':cs f '.a:action.' '.a:word
      4 exe ':copen<cr>'
      5 catch
      6 echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
      7 endtry
      8 endfunction

      The idea is open quickfix window and jump to the given result. I finally realized that I cannot do

      exe ':copen<cr>'

      because of a <cr>

      I can't really figure out how to implement this. Does anybody have any idea?

      Any help is appreciated.

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Christian Brabandt
      Hi FlashBurn! ... regards, Christian -- Aus Murphy s Gesetze: Allradantrieb bedeutet, daß man erst dort steckenbleibt, wo der Abschleppwagen nicht hinkommt.
      Message 2 of 10 , Mar 19, 2013
        Hi FlashBurn!

        On Di, 19 Mär 2013, FlashBurn wrote:

        > I have the following function
        >
        > 1 function! CscopeFind(action, word)
        > 2 try
        > 3 exe ':cs f '.a:action.' '.a:word
        > 4 exe ':copen<cr>'
        > 5 catch
        > 6 echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
        > 7 endtry
        > 8 endfunction
        >
        > The idea is open quickfix window and jump to the given result. I finally realized that I cannot do
        >
        > exe ':copen<cr>'
        >
        > because of a <cr>
        >

        You need 2 commands:
        :copen
        :norm! "\<Cr>"

        regards,
        Christian
        --
        Aus Murphy's Gesetze:
        Allradantrieb bedeutet, daß man erst dort steckenbleibt, wo der
        Abschleppwagen nicht hinkommt.

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • FlashBurn
        ... I tried the following: function! CscopeFind(action, word) try exe :cs f .a:action. .a:word copen normal catch echohl WarningMsg | echo Can not
        Message 3 of 10 , Mar 20, 2013
          On Tuesday, March 19, 2013 5:54:23 PM UTC-4, Christian Brabandt wrote:
          > Hi FlashBurn!
          >
          >
          >
          > On Di, 19 M�r 2013, FlashBurn wrote:
          >
          >
          >
          > > I have the following function
          >
          > >
          >
          > > 1 function! CscopeFind(action, word)
          >
          > > 2 try
          >
          > > 3 exe ':cs f '.a:action.' '.a:word
          >
          > > 4 exe ':copen<cr>'
          >
          > > 5 catch
          >
          > > 6 echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
          >
          > > 7 endtry
          >
          > > 8 endfunction
          >
          > >
          >
          > > The idea is open quickfix window and jump to the given result. I finally realized that I cannot do
          >
          > >
          >
          > > exe ':copen<cr>'
          >
          > >
          >
          > > because of a <cr>
          >
          > >
          >
          >
          >
          > You need 2 commands:
          >
          > :copen
          >
          > :norm! "\<Cr>"
          >

          I tried the following:
          function! CscopeFind(action, word)
          try
          exe ':cs f '.a:action.' '.a:word
          copen
          normal "\<cr>"
          catch
          echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
          endtry
          endfunction

          And it didn't work. I also tried normal "<cr>", normal! "\<cr>", and normal! "<cr>". None of them worked. Does anybody have any other ideas?

          --
          --
          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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • FlashBurn
          ... I found a solution to this problem. All I needed to do is the following: exe normal! copen Thanks for the help everyone. -- -- You received this
          Message 4 of 10 , Mar 20, 2013
            On Wednesday, March 20, 2013 9:54:47 AM UTC-4, FlashBurn wrote:
            > On Tuesday, March 19, 2013 5:54:23 PM UTC-4, Christian Brabandt wrote:
            >
            > > Hi FlashBurn!
            >
            > >
            >
            > >
            >
            > >
            >
            > > On Di, 19 M�r 2013, FlashBurn wrote:
            >
            > >
            >
            > >
            >
            > >
            >
            > > > I have the following function
            >
            > >
            >
            > > >
            >
            > >
            >
            > > > 1 function! CscopeFind(action, word)
            >
            > >
            >
            > > > 2 try
            >
            > >
            >
            > > > 3 exe ':cs f '.a:action.' '.a:word
            >
            > >
            >
            > > > 4 exe ':copen<cr>'
            >
            > >
            >
            > > > 5 catch
            >
            > >
            >
            > > > 6 echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
            >
            > >
            >
            > > > 7 endtry
            >
            > >
            >
            > > > 8 endfunction
            >
            > >
            >
            > > >
            >
            > >
            >
            > > > The idea is open quickfix window and jump to the given result. I finally realized that I cannot do
            >
            > >
            >
            > > >
            >
            > >
            >
            > > > exe ':copen<cr>'
            >
            > >
            >
            > > >
            >
            > >
            >
            > > > because of a <cr>
            >
            > >
            >
            > > >
            >
            > >
            >
            > >
            >
            > >
            >
            > > You need 2 commands:
            >
            > >
            >
            > > :copen
            >
            > >
            >
            > > :norm! "\<Cr>"
            >
            > >
            >
            >
            >
            > I tried the following:
            >
            > function! CscopeFind(action, word)
            >
            > try
            >
            > exe ':cs f '.a:action.' '.a:word
            >
            > copen
            >
            > normal "\<cr>"
            >
            > catch
            >
            > echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
            >
            > endtry
            >
            > endfunction
            >
            >
            >
            > And it didn't work. I also tried normal "<cr>", normal! "\<cr>", and normal! "<cr>". None of them worked. Does anybody have any other ideas?

            I found a solution to this problem. All I needed to do is the following:

            exe 'normal! copen<cr>"

            Thanks for the help everyone.

            --
            --
            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

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
          • Ben Fritz
            ... This should NOT work. This should beep at you and fail to do anything, because from normal mode, it will: c - start of the c command, to delete text and
            Message 5 of 10 , Mar 21, 2013
              On Wednesday, March 20, 2013 9:30:11 AM UTC-5, FlashBurn wrote:
              >
              > I found a solution to this problem. All I needed to do is the following:
              >
              >
              >
              > exe 'normal! copen<cr>"
              >
              >

              This should NOT work. This should beep at you and fail to do anything, because from normal mode, it will:

              c - start of the c command, to delete text and enter insert mode
              o - invalid movement command, should ding and abort the rest of the command

              Are you sure this is what you did to get it working?

              --
              --
              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

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • FlashBurn
              ... Ben, You are right. It doesn t work. But it doesn t beep at me, it simply doesn t open the quickfix window. So the issue hasn t been resolved. Can anybody
              Message 6 of 10 , Mar 21, 2013
                On Thursday, March 21, 2013 11:02:08 AM UTC-4, Ben Fritz wrote:
                > On Wednesday, March 20, 2013 9:30:11 AM UTC-5, FlashBurn wrote:
                > >
                > > I found a solution to this problem. All I needed to do is the following:
                > >
                > >
                > >
                > > exe 'normal! copen<cr>"
                > >
                > >
                >
                > This should NOT work. This should beep at you and fail to do anything, because from normal mode, it will:
                >
                > c - start of the c command, to delete text and enter insert mode
                > o - invalid movement command, should ding and abort the rest of the command
                >
                > Are you sure this is what you did to get it working?
                Ben,

                You are right. It doesn't work. But it doesn't beep at me, it simply doesn't open the quickfix window. So the issue hasn't been resolved. Can anybody offer any solutions?

                Thanks.

                --
                --
                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

                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
              • Gary Johnson
                ... I think that should have worked. I grep d for a pattern, executed :copen and tried various :normal commands with , and and
                Message 7 of 10 , Mar 21, 2013
                  On 2013-03-20, FlashBurn wrote:
                  > On Tuesday, March 19, 2013 5:54:23 PM UTC-4, Christian Brabandt wrote:

                  > > You need 2 commands:
                  > >
                  > > :copen
                  > >
                  > > :norm! "\<Cr>"
                  > >
                  >
                  > I tried the following:
                  > function! CscopeFind(action, word)
                  > try
                  > exe ':cs f '.a:action.' '.a:word
                  > copen
                  > normal "\<cr>"
                  > catch
                  > echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
                  > endtry
                  > endfunction
                  >
                  > And it didn't work. I also tried normal "<cr>", normal! "\<cr>",
                  > and normal! "<cr>". None of them worked. Does anybody have any
                  > other ideas?

                  I think that should have worked.

                  I grep'd for a pattern, executed ":copen" and tried various
                  ":normal" commands with "\<CR>", "\<LF>" and "\<Enter>" and none
                  worked. I think this may be a bug.

                  However, I also skimmed quickfix.txt and found that the command
                  ".cc" should also work, and it worked for me, so try

                  .cc

                  where you now have

                  normal "\<cr>"

                  HTH,
                  Gary

                  --
                  --
                  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

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                • FlashBurn
                  ... Gary it worked. But I didn t use normal .cc , I simply used cc instead. Here is how it looks function! CscopeFind(action, word) try exe :cs f
                  Message 8 of 10 , Mar 21, 2013
                    On Thursday, March 21, 2013 1:24:12 PM UTC-4, Gary Johnson wrote:
                    > On 2013-03-20, FlashBurn wrote:
                    >
                    > > On Tuesday, March 19, 2013 5:54:23 PM UTC-4, Christian Brabandt wrote:
                    >
                    >
                    >
                    > > > You need 2 commands:
                    >
                    > > >
                    >
                    > > > :copen
                    >
                    > > >
                    >
                    > > > :norm! "\<Cr>"
                    >
                    > > >
                    >
                    > >
                    >
                    > > I tried the following:
                    >
                    > > function! CscopeFind(action, word)
                    >
                    > > try
                    >
                    > > exe ':cs f '.a:action.' '.a:word
                    >
                    > > copen
                    >
                    > > normal "\<cr>"
                    >
                    > > catch
                    >
                    > > echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
                    >
                    > > endtry
                    >
                    > > endfunction
                    >
                    > >
                    >
                    > > And it didn't work. I also tried normal "<cr>", normal! "\<cr>",
                    >
                    > > and normal! "<cr>". None of them worked. Does anybody have any
                    >
                    > > other ideas?
                    >
                    >
                    >
                    > I think that should have worked.
                    >
                    >
                    >
                    > I grep'd for a pattern, executed ":copen" and tried various
                    >
                    > ":normal" commands with "\<CR>", "\<LF>" and "\<Enter>" and none
                    >
                    > worked. I think this may be a bug.
                    >
                    >
                    >
                    > However, I also skimmed quickfix.txt and found that the command
                    >
                    > ".cc" should also work, and it worked for me, so try
                    >
                    >
                    >
                    > .cc
                    >
                    >
                    >
                    > where you now have
                    >
                    >
                    >
                    > normal "\<cr>"
                    >
                    >
                    >
                    > HTH,
                    >
                    > Gary

                    Gary it worked. But I didn't use normal ".cc", I simply used cc instead.
                    Here is how it looks

                    function! CscopeFind(action, word)
                    try
                    exe ':cs f '.a:action.' '.a:word
                    copen
                    cc
                    catch
                    echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None

                    I'm also wondering if the dot (.) in front of a cc in your response is a type, or Vim has special meaning for it

                    --
                    --
                    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

                    ---
                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                  • Gary Johnson
                    ... Right. That s why I wrote it out as I did. I didn t write normal .cc I wrote .cc ... To be honest, I don t know why the . is needed either, but
                    Message 9 of 10 , Mar 21, 2013
                      On 2013-03-21, FlashBurn wrote:
                      > On Thursday, March 21, 2013 1:24:12 PM UTC-4, Gary Johnson wrote:

                      > > However, I also skimmed quickfix.txt and found that the command
                      > > ".cc" should also work, and it worked for me, so try
                      > >
                      > > .cc
                      > >
                      > > where you now have
                      > >
                      > > normal "\<cr>"

                      > Gary it worked. But I didn't use normal ".cc", I simply used cc
                      > instead.

                      Right. That's why I wrote it out as I did. I didn't write

                      normal ".cc"

                      I wrote

                      .cc

                      > Here is how it looks
                      >
                      > function! CscopeFind(action, word)
                      > try
                      > exe ':cs f '.a:action.' '.a:word
                      > copen
                      > cc
                      > catch
                      > echohl WarningMsg | echo 'Can not find '.a:word.' with querytype as '.a:action.'.' | echohl None
                      >
                      > I'm also wondering if the dot (.) in front of a cc in your
                      > response is a type, or Vim has special meaning for it

                      To be honest, I don't know why the . is needed either, but
                      paragraph in quickfix.txt (beginning at line 353) began

                      In the quickfix window, each line is one error. The line number
                      is equal to the error number. You can use ":.cc" to jump to the
                      error under the cursor.

                      so that's what I tried, it worked, and so that's what I suggested to
                      you.

                      Regards,
                      Gary

                      --
                      --
                      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

                      ---
                      You received this message because you are subscribed to the Google Groups "vim_use" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                      For more options, visit https://groups.google.com/groups/opt_out.
                    • Christian Brabandt
                      Hi Gary! ... No, actually, this was an error on my side. normal doesn t understand the -notation: ,----[ :h exe ]- ... `---- Mit freundlichen Grüßen
                      Message 10 of 10 , Mar 21, 2013
                        Hi Gary!

                        On Do, 21 Mär 2013, Gary Johnson wrote:

                        > > And it didn't work. I also tried normal "<cr>", normal! "\<cr>",
                        > > and normal! "<cr>". None of them worked. Does anybody have any
                        > > other ideas?
                        >
                        > I think that should have worked.
                        >
                        > I grep'd for a pattern, executed ":copen" and tried various
                        > ":normal" commands with "\<CR>", "\<LF>" and "\<Enter>" and none
                        > worked. I think this may be a bug.

                        No, actually, this was an error on my side. normal doesn't understand
                        the <key>-notation:

                        ,----[ :h exe ]-
                        | ":execute" is also a nice way to avoid having to type
                        | control characters in a Vim script for a ":normal"
                        | command: >
                        | :execute "normal ixxx\<Esc>"
                        | This has an <Esc> character, see |expr-string|.
                        `----


                        Mit freundlichen Grüßen
                        Christian
                        --
                        Humor hat viel mit Verstand zu tun.
                        -- Helmut Dietl

                        --
                        --
                        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

                        ---
                        You received this message because you are subscribed to the Google Groups "vim_use" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                        For more options, visit https://groups.google.com/groups/opt_out.
                      Your message has been successfully submitted and would be delivered to recipients shortly.