LoginSignup
6
3

More than 5 years have passed since last update.

[メモ]VimでGoのデバッグ環境を整える

Posted at

自分用メモ
いつの間にvimでもGoのデバッグがデキるようになったので、その環境設定メモです。

image.png

必要なもの

  • vim-go
  • delve

delveインストール

Macユーザはこれを忘れずに。

xcode-select --install
go get -u github.com/derekparker/delve/cmd/dlv

使い方

  1. :GoDebugStartでデバッグモード起動
  2. :GoDebugBreakpointでブレイクポイント設定
  3. :GoDebugContinueでブライクポイントまで実行

コマンドまとめ

コマンド 説明 キーマッピング
GoDebugStart デバッグモード開始 -
GoDebugTest テストをデバッグする -
GoDebugRestart デバッグリセット -
GoDebugBreakpoint ブレイクポイント設定 F9
GoDebugContinue ブレイクポイントまたプログラム終了するまで実行 F5
GoDebugNext ステップオーバー F10
GoDebugStep 次のステップまで実行 F11
GoDebugStepOut 関数を最後まで実行する -
GoDebugSet 変数に値をセットする、floatとintとそれらの発祥の方のみ -
GoDebugPrint カーソル上の変数の値を出力する F6

キーマッピング設定

au FileType go nmap <silent> <F12> :GoDebugStart<CR>
au FileType go nmap <silent> <F12><F12> :GoDebugStop<CR>
6
3
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
6
3