Skip to content

Commit f8ee4ce

Browse files
committed
Add bindings to K
1 parent 2d7b186 commit f8ee4ce

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

after/plugin/fireplace.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ augroup END
77

88
function! s:set_up_eval() abort
99
command! -buffer -bang -range=0 -nargs=? Eval :exe s:Eval(<bang>0, <line1>, <line2>, <count>, <q-args>)
10+
command! -buffer -bar -nargs=1 -complete=customlist,fireplace#eval_complete Doc :exe s:Doc(<q-args>)
1011

1112
nmap <buffer> cp <Plug>FireplacePrint
1213
nmap <buffer> cpp <Plug>FireplaceCountPrint
@@ -17,6 +18,8 @@ function! s:set_up_eval() abort
1718
nmap <buffer> cqp <Plug>FireplacePrompt
1819
1920
map! <buffer> <C-R>( <Plug>FireplaceRecall
21+
22+
nmap <buffer> K <Plug>FireplaceK
2023
endfunction
2124

2225
if !exists('s:qffiles')
@@ -107,3 +110,24 @@ endfunction
107110
augroup fireplace_bindings
108111
autocmd FileType hy call s:set_up_eval()
109112
augroup END
113+
114+
function! s:Doc(symbol) abort
115+
let info = fireplace#info(a:symbol)
116+
if has_key(info, 'ns') && has_key(info, 'name')
117+
echo info.ns . ' ' . info.name
118+
elseif has_key(info, "name")
119+
echo info.name
120+
endif
121+
if get(info, 'arglists-str', 'nil') !=# 'nil'
122+
echo info['arglists-str']
123+
endif
124+
if !empty(get(info, 'doc', ''))
125+
echo "\n" . info.doc
126+
endif
127+
return ''
128+
endfunction
129+
130+
function! s:K() abort
131+
let word = expand('<cword>')
132+
return 'Doc '.word
133+
endfunction

0 commit comments

Comments
 (0)