├── Makefile ├── plugin └── hier.vim └── README /Makefile: -------------------------------------------------------------------------------- 1 | PLUGIN = hier 2 | 3 | all: clean vba 4 | 5 | ${PLUGIN}.vba: README plugin/${PLUGIN}.vim 6 | mkdir -p doc 7 | cp README doc/${PLUGIN}.txt 8 | find doc plugin -type f | sed -e 's/^\.\/// '> files 9 | vim --cmd 'let g:plugin_name="${PLUGIN}"' -s build_vim 10 | 11 | vba: ${PLUGIN}.vba 12 | 13 | ${PLUGIN}.vba.gz: ${PLUGIN}.vba 14 | gzip $< 15 | 16 | vba.gz: ${PLUGIN}.vba.gz 17 | 18 | clean: 19 | @rm -rf ${PLUGIN}.vba ${PLUGIN}.vba.gz doc files 20 | 21 | .PHONY: all clean vba vba.gz 22 | -------------------------------------------------------------------------------- /plugin/hier.vim: -------------------------------------------------------------------------------- 1 | " hier.vim: Highlight quickfix errors 2 | " Last Modified: Tue 03. May 2011 10:55:27 +0900 JST 3 | " Author: Jan Christoph Ebersbach 4 | " Version: 1.3 5 | 6 | if (exists("g:loaded_hier") && g:loaded_hier) || &cp 7 | finish 8 | endif 9 | let g:loaded_hier = 1 10 | 11 | let g:hier_enabled = ! exists('g:hier_enabled') ? 1 : g:hier_enabled 12 | 13 | let g:hier_multiline_inner_length = ! exists('g:hier_multiline_inner_length') ? 10000 : g:hier_multiline_inner_length 14 | 15 | let g:hier_highlight_group_qf = ! exists('g:hier_highlight_group_qf') ? 'SpellBad' : g:hier_highlight_group_qf 16 | let g:hier_highlight_group_qfw = ! exists('g:hier_highlight_group_qfw') ? 'SpellLocal' : g:hier_highlight_group_qfw 17 | let g:hier_highlight_group_qfi = ! exists('g:hier_highlight_group_qfi') ? 'SpellRare' : g:hier_highlight_group_qfi 18 | 19 | let g:hier_highlight_group_loc = ! exists('g:hier_highlight_group_loc') ? 'SpellBad' : g:hier_highlight_group_loc 20 | let g:hier_highlight_group_locw = ! exists('g:hier_highlight_group_locw') ? 'SpellLocal' : g:hier_highlight_group_locw 21 | let g:hier_highlight_group_loci = ! exists('g:hier_highlight_group_loci') ? 'SpellRare' : g:hier_highlight_group_loci 22 | 23 | if eval('g:hier_highlight_group_qf') != '' 24 | exec "hi! link QFError ".g:hier_highlight_group_qf 25 | endif 26 | if eval('g:hier_highlight_group_qfw') != '' 27 | exec "hi! link QFWarning ".g:hier_highlight_group_qfw 28 | endif 29 | if eval('g:hier_highlight_group_qfi') != '' 30 | exec "hi! link QFInfo ".g:hier_highlight_group_qfi 31 | endif 32 | 33 | if eval('g:hier_highlight_group_loc') != '' 34 | exec "hi! link LocError ".g:hier_highlight_group_loc 35 | endif 36 | if eval('g:hier_highlight_group_locw') != '' 37 | exec "hi! link LocWarning ".g:hier_highlight_group_locw 38 | endif 39 | if eval('g:hier_highlight_group_loci') != '' 40 | exec "hi! link LocInfo ".g:hier_highlight_group_loci 41 | endif 42 | 43 | function! s:Getlist(winnr, type) 44 | if a:type == 'qf' 45 | return getqflist() 46 | else 47 | return getloclist(a:winnr) 48 | endif 49 | endfunction 50 | 51 | function! s:Hier(clearonly) 52 | for m in getmatches() 53 | for h in ['QFError', 'QFWarning', 'QFInfo', 'LocError', 'LocWarning', 'LocInfo'] 54 | if m.group == h 55 | call matchdelete(m.id) 56 | endif 57 | endfor 58 | endfor 59 | 60 | if g:hier_enabled == 0 || a:clearonly == 1 61 | return 62 | endif 63 | 64 | let bufnr = bufnr('%') 65 | 66 | for type in ['qf', 'loc'] 67 | for i in s:Getlist(0, type) 68 | if i.bufnr == bufnr 69 | let hi_group = 'QFError' 70 | if i.type == 'I' || i.type == 'info' 71 | let hi_group = 'QFInfo' 72 | elseif i.type == 'W' || i.type == 'warning' 73 | let hi_group = 'QFWarning' 74 | elseif eval('g:hier_highlight_group_'.type) == "" 75 | continue 76 | endif 77 | 78 | if i.lnum > 0 79 | if i.col <= 0 80 | let pos = [[i.lnum]] 81 | else 82 | if i.end_lnum > 0 83 | call matchaddpos(hi_group, [[i.lnum, i.col, 1000000]]) 84 | 85 | let l = i.lnum + 1 86 | let l_max = i.end_lnum - 1 87 | while l <= l_max 88 | call matchaddpos(hi_group, [[l, 1, g:hier_multiline_inner_length]]) 89 | let l += 1 90 | endwhile 91 | 92 | call matchaddpos(hi_group, [[i.end_lnum, 1, i.end_col]]) 93 | 94 | elseif i.end_col > 0 95 | let col_len = (i.end_col - i.col) + 1 96 | call matchaddpos(hi_group, [[i.lnum, i.col, col_len]]) 97 | else 98 | call matchaddpos(hi_group, [[i.lnum, i.col]]) 99 | endif 100 | endif 101 | elseif i.pattern != '' 102 | call matchadd(hi_group, i.pattern) 103 | endif 104 | endif 105 | endfor 106 | endfor 107 | endfunction 108 | 109 | command! -nargs=0 HierUpdate call s:Hier(0) 110 | command! -nargs=0 HierClear call s:Hier(1) 111 | 112 | command! -nargs=0 HierStart let g:hier_enabled = 1 | HierUpdate 113 | command! -nargs=0 HierStop let g:hier_enabled = 0 | HierClear 114 | 115 | augroup Hier 116 | au! 117 | au QuickFixCmdPost,BufEnter,WinEnter * :HierUpdate 118 | augroup END 119 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | *hier.txt* For Vim version 7.3 Last change: 2011 August 27 2 | Copyright (c) 2011 Jan Christoph Ebersbach 3 | 4 | Hier *hier* 5 | 6 | DESCRIPTION |hier-description| 7 | USAGE |hier-usage| 8 | CUSTOMIZATION |hier-customization| 9 | INSTALLATION |hier-installation| 10 | RELATED PLUGINS |hier-related| 11 | CHANGELOG |hier-changelog| 12 | 13 | ============================================================================== 14 | DESCRIPTION *hier-description* 15 | 16 | Highlight quickfix errors and location list entries in buffer. This plugin 17 | was designed to support the editqf vim script 18 | (http://www.vim.org/scripts/script.php?script_id=3557) but it also works 19 | very well stand alone. 20 | 21 | This script can be downloaded from 22 | http://www.vim.org/scripts/script.php?script_id=3564. The latest development 23 | version is available at https://github.com/jceb/vim-hier. 24 | 25 | ============================================================================== 26 | USAGE *hier-usage* 27 | 28 | The following commands are provided: 29 | :HierStart " enable hier highlighting 30 | :HierStop " disable hier highlighting 31 | :HierUpdate " update error highlighting for current buffer 32 | :HierClear " remove highlighting - it will be displayed 33 | " again when :HierUpdate is called 34 | 35 | ============================================================================== 36 | CUSTOMIZATION *hier-customization* 37 | 38 | The highlight group can be customized by setting the following variables. 39 | Setting a variable to the string "" will disable highlighting of that 40 | group. Every type can be highlighted differently (error, warning, info): 41 | let g:hier_highlight_group_qf = 'SpellBad' 42 | let g:hier_highlight_group_qfw = 'SpellLocal' 43 | let g:hier_highlight_group_qfi = 'SpellRare' 44 | 45 | let g:hier_highlight_group_loc = 'SpellBad' 46 | let g:hier_highlight_group_locw = 'SpellLocal' 47 | let g:hier_highlight_group_loci = 'SpellRare' 48 | 49 | Enable/disable highlighting highlighting by default: 50 | let g:hier_enabled = 1 51 | 52 | For inner lines (all but the first and last one) of mutliline matches the 53 | maximum length of the highlight can be set. Defaults to 10000 (the whole 54 | line for every reasonable line of code) but a value between 2 and 5 is nice 55 | to outline the range of the issue while keeping the code readable. 56 | let g:hier_multiline_inner_length = 10000 57 | 58 | 59 | ============================================================================== 60 | INSTALLATION *hier-installation* 61 | 62 | 1. Download hier.vba.gz 63 | 2. Open file in vim and run :so % to install plugin 64 | 3. Restart vim 65 | 66 | ============================================================================== 67 | RELATED PLUGINS *hier-related* 68 | 69 | - editqf is a plugin that let's you edit and add entries in quickfix window. 70 | The hier plugin is a useful extension to the editqf plugin 71 | (http://www.vim.org/scripts/script.php?script_id=3557) 72 | 73 | - quickfixsigns is a plugin similar to hier. The main difference is that it 74 | highlights the quickfix locations in a separate column. quickfixsigns also 75 | support the highlighting of marks which is not in the focus of hier. 76 | (http://www.vim.org/scripts/script.php?script_id=2584) 77 | 78 | ============================================================================== 79 | CHANGLOG *hier-changelog* 80 | 81 | 1.3 82 | - fix problem when disabling the highlighting by setting the 83 | hier_highlight_group variables to the empty string "" 84 | 85 | 1.2 86 | - add highlighting groups for warning and info entries 87 | - make clearing of highlighting behave more graceful towards other 88 | plugins 89 | - add function s:Getlist to remove duplicated code 90 | 91 | 1.1 92 | - add commands :HierStart and :HierStop 93 | - add support for highlighting location list entries 94 | - add support for highlighting pattern entries 95 | 96 | 1.0 97 | - inital release 98 | 99 | vim:tw=78:ts=8:ft=help:norl: 100 | --------------------------------------------------------------------------------