summaryrefslogtreecommitdiffstats
path: root/Docs
diff options
context:
space:
mode:
authorMatthias Kretz <kretz@kde.org>2010-12-13 18:15:43 (GMT)
committerMarcus D. Hanwell <marcus.hanwell@kitware.com>2010-12-13 18:25:27 (GMT)
commitce013215d27caebff882240968c9b0e9a6d230e2 (patch)
treedd2f2ed23adb0e128c70f5f07b8efaf3e9591397 /Docs
parentda4c2f6214e8c86c7fa2a49095e7672ea377c8c2 (diff)
downloadCMake-ce013215d27caebff882240968c9b0e9a6d230e2.zip
CMake-ce013215d27caebff882240968c9b0e9a6d230e2.tar.gz
CMake-ce013215d27caebff882240968c9b0e9a6d230e2.tar.bz2
Inline help in vim with vertical split.
Added a small script to open a vertical split window with the output of cmake --help-command for the word under the cursor.
Diffstat (limited to 'Docs')
-rw-r--r--Docs/cmake-help.vim21
1 files changed, 21 insertions, 0 deletions
diff --git a/Docs/cmake-help.vim b/Docs/cmake-help.vim
new file mode 100644
index 0000000..17cfa83
--- /dev/null
+++ b/Docs/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>