├── README.md └── plugin └── quickfixstatus.vim /README.md: -------------------------------------------------------------------------------- 1 | Quickfixstatus 2 | ================== 3 | 4 | Using Vim's quickfix windows, or location lists usually involves opening them 5 | in a separate window, and using :cnext or its equivalents to page through the 6 | messages. 7 | 8 | This plugin shows checks whether the current line in a buffer is in its local 9 | location list, the global quickfix list, or the 10 | [Syntastic](http://www.vim.org/scripts/script.php?script_id=2736) plugin's list 11 | of syntax errors. If it is, it displays the connected error message at the 12 | bottom of the screen, where command line messages are displayed. (Technically, 13 | this isn't Vim's status line, it's the command line buffer, but it's certainly 14 | where status messages often appear.) 15 | 16 | Commands: 17 | 18 | `:QuickfixStatusEnable` -- turns on the feature globally 19 | 20 | `:QuickfixStatusDisable` -- turns off the feature globally 21 | -------------------------------------------------------------------------------- /plugin/quickfixstatus.vim: -------------------------------------------------------------------------------- 1 | " Vim global plugin for showing quickfix (and location list and 2 | " Syntastic lists) in the status line. 3 | " 4 | " Maintainer: Danny O'Brien 5 | " License: Vim license 6 | " 7 | if exists("g:loaded_quickfixstatus") || &cp 8 | finish 9 | endif 10 | 11 | let g:loaded_quickfixstatus = 101 12 | let s:keepcpo = &cpo 13 | set cpo&vim 14 | 15 | function! s:Cache_Quickfix() 16 | let b:qfstatus_list = {} 17 | if exists("b:syntastic_loclist") 18 | let sy = b:syntastic_loclist 19 | else 20 | let sy = [] 21 | endif 22 | for allfixes in extend(extend(getqflist(), getloclist(0)), sy) 23 | let err = allfixes['text'] 24 | let err = strpart(substitute(err,'\n',' ','g'), 0, winwidth(0)) 25 | let b:qfstatus_list[allfixes['lnum']] = err 26 | endfor 27 | call s:Show_Quickfix_In_Status() 28 | endfunction 29 | 30 | function! s:Show_Quickfix_In_Status() 31 | if !exists("b:qfstatus_list") 32 | return 33 | endif 34 | let ln = line('.') 35 | if !has_key(b:qfstatus_list,ln) 36 | echo 37 | return 38 | else 39 | echo b:qfstatus_list[ln] 40 | endif 41 | endfunction 42 | 43 | function! s:Enable() 44 | augroup quickfixstatus 45 | au! 46 | au QuickFixCmdPost * call s:Cache_Quickfix() 47 | au CursorMoved,CursorMovedI * call s:Show_Quickfix_In_Status() 48 | augroup END 49 | call s:Cache_Quickfix() 50 | endfunction 51 | 52 | function! s:Disable() 53 | au! quickfixstatus 54 | endfunction 55 | 56 | command! -nargs=0 QuickfixStatusEnable call s:Enable() 57 | command! -nargs=0 QuickfixStatusDisable call s:Disable() 58 | 59 | call s:Enable() 60 | 61 | let &cpo= s:keepcpo 62 | unlet s:keepcpo 63 | --------------------------------------------------------------------------------