├── Makefile ├── README ├── build_vim └── plugin └── hier.vim /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 | -------------------------------------------------------------------------------- /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 | ============================================================================== 53 | INSTALLATION *hier-installation* 54 | 55 | 1. Download hier.vba.gz 56 | 2. Open file in vim and run :so % to install plugin 57 | 3. Restart vim 58 | 59 | ============================================================================== 60 | RELATED PLUGINS *hier-related* 61 | 62 | - editqf is a plugin that let's you edit and add entries in quickfix window. 63 | The hier plugin is a useful extension to the editqf plugin 64 | (http://www.vim.org/scripts/script.php?script_id=3557) 65 | 66 | - quickfixsigns is a plugin similar to hier. The main difference is that it 67 | highlights the quickfix locations in a separate column. quickfixsigns also 68 | support the highlighting of marks which is not in the focus of hier. 69 | (http://www.vim.org/scripts/script.php?script_id=2584) 70 | 71 | ============================================================================== 72 | CHANGLOG *hier-changelog* 73 | 74 | 1.3 75 | - fix problem when disabling the highlighting by setting the 76 | hier_highlight_group variables to the empty string "" 77 | 78 | 1.2 79 | - add highlighting groups for warning and info entries 80 | - make clearing of highlighting behave more graceful towards other 81 | plugins 82 | - add function s:Getlist to remove duplicated code 83 | 84 | 1.1 85 | - add commands :HierStart and :HierStop 86 | - add support for highlighting location list entries 87 | - add support for highlighting pattern entries 88 | 89 | 1.0 90 | - inital release 91 | 92 | vim:tw=78:ts=8:ft=help:norl: 93 | -------------------------------------------------------------------------------- /build_vim: -------------------------------------------------------------------------------- 1 | :let g:vimball_home = "." 2 | :e files 3 | :execute '%MkVimball!' . g:plugin_name 4 | :q! 5 | -------------------------------------------------------------------------------- /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_highlight_group_qf = ! exists('g:hier_highlight_group_qf') ? 'SpellBad' : g:hier_highlight_group_qf 14 | let g:hier_highlight_group_qfw = ! exists('g:hier_highlight_group_qfw') ? 'SpellLocal' : g:hier_highlight_group_qfw 15 | let g:hier_highlight_group_qfi = ! exists('g:hier_highlight_group_qfi') ? 'SpellRare' : g:hier_highlight_group_qfi 16 | 17 | let g:hier_highlight_group_loc = ! exists('g:hier_highlight_group_loc') ? 'SpellBad' : g:hier_highlight_group_loc 18 | let g:hier_highlight_group_locw = ! exists('g:hier_highlight_group_locw') ? 'SpellLocal' : g:hier_highlight_group_locw 19 | let g:hier_highlight_group_loci = ! exists('g:hier_highlight_group_loci') ? 'SpellRare' : g:hier_highlight_group_loci 20 | 21 | if eval('g:hier_highlight_group_qf') != '' 22 | exec "hi! link QFError ".g:hier_highlight_group_qf 23 | endif 24 | if eval('g:hier_highlight_group_qfw') != '' 25 | exec "hi! link QFWarning ".g:hier_highlight_group_qfw 26 | endif 27 | if eval('g:hier_highlight_group_qfi') != '' 28 | exec "hi! link QFInfo ".g:hier_highlight_group_qfi 29 | endif 30 | 31 | if eval('g:hier_highlight_group_loc') != '' 32 | exec "hi! link LocError ".g:hier_highlight_group_loc 33 | endif 34 | if eval('g:hier_highlight_group_locw') != '' 35 | exec "hi! link LocWarning ".g:hier_highlight_group_locw 36 | endif 37 | if eval('g:hier_highlight_group_loci') != '' 38 | exec "hi! link LocInfo ".g:hier_highlight_group_loci 39 | endif 40 | 41 | function! s:Getlist(winnr, type) 42 | if a:type == 'qf' 43 | return getqflist() 44 | else 45 | return getloclist(a:winnr) 46 | endif 47 | endfunction 48 | 49 | function! s:Hier(clearonly) 50 | for m in getmatches() 51 | for h in ['QFError', 'QFWarning', 'QFInfo', 'LocError', 'LocWarning', 'LocInfo'] 52 | if m.group == h 53 | call matchdelete(m.id) 54 | endif 55 | endfor 56 | endfor 57 | 58 | if g:hier_enabled == 0 || a:clearonly == 1 59 | return 60 | endif 61 | 62 | let bufnr = bufnr('%') 63 | 64 | for type in ['qf', 'loc'] 65 | for i in s:Getlist(0, type) 66 | if i.bufnr == bufnr 67 | let hi_group = 'QFError' 68 | if i.type == 'I' || i.type == 'info' 69 | let hi_group = 'QFInfo' 70 | elseif i.type == 'W' || i.type == 'warning' 71 | let hi_group = 'QFWarning' 72 | elseif eval('g:hier_highlight_group_'.type) == "" 73 | continue 74 | endif 75 | 76 | if i.lnum > 0 77 | call matchadd(hi_group, '\%'.i.lnum.'l') 78 | elseif i.pattern != '' 79 | call matchadd(hi_group, i.pattern) 80 | endif 81 | endif 82 | endfor 83 | endfor 84 | endfunction 85 | 86 | command! -nargs=0 HierUpdate call s:Hier(0) 87 | command! -nargs=0 HierClear call s:Hier(1) 88 | 89 | command! -nargs=0 HierStart let g:hier_enabled = 1 | HierUpdate 90 | command! -nargs=0 HierStop let g:hier_enabled = 0 | HierClear 91 | 92 | augroup Hier 93 | au! 94 | au QuickFixCmdPost,BufEnter,WinEnter * :HierUpdate 95 | augroup END 96 | --------------------------------------------------------------------------------