Use :Javadoc for capitalized classes with K

Closes #15.
This commit is contained in:
Tim Pope 2012-12-14 19:21:42 -05:00
parent 56cd47c52e
commit 53bd402662

View File

@ -830,9 +830,19 @@ function! s:Apropos(pattern) abort
endif endif
endfunction endfunction
function! s:K()
let word = expand('<cword>')
let java_candidate = matchstr(word, '^\%(\w\+\.\)*\u\w*\ze\%(\.\|\/\w\+\)\=$')
if java_candidate !=# ''
return 'Javadoc '.java_candidate
else
return 'Doc '.word
endif
endfunction
augroup foreplay_doc augroup foreplay_doc
autocmd! autocmd!
autocmd FileType clojure nnoremap <buffer> K :Doc <C-R><C-W><CR> autocmd FileType clojure nnoremap <buffer> K :<C-R>=<SID>K()<CR><CR>
autocmd FileType clojure nnoremap <buffer> [d :Source <C-R><C-W><CR> autocmd FileType clojure nnoremap <buffer> [d :Source <C-R><C-W><CR>
autocmd FileType clojure nnoremap <buffer> ]d :Source <C-R><C-W><CR> autocmd FileType clojure nnoremap <buffer> ]d :Source <C-R><C-W><CR>
autocmd FileType clojure command! -buffer -nargs=1 Apropos :exe s:Apropos(<q-args>) autocmd FileType clojure command! -buffer -nargs=1 Apropos :exe s:Apropos(<q-args>)