MantisBT - CMake
View Issue Details
0011310CMakeCMakepublic2010-10-13 09:212011-04-04 12:00
Matthias Kretz 
Marcus D. Hanwell 
normalfeatureN/A
closedfixed 
 
CMake 2.8.4CMake 2.8.4 
0011310: vim script to open --help-command output in a split window
This is a little script to open a vertical split window with the output of cmake --help-command for the word under the cursor.

Alex suggested to post it here so that you may bundle it with the other vim scripts for cmake.
No tags attached.
? cmakehelp.vim (479) 2010-10-13 09:21
https://public.kitware.com/Bug/file/3447/cmakehelp.vim
Issue History
2010-10-13 09:21Matthias KretzNew Issue
2010-10-13 09:21Matthias KretzFile Added: cmakehelp.vim
2010-10-13 13:09Bill HoffmanStatusnew => assigned
2010-10-13 13:09Bill HoffmanAssigned To => Marcus D. Hanwell
2010-10-18 15:44Marcus D. HanwellNote Added: 0022525
2010-10-20 04:39Matthias KretzNote Added: 0022546
2010-12-09 19:11David ColeNote Added: 0023863
2010-12-09 19:12Marcus D. HanwellNote Added: 0023864
2010-12-09 19:35David ColeTarget Version => CMake 2.8.4
2010-12-10 01:43Matthias KretzNote Added: 0023866
2010-12-10 01:45Matthias KretzNote Added: 0023867
2010-12-11 12:24Marcus D. HanwellNote Added: 0023897
2010-12-11 12:24Marcus D. HanwellStatusassigned => feedback
2010-12-13 13:27Marcus D. HanwellNote Added: 0023928
2010-12-13 18:48Marcus D. HanwellStatusfeedback => assigned
2010-12-14 17:35Marcus D. HanwellNote Added: 0023986
2010-12-14 17:35Marcus D. HanwellStatusassigned => resolved
2010-12-14 17:35Marcus D. HanwellFixed in Version => CMake 2.8.4
2010-12-14 17:35Marcus D. HanwellResolutionopen => fixed
2011-04-04 12:00David ColeNote Added: 0026041
2011-04-04 12:00David ColeStatusresolved => closed

Notes
(0022525)
Marcus D. Hanwell   
2010-10-18 15:44   
Where should the file be installed, and how should I invoke it? I would like to properly test it before adding it to CMake, it sounds like a useful addition to CMake's support files.
(0022546)
Matthias Kretz   
2010-10-20 04:39   
you can put the file in ~/.vim/plugins or copy the contents to your .vimrc. Both work.

To use it press ,hc with the cursor over a cmake command.
(0023863)
David Cole   
2010-12-09 19:11   
Marcus, if you want to fix this issue, the best place to put this file in the CMake source tree is probably "CMake/Docs" alongside the existing cmake-syntax.vim file.

If you want to get this into the upcoming 2.8.4 release, just get it tested by the end of the month and let me know.
(0023864)
Marcus D. Hanwell   
2010-12-09 19:12   
Will do, I want to get this into the next release.
(0023866)
Matthias Kretz   
2010-12-10 01:43   
I fixed an issue with the script and added a line that remaps the F1 key to the cmake help if a cmake file is open. The F1 mapping is probably a bit invasive an can be disabled by commenting the last line.
(0023867)
Matthias Kretz   
2010-12-10 01:45   
File upload doesn't work (because the Mantis says the file already exists and I should delete it which I'm unable to do) so here's the updated version:

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>
(0023897)
Marcus D. Hanwell   
2010-12-11 12:24   
Looks great, tested and I think many people will find it very helpful. Matthias - what email address would you like me to use in the author line of the commit? I can't see what your registered address is, I have this locally and will stage and merge into next once you get an appropriate email address to me. Thanks.
(0023928)
Marcus D. Hanwell   
2010-12-13 13:27   
I got the details, and am merging this to next so it should be good to go into the next release.
(0023986)
Marcus D. Hanwell   
2010-12-14 17:35   
This was merged into CMake master today, and should be in the 2.8.4 release. Thank you for your contribution Matthias, it is a very useful addition for the vim users among us.
(0026041)
David Cole   
2011-04-04 12:00   
Closing resolved issues that have not been updated in more than 3 months.