Skip to content

Instantly share code, notes, and snippets.

@barrbrain
Created October 27, 2023 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barrbrain/96edd16b00a00f3d4c1e5c4cbf7e7f97 to your computer and use it in GitHub Desktop.
Save barrbrain/96edd16b00a00f3d4c1e5c4cbf7e7f97 to your computer and use it in GitHub Desktop.
call plug#begin('~/.local/share/nvim/plugged')
Plug 'rust-lang/rust.vim'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
"Plug 'vim-denops/denops.vim'
"Plug 'vim-denops/denops-helloworld.vim'
Plug 'Shougo/ddu.vim'
Plug 'Shougo/ddu-ui-ff'
Plug 'Shougo/ddu-kind-file'
Plug 'Shougo/ddu-filter-matcher_substring'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/echodoc.vim'
call plug#end()
autocmd BufReadPost *.rs setlocal filetype=rust
autocmd BufReadPost *.js setlocal filetype=javascript
autocmd BufReadPost *.py setlocal filetype=python
" Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['/home/barrbrain/.rustup/toolchains/nightly-aarch64-unknown-linux-musl/bin/rust-analyzer'],
\ 'javascript': ['typescript-language-server', '--stdio'],
\ 'python': ['pyls'],
\ }
" You must set the default ui.
" Note: ff ui
" https://github.com/Shougo/ddu-ui-ff
call ddu#custom#patch_global({
\ 'ui': 'ff',
\ })
" You must set the default action.
" Note: file kind
" https://github.com/Shougo/ddu-kind-file
call ddu#custom#patch_global({
\ 'kindOptions': {
\ 'file': {
\ 'defaultAction': 'open',
\ },
\ }
\ })
" Specify matcher.
" Note: matcher_substring filter
" https://github.com/Shougo/ddu-filter-matcher_substring
call ddu#custom#patch_global({
\ 'sourceOptions': {
\ '_': {
\ 'matchers': ['matcher_substring'],
\ },
\ }
\ })
" Automatically start language servers.
let g:LanguageClient_autoStart = 1
let g:deoplete#enable_at_startup = 1
" Or, you could use neovim's floating text feature.
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'floating'
" To use a custom highlight for the float window,
" change Pmenu to your highlight group
highlight link EchoDocFloat Pmenu
" Automatically run :RustFmt when saving a buffer.
let g:rustfmt_autosave = 1
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
nnoremap <silent> cf :silent !cargo fix --lib --broken-code --allow-dirty<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment