summaryrefslogtreecommitdiffstats
path: root/Auxiliary/cmake-help.vim
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-09-23 18:30:25 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-15 14:46:54 (GMT)
commitb601e2350afa89e592c4a601b08f8c74728d1ae3 (patch)
tree24db537acd620a356e1daf25d9e2d050d50f382d /Auxiliary/cmake-help.vim
parent07b80021aad97a4f4243e97576bae4670114a3ca (diff)
downloadCMake-b601e2350afa89e592c4a601b08f8c74728d1ae3.zip
CMake-b601e2350afa89e592c4a601b08f8c74728d1ae3.tar.gz
CMake-b601e2350afa89e592c4a601b08f8c74728d1ae3.tar.bz2
Rename Docs to Auxiliary
The directory contains auxiliary support files for integration with other tools, not documentation.
Diffstat (limited to 'Auxiliary/cmake-help.vim')
-rw-r--r--Auxiliary/cmake-help.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/Auxiliary/cmake-help.vim b/Auxiliary/cmake-help.vim
new file mode 100644
index 0000000..17cfa83
--- /dev/null
+++ b/Auxiliary/cmake-help.vim
@@ -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>