LoginSignup
4
0

More than 1 year has passed since last update.

Vim Rust を始めました

Last updated at Posted at 2022-12-07

もっといいものがあれば教えてください

とりあえずこれでやってみている.
デバッガが独立してるのがこれでいいのかがよくわかってない.

~/.vim/userautoload/dein/plugins.toml
[[plugins]]
repo = 'dense-analysis/ale'
hook_add = '''
  let g:ale_linters = {
    \ 'rust': ['analyzer', 'cargo'],
    \ }
  let g:ale_fixers = {
    \ 'rust': ['rustfmt'],
    \ }
  let g:ale_rust_analyzer_executable = $HOME . '/.local/share/vim-lsp-settings/servers/rust-analyzer/rust-analyzer'
  let g:ale_rust_cargo_use_clippy = 1
'''

[[plugins]]
repo='prabirshrestha/vim-lsp'
hook_add = '''
  let g:lsp_settings_filetype_rust = ['rust-analyzer', 'rls']
'''

[[plugins]]
repo='mattn/vim-lsp-settings'

[plugins]]
repo = 'rust-lang/rust.vim'

[[plugins]]
repo = 'puremourning/vimspector'
on_ft = ['rust']
hook_add = '''
  nnoremap <Leader>dd :call vimspector#Launch()<CR>
  nnoremap <Leader>de :call vimspector#Reset()<CR>
  nnoremap <Leader>dc :call vimspector#Continue()<CR>

  nnoremap <Leader>dt :call vimspector#ToggleBreakpoint()<CR>
  nnoremap <Leader>dT :call vimspector#ClearBreakpoints()<CR>

  nmap <Leader>dk <Plug>VimspectorRestart
  nmap <Leader>dh <Plug>VimspectorStepOut
  nmap <Leader>dl <Plug>VimspectorStepInto
  nmap <Leader>dj <Plug>VimspectorStepOver

  function! LaunchFileDebug()
    call vimspector#LaunchWithSettings({'configuration': &filetype.'_file'})
  endfunction
.vimspector.json
{
  "configurations": {
    "launch": {
      "adapter": "CodeLLDB",
      "filetypes": [ "rust" ],
      "configuration": {
        "request": "launch",
        "program": "${workspaceRoot}/target/debug/<ファイル名>"
      }
    }
  }
}

とりあえず今はこれを読んでます

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0