summaryrefslogtreecommitdiff
path: root/.vim/test.vim
blob: 823f08c5d5da0c849d58141e6b5ea7197bbebe6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
" To use, save this file and type ":so %"
" Optional: First enter ":let g:rgb_fg=1" to highlight foreground only.
" Restore normal highlighting by typing ":call clearmatches()"
"
" Create a new scratch buffer:
" - Read file $VIMRUNTIME/rgb.txt
" - Delete lines where color name is not a single word (duplicates).
" - Delete "grey" lines (duplicate "gray"; there are a few more "gray").
" Add matches so each color name is highlighted in its color.
call clearmatches()
new
setlocal buftype=nofile bufhidden=hide noswapfile
0read rgb.txt
let find_color = '^\s*\(\d\+\s*\)\{3}\zs\w*$'
silent execute 'v/'.find_color.'/d'
silent g/grey/d
let namedcolors=[]
1
while search(find_color, 'W') > 0
    let w = expand('<cword>')
    call add(namedcolors, w)
endwhile

for w in namedcolors
    execute 'hi col_'.w.' guifg=black guibg='.w
    execute 'hi col_'.w.'_fg guifg='.w.' guibg=NONE'
    execute '%s/\<'.w.'\>/'.printf("%-36s%s", w, w).'/g'

    call matchadd('col_'.w, '\<'.w.'\>', -1)
    " determine second string by that with large # of spaces before it
    call matchadd('col_'.w.'_fg', ' \{10,}\<'.w.'\>', -1)
endfor
1
nohlsearch
+99 2006-12-11Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli4-28/+29 2006-12-11Avoid infinite loops in caching layerLars Hjemli3-14/+31 2006-12-11Let 'make install' clear all cachefilesLars Hjemli1-0/+2 2006-12-11Fix cache algorithm loopholeLars Hjemli3-11/+16 2006-12-10Add version identifier in generated filesLars Hjemli2-9/+14 2006-12-10Add license file and copyright noticesLars Hjemli5-0/+372 2006-12-10Add caching infrastructureLars Hjemli9-28/+353