vim: Add rust setup
This commit is contained in:
54
vim/vimrc
54
vim/vimrc
@@ -73,7 +73,17 @@ Plug 'evanleck/vim-svelte', {'branch': 'main'}
|
|||||||
|
|
||||||
Plug 'cespare/vim-toml', { 'branch': 'main' }
|
Plug 'cespare/vim-toml', { 'branch': 'main' }
|
||||||
|
|
||||||
Plug 'rust-lang/rust.vim'
|
"Plug 'rust-lang/rust.vim'
|
||||||
|
|
||||||
|
" Plug 'autozimu/LanguageClient-neovim', {
|
||||||
|
" \ 'branch': 'next',
|
||||||
|
" \ 'do': 'bash install.sh',
|
||||||
|
" \ }
|
||||||
|
|
||||||
|
Plug 'neovim/nvim-lspconfig'
|
||||||
|
Plug 'simrat39/rust-tools.nvim'
|
||||||
|
|
||||||
|
"Plug 'dense-analysis/ale'
|
||||||
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
@@ -360,3 +370,45 @@ let g:go_info_mode='gopls'
|
|||||||
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
|
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>
|
||||||
|
|
||||||
let g:rustfmt_autosave = 1
|
let g:rustfmt_autosave = 1
|
||||||
|
|
||||||
|
let g:LanguageClient_serverCommands = {
|
||||||
|
\ 'rust': ['rust-analyzer'],
|
||||||
|
\ }
|
||||||
|
|
||||||
|
" let g:ale_linters = {'rust': ['analyzer']}
|
||||||
|
|
||||||
|
lua <<EOF
|
||||||
|
local nvim_lsp = require'lspconfig'
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
tools = { -- rust-tools options
|
||||||
|
autoSetHints = true,
|
||||||
|
hover_with_actions = true,
|
||||||
|
inlay_hints = {
|
||||||
|
show_parameter_hints = false,
|
||||||
|
parameter_hints_prefix = "",
|
||||||
|
other_hints_prefix = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- all the opts to send to nvim-lspconfig
|
||||||
|
-- these override the defaults set by rust-tools.nvim
|
||||||
|
-- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
|
||||||
|
server = {
|
||||||
|
-- on_attach is a callback called when the language server attachs to the buffer
|
||||||
|
-- on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
-- to enable rust-analyzer settings visit:
|
||||||
|
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
-- enable clippy on save
|
||||||
|
checkOnSave = {
|
||||||
|
command = "clippy"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('rust-tools').setup(opts)
|
||||||
|
EOF
|
||||||
|
|||||||
Reference in New Issue
Block a user