diff options
author | w0rp <devw0rp@gmail.com> | 2017-08-13 13:06:22 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-08-13 13:06:22 +0100 |
commit | f67fc43d9b633db2b3d0de728bb4b9e3f9066049 (patch) | |
tree | c9cbb0a160114dd6f56dd5c92d6d540339e44c09 | |
parent | c6d11f4281e3c3090b2633e234acf437e168d415 (diff) | |
download | ale-f67fc43d9b633db2b3d0de728bb4b9e3f9066049.zip |
Simplify the loclist jumping code a little
-rw-r--r-- | autoload/ale/loclist_jumping.vim | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim index 42464525..7ed9e6ba 100644 --- a/autoload/ale/loclist_jumping.vim +++ b/autoload/ale/loclist_jumping.vim @@ -13,16 +13,13 @@ function! ale#loclist_jumping#FindNearest(direction, wrap) abort let l:buffer = bufnr('') let l:pos = getcurpos() let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []}) - " This list will have already been sorted. - let l:loclist = l:info.loclist + " Copy the list and filter to only the items in this buffer. + let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') let l:search_item = {'bufnr': l:buffer, 'lnum': l:pos[1], 'col': l:pos[2]} - " Copy the List and filter it to only items in this buffer. - let l:loclist = filter(copy(l:loclist), 'v:val.bufnr == l:buffer') - " When searching backwards, so we can find the next smallest match. if a:direction is# 'before' - let l:loclist = reverse(l:loclist) + call reverse(l:loclist) endif " Look for items before or after the current position. @@ -76,8 +73,7 @@ endfunction function! ale#loclist_jumping#JumpToIndex(index) abort let l:buffer = bufnr('') let l:info = get(g:ale_buffer_info, l:buffer, {'loclist': []}) - let l:loclist = l:info.loclist - let l:loclist = filter(copy(l:loclist), 'v:val.bufnr == l:buffer') + let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') if empty(l:loclist) return |