💻

Cursor, VS Codeのおすすめ設定

2025/02/18に公開

エディター"Cursor"のおすすめ設定(&個人的な好み)です。
元はVSCodeの設定で、Cursorインストール時にそのまま引き継いでますので共通で使用できます。

Cursorをインストール&初期設定

公式サイトダウンロードからインストールできます。
Homebrew経由でのインストール手順は1・2を参照↓

  1. ターミナルでコマンドbrew install --cask cursorを実行
  2. cursor was successfully installed!メッセージが表示されインストールできたら、Cursorを起動する
  3. 初期設定を行う(お好みで)
    • Keyword → DefaultはVSCode
    • Language for AI → 日本語
    • Codebase-wide → Enabled
    • Add Terminal Command → Install "cursor"を選択
      ※ターミナルからCursorを起動するコマンドでcursorを使用する。
  4. VSCodeの拡張機能を引き継ぐ → Use Extensionsを選択
  5. Cursorにデータ収集させない → Privacy Modeを選択
  6. ログイン → Google / GitHubどちらかでログイン。Cursorアカウント作成も可能。
  7. VSCode設定をインポートする
    右上の歯車マークから「Cursor SettingsのGeneral > VS Code Import > Confirm」をクリック

Cursorおすすめ設定

日本語化する

  1. Shift+Command(Ctrl)+Pまたはメニューバーの「View > Command Palette」でCommand Palette開く
  2. 「Configure Display Language」を検索してクリック
    ※キャプチャは既に日本語化した後なので日本語表示になってます
  3. 「日本語」を選択
  4. 再起動する

アクティビティバーをVSCodeライクにする

Cursorのアクティビティバーはデフォルトで横向き設定です。

VSCodeのように垂直にしたい場合は、

  1. メニューバーの「Cursor > 基本設定 > 設定」をクリック
  2. 「workbench.activityBar.orientation」を検索し、「Vertical」を選択

    再起動後、垂直に変更できます!

キーバインドの割り当て

VSCodeで使用していたキーバインドがCursorの割り当てと一部競合するので変更or削除しておく。

例:Shift+Command+K(行を削除)をCursorに適用

  1. Command(Ctrl)+R, Command(Ctrl)+Sまたはアクティビティバーの歯車マークから「キーボードショートカット」をクリック
  2. キーを入力して一覧から検索(例:shift cmd k)
  3. 競合しているコマンドに異なるキーバインドを指定するか、右クリックで「キーバインドの削除」を選択

AIの返信を日本語化する

右上の歯車マークから「Cursor SettingsのGeneral > Rules for AI > Always respond in 日本語」に設定。

プライバシー設定

インストール時に初期設定でPrivacy Modeを選択している場合は不要ですが、もし設定していなければここから行います。
右上の歯車マークから「Cursor SettingsのGeneral > Privacy mode > enabled」に設定。

AI Models

デフォルトでclaude-3.5-sonnetやgpt-4oなどにチェックが入っているので、自分が使用するものに切り替えます。

モデルの違い

使用料金がモデルによって異なります↓
https://docs.cursor.com/settings/models

主要モデルの特徴はこちら↓

Cursor,VSCode共通おすすめ設定

ここからVSCodeと共通設定です。

カラーテーマ

VSCodeではDefault Dark Modern(ダークモダン)を設定

Cursorはデフォルト配色Anysphere Darkが結構良いなと思いそのままにしましたが、VSCodeと同じカラーテーマも選べます。

ステータスバーの配色

下部のステータスバーの色をカスタマイズ

settings.json
{
    "workbench.colorCustomizations": {
        "statusBar.background": "#53208c"
    },
}

アクティブタブの配色

アクティブなタブの視認性を良くするために、背景色と文字色をカスタマイズ

settings.json
{
    "workbench.colorCustomizations": {
        "tab.activeBackground": "#7442ad",
        "tab.activeForeground": "#d3d2d4",
    },
}

インデントの配色

現在は拡張機能indent-rainbow無しで配色設定できるとのことで、適当な色を設定。
acriveBackgroundはカーソルがあたりアクティブな範囲に適用するカラーです。

settings.json
{
    "workbench.colorCustomizations": {
        "editorIndentGuide.background1": "#cb997e",
        "editorIndentGuide.background2": "#ddbea9",
        "editorIndentGuide.background3": "#ffe8d6",
        "editorIndentGuide.background4": "#b7b7a4",
        "editorIndentGuide.background5": "#a5a58d",
        "editorIndentGuide.background6": "#6b705c",
        "editorIndentGuide.activeBackground1": "#06d6a0",
        "editorIndentGuide.activeBackground2": "#06d6a0",
        "editorIndentGuide.activeBackground3": "#06d6a0",
        "editorIndentGuide.activeBackground4": "#06d6a0",
        "editorIndentGuide.activeBackground5": "#06d6a0",
        "editorIndentGuide.activeBackground6": "#06d6a0",
    },
}

フォント

PlemolJPHackGenを使っています。見た目はこんな感じ↓

PlemolJP

https://github.com/yuru7/PlemolJP

settings.json
{
    "editor.fontFamily": "PlemolJP35 Console NF, monospace",
}

HackGen

https://github.com/yuru7/HackGen

settings.json
{
    "editor.fontFamily": "HackGen35 Console NF",
}

アイコン

Material Iconを指定。各ファイルのアイコンが分かりやすくなります。

settings.json
{
    "workbench.iconTheme": "material-icon-theme",
}

フォーマッター

Prettierpackageをインストールしコマンドでのコード整形も行いますが、拡張機能Prettier - Code formatterも併用。保存時に自動でフォーマットされるようformatOnSaveもtrueにしています。
settings.jsonには言語ごとにフォーマッターを指定するか、フォーマット除外指定しておく。

settings.json
{
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.formatOnSave": true,
}
settings.json
{
// markdownはフォーマットさせない
    "[markdown]": {
        "editor.formatOnSave": false
    },
    "editor.defaultFormatter": "esbenp.prettier-vscode",
    "editor.formatOnSave": true,
}

その他もろもろ設定

その他の設定も含め、全体のsettings.jsonです。

{
// ファイルアイコンテーマを設定
    "workbench.iconTheme": "material-icon-theme",
// 新規ウィンドウを最後に開いたウィンドウと同じサイズで開く
    "window.newWindowDimensions": "inherit",
// タブ幅指定
    "editor.tabSize": 2,
// カーソル移動の動きを滑らかなアニメーションにする
    "editor.cursorSmoothCaretAnimation": "on",
// フォント指定
    "editor.fontFamily": "PlemolJP35 Console NF, monospace",
// テキストを折り返して表示する
    "editor.wordWrap": "on",
// フォントサイズ指定
    "editor.fontSize": 14,
// 入力中にクイックサジェストを表示する(コメント、文字列リテラル内)
    "editor.quickSuggestions": {
        "comments": "on",
        "strings": "on"
    },
// スニペット接頭辞を入力し、tabキーで挿入する
    "editor.tabCompletion": "on",
// エメットをtabキーで展開する
    "emmet.triggerExpansionOnTab": true,
// ファイルツリーのインデント幅を指定
    "workbench.tree.indent": 16,
// 保存時に自動整形する
    "editor.formatOnSave": true,
// ファイル拡張子を言語に関連付ける
    "files.associations": {
        "*.tsx": "typescriptreact"
    },
// デフォルトフォーマッター指定
    "[html]": {
        "editor.defaultFormatter": "vscode.html-language-features"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
// 数字や文字列、関数などのカラー設定が可能。ここではコメントのテキストカラーを指定。
    "editor.tokenColorCustomizations": {
        "comments": "#c0c0c0"
    },
// 空白文字を可視化。none, all, boundary:単語間の単一スペースは可視化しない。
    "editor.renderWhitespace": "boundary",
// インデント、アクティブタブ、ステータスバーのカラー指定
    "workbench.colorCustomizations": {
        "editorIndentGuide.background1": "#cb997e",
        "editorIndentGuide.background2": "#ddbea9",
        "editorIndentGuide.background3": "#ffe8d6",
        "editorIndentGuide.background4": "#b7b7a4",
        "editorIndentGuide.background5": "#a5a58d",
        "editorIndentGuide.background6": "#6b705c",
        "editorIndentGuide.activeBackground1": "#06d6a0",
        "editorIndentGuide.activeBackground2": "#06d6a0",
        "editorIndentGuide.activeBackground3": "#06d6a0",
        "editorIndentGuide.activeBackground4": "#06d6a0",
        "editorIndentGuide.activeBackground5": "#06d6a0",
        "editorIndentGuide.activeBackground6": "#06d6a0",
        "tab.activeBackground": "#7442ad",
        "tab.activeForeground": "#d3d2d4",
        "statusBar.background": "#53208c"
    },
// Cursorのアクティビティバーの向きを垂直にする
    "workbench.activityBar.orientation": "vertical",
// minimapを表示
    "editor.minimap.enabled": true
}

参考URL

https://zenn.dev/chot/articles/ae03134c3b9c12
https://zenn.dev/gamuprog/articles/53e7adee04b337
https://qiita.com/k1mu0419/items/2d903660d1f571abb8f2
https://qiita.com/htcd/items/21266f6472ac2c39933e

Discussion