vim-config/after/ftplugin/rust.vim
2020-10-11 13:50:17 +02:00

54 lines
1.6 KiB
VimL

let g:rust_doc#define_map_K = 0
let g:rust_doc#downloaded_rust_doc_dir = '~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'
function! s:search_under_cursor(query) range
if a:query ==# ''
echomsg "rust-doc: No identifier is found under the cursor"
return
endif
call rust_doc#open_fuzzy(a:query)
endfunction
" keys
nnoremap <buffer><silent><F7> :<C-u>call <SID>search_under_cursor(expand('<cword>'))<CR>
vnoremap <buffer><silent><F7> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
" rusty-tags
autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw!
let g:tagbar_ctags_bin = '/usr/bin/exuberant-ctags'
" nnoremap <F3> :call LanguageClient_contextMenu()<CR>
" nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F6> :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> <F8> :call LanguageClient#textDocument_rename()<CR>
" let g:LanguageClient_autoStart = 1
" let g:LanguageClient_serverCommands = {
" \ 'rust': ['rustup', 'run', 'nightly', 'rls'] }
" let g:LanguageClient_diagnosticsEnable = 0
" let g:ale_linters = {'rust': ['rls']}
" let g:ale_fixers = { 'rust': ['rustfmt'] }
" let g:ale_fix_on_save = 0
" let g:autofmt_autosave = 0
" deoplete
" call deoplete#custom#option('sources',{
" \ '_': ['buffer'],
" \ 'rust': ['ultisnips', 'buffer', 'file', 'LanguageClient']
" \ })
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" call deoplete#enable()
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/ra_lsp_server'],
\ }