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

Re: detect QuickFix window list or LocationList

Expand Messages
  • stardiviner
    Thanks to upper two guys hints. empty(getloclist(0)) is more simple. Andy Wokula, which one is for QuickFix like getloclist(0), I can not find it even I use
    Message 1 of 5 , Oct 31, 2011
    • 0 Attachment
      Thanks to upper two guys hints. empty(getloclist(0)) is more simple.

      Andy Wokula, which one is for QuickFix like getloclist(0), I can not find it even I use many times
      Tab.

      => On [2011-10-31 13:50:49 +0100]:
      Andy Wokula Said:
      > Am 31.10.2011 12:14, schrieb stardiviner:
      > >I want to bind key Alt-n/p to next/previous LocationList or next/previous QuickFix list.
      > >So I need to detect which List in current buffer. then bind Alt-n/p to them.
      > >like this.
      > > if (detect Location or QuickFix)
      > > map<A-n> :cnext<CR>
      > > map<A-n> :cprevious<CR>
      > > elseif
      > > map<A-n> :lnext<CR>
      > > map<A-n> :lprevious<CR>
      > > endif
      >
      > You could check for
      > empty(getloclist(0))
      >
      >
      > " Second approach: always do :lnext and if that fails, try :cnext
      >
      > nnoremap <A-n> :NextError<CR>
      > nnoremap <A-p> :PrevError<CR>
      >
      > com! -bar NextError call s:GoForError("next")
      > com! -bar PrevError call s:GoForError("previous")
      >
      > func! s:GoForError(partcmd)
      > try
      > try
      > exec "l". a:partcmd
      > catch /:E776:/
      > " No location list
      > exec "c". a:partcmd
      > endtry
      > catch
      > echohl ErrorMsg
      > echomsg matchstr(v:exception, ':\zs.*')
      > echohl None
      > endtry
      > endfunc
      >
      > --
      > Andy
      >
      > --
      > 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

      --
      stardiviner GPG: 5D9F64D8 Twitter: @numbchild
      http://stardiviner.dyndns-blog.com/author.html
    • Andy Wokula
      ... Hints on searching: ... the function is mentioned in the 2nd paragraph. ... - first hit -- Andy -- You received this message from the vim_use maillist.
      Message 2 of 5 , Nov 1, 2011
      • 0 Attachment
        Am 01.11.2011 04:30, schrieb stardiviner:
        > Thanks to upper two guys hints. empty(getloclist(0)) is more simple.
        >
        > Andy Wokula, which one is for QuickFix like getloclist(0), I can not find it even I use many times
        > Tab.

        :h getqflist()

        Hints on searching:

        Look for general terms:
        :h quickfix
        the function is mentioned in the 2nd paragraph.

        Find functions that have to do with quickfix:
        :h eval.txt|/quickfix
        -> first hit

        --
        Andy

        --
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.