Merge topic 'vim-help'

ce01321 Inline help in vim with vertical split.
This commit is contained in:
Brad King 2010-12-14 14:38:52 -05:00 committed by CMake Topic Stage
commit 5eed07e2d8
1 changed files with 21 additions and 0 deletions

21
Docs/cmake-help.vim Normal file
View File

@ -0,0 +1,21 @@
nmap ,hc :call OpenCmakeHelp()<CR>
function! OpenCmakeHelp()
let s = getline( '.' )
let i = col( '.' ) - 1
while i > 0 && strpart( s, i, 1 ) =~ '[A-Za-z0-9_]'
let i = i - 1
endwhile
while i < col('$') && strpart( s, i, 1 ) !~ '[A-Za-z0-9_]'
let i = i + 1
endwhile
let start = match( s, '[A-Za-z0-9_]\+', i )
let end = matchend( s, '[A-Za-z0-9_]\+', i )
let ident = strpart( s, start, end - start )
execute "vertical new"
execute "%!cmake --help-command ".ident
set nomodified
set readonly
endfunction
autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in nmap <F1> :call OpenCmakeHelp()<CR>