" If you don't have a "plug-in management system of choice", I recommend
" Pathogen (https://github.com/tpope/vim-pathogen) due to its simplicity and
" robustness. Assuming that you have Pathogen installed and configured, and that
-" you want to install vim-docvim into `~/.vim/bundle`, you can do so with:
+" you want to install Pinnacle into `~/.vim/bundle`, you can do so with:
"
" ```
" git clone https://github.com/wincent/pinnacle.git ~/.vim/bundle/pinnacle
"
" Official releases are listed at:
"
-" http://www.vim.org/scripts/script.php?script_id=[TODO]
+" http://www.vim.org/scripts/script.php?script_id=5360
"
"
" # License
" - Produce the release archive:
"
" ```
-" git archive -o vim-docvim-$VERSION.zip HEAD -- .
+" git archive -o pinnacle-$VERSION.zip HEAD -- .
" ```
"
-" - Upload to http://www.vim.org/scripts/script.php?script_id=[TODO]
+" - Upload to http://www.vim.org/scripts/script.php?script_id=5360
"
"
" # Authors
"
" Pinnacle is written and maintained by Greg Hurrell <greg@hurrell.net>.
"
+" Other contributors that have submitted patches include (in alphabetical
+" order):
+"
+" - Kyle Poole
+"
"
" # History
"
+" 0.2 (9 January 2016)
+"
+" - Added `pinnacle#underline`.
+"
" ## 0.1 (30 March 2016)
"
" - Initial release.
return l:original
endfunction
+let s:prefix=has('gui') || has('termguicolors') ? 'gui' : 'cterm'
+
+function! pinnacle#extract_bg(group) abort
+ return pinnacle#extract_component(a:group, 'bg')
+endfunction
+
+function! pinnacle#extract_fg(group) abort
+ return pinnacle#extract_component(a:group, 'fg')
+endfunction
+
+function! pinnacle#extract_component(group, component) abort
+ return synIDattr(synIDtrans(hlID(a:group)), a:component, s:prefix)
+endfunction
+
+function! pinnacle#highlight(highlight) abort
+ let l:result=[]
+ if has_key(a:highlight, 'bg')
+ call insert(l:result, s:prefix . 'bg=' . a:highlight['bg'])
+ endif
+ if has_key(a:highlight, 'fg')
+ call insert(l:result, s:prefix . 'fg=' . a:highlight['fg'])
+ endif
+ if has_key(a:highlight, 'term')
+ call insert(l:result, s:prefix . '=' . a:highlight['term'])
+ endif
+ return join(l:result, ' ')
+endfunction
+
" Returns an italicized copy of `group` suitable for passing to `:highlight`.
function! pinnacle#italicize(group) abort
return pinnacle#decorate('italic', a:group)
return pinnacle#decorate('bold', a:group)
endfunction
+" Returns an underlined copy of `group` suitable for passing to `:highlight`.
+function! pinnacle#underline(group) abort
+ return pinnacle#decorate('underline', a:group)
+endfunction
+
" Returns a copy of `group` decorated with `style` (eg. "bold", "italic" etc)
" suitable for passing to `:highlight`.
function! pinnacle#decorate(style, group) abort