From d543bf4e189f44d950c093524e1c414552cc2103 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Fri, 28 Feb 2020 22:00:20 +0100 Subject: [PATCH] Add ingo#window#quickfix#GetOtherList() variant of ingo#window#quickfix#GetList() that gets the quickfixType passed in --- README.md | 2 ++ autoload/ingo/window/quickfix.vim | 24 +++++++++++++++++++++++- doc/ingo-library.txt | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 147ecd0..21fe953 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,8 @@ HISTORY - ingo#selection#Get{In,Ex}clusiveEndPos(): Prevent "E951: \\% value too large" by checking line length. This condition typically happens with a linewise selection (where the column is 2147483647). +- Add ingo#window#quickfix#GetOtherList() variant of + ingo#window#quickfix#GetList() that gets the quickfixType passed in. ##### 1.040 31-Oct-2019 - Add ingo#str#TrimTrailing() variant of ingo#str#Trim(). diff --git a/autoload/ingo/window/quickfix.vim b/autoload/ingo/window/quickfix.vim index 42819fd..8f0258a 100644 --- a/autoload/ingo/window/quickfix.vim +++ b/autoload/ingo/window/quickfix.vim @@ -2,7 +2,7 @@ " " DEPENDENCIES: " -" Copyright: (C) 2010-2019 Ingo Karkat +" Copyright: (C) 2010-2020 Ingo Karkat " The VIM LICENSE applies to this script; see ':help copyright'. " " Maintainer: Ingo Karkat @@ -93,6 +93,28 @@ function! ingo#window#quickfix#GetList() throw 'ASSERT: Invalid quickfix type: ' . l:quickfixType endif endfunction +function! ingo#window#quickfix#GetOtherList( quickfixType ) abort +"****************************************************************************** +"* PURPOSE: +" Return a list with all the quickfix / location list errors. +"* ASSUMPTIONS / PRECONDITIONS: +" None. +"* EFFECTS / POSTCONDITIONS: +" None. +"* INPUTS: +" a:quickfixType 1 for quickfix window, 2 for the current window's location +" list. N + 2 for window N's location list +"* RETURN VALUES: +" List. +"****************************************************************************** + if a:quickfixType == 1 + return getqflist() + elseif a:quickfixType >= 2 + return getloclist(a:quickfixType - 2) + else + throw 'ASSERT: Invalid quickfix type: ' . a:quickfixType + endif +endfunction function! ingo#window#quickfix#SetList( ... ) "****************************************************************************** "* PURPOSE: diff --git a/doc/ingo-library.txt b/doc/ingo-library.txt index 60085f4..5c2bc6e 100644 --- a/doc/ingo-library.txt +++ b/doc/ingo-library.txt @@ -168,6 +168,8 @@ HISTORY *ingo-library-history* - ingo#selection#Get{In,Ex}clusiveEndPos(): Prevent "E951: \% value too large" by checking line length. This condition typically happens with a linewise selection (where the column is 2147483647). +- Add ingo#window#quickfix#GetOtherList() variant of + ingo#window#quickfix#GetList() that gets the quickfixType passed in. 1.040 31-Oct-2019 - Add ingo#str#TrimTrailing() variant of ingo#str#Trim().