I discovered the puppet define command the other day and thought it would be useful to be able to access that from within vim so I created a little function to do it. Thought it might be useful for others so I have noted it here.
Just drop this into ~/.vim/ftplugin/puppet.vim and you should be good to go. Typing \pt ( ,puppet,type ) when over a puppet type should pop up a definition.
Edit: Now available to download from github.
" Takes some settings " g:puppet_command The location of the puppet command if !exists('g:puppet_command') let g:puppet_command = 'puppet' endif " g:puppet_doc_widown - The type of puppet doc window to open if !exists('g:puppet_doc_window') let g:puppet_doc_window = 'split' endif " " Define a puppet type function ?PuppetDefineType(fname) " Show the puppet definition of the current puppet type that the cursor is " sitting on. " Create a window with a new __doc__ buffer if bufnr("__doc__") >0 execute g:puppet_doc_window.'| b __doc__' else execute g:puppet_doc_window.' __doc__' endif " Make this buffer disposable setlocal noswapfile set buftype=nofile setlocal modifiable " Cleare the buffer normal ggdG "Read in the new description execute 'silent read !'.g:puppet_command.' describe '.fname " Go back to the top normal 1G setlocal nomodified set filetype=rst endfunction " Setup two commands to define the word under the cursor map <buffer> <leader>pt :call ?PuppetDefineType('<C-R><C-W>')<CR> map <buffer> <leader>pT :call ?PuppetDefineType('<C-R><C-A>')<CR>
Things that may improve this are the ability to run the command from anywhere in the file and have it find the nearest type and referencing local types. Let me know if you find it useful and I may ask for it to be added to Rodjek's puppet vim module