Skip to content

Commit

Permalink
Merge pull request #151 from flw-cn/pr/rust-doc-tab
Browse files Browse the repository at this point in the history
Add <Plug>(rust-doc-tab)
  • Loading branch information
Shougo authored Jun 18, 2020
2 parents 950b78f + 5159722 commit 250e9fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ augroup Racer
autocmd FileType rust nmap <buffer> gx <Plug>(rust-def-vertical)
autocmd FileType rust nmap <buffer> gt <Plug>(rust-def-tab)
autocmd FileType rust nmap <buffer> <leader>gd <Plug>(rust-doc)
autocmd FileType rust nmap <buffer> <leader>gD <Plug>(rust-doc-tab)
augroup END
```
8 changes: 6 additions & 2 deletions autoload/racer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function! s:RacerSplitLine(line)
return parts
endfunction

function! racer#ShowDocumentation()
function! racer#ShowDocumentation(tab)
let winview = winsaveview() " Save the current cursor position
" Move to the end of the word for the entire token to search.
" Move one char back to avoid moving to the end of the *next* word.
Expand Down Expand Up @@ -143,7 +143,11 @@ function! racer#ShowDocumentation()
" If the __doc__ buffer is open in the current tab, jump to it
silent execute (wi+1) . 'wincmd w'
else
pedit __doc__
if a:tab
tab pedit __doc__
else
pedit __doc__
endif
wincmd P
endif

Expand Down
4 changes: 3 additions & 1 deletion ftplugin/rust_racer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ nnoremap <silent><buffer> <Plug>(rust-def-vertical)
nnoremap <silent><buffer> <Plug>(rust-def-tab)
\ :tab split<CR>:call racer#GoToDefinition()<CR>
nnoremap <silent><buffer> <Plug>(rust-doc)
\ :call racer#ShowDocumentation()<CR>
\ :call racer#ShowDocumentation(0)<CR>
nnoremap <silent><buffer> <Plug>(rust-doc-tab)
\ :call racer#ShowDocumentation(1)<CR>
setlocal omnifunc=racer#RacerComplete

0 comments on commit 250e9fd

Please sign in to comment.