0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Windows 版 ClaudeCode のエディターとして SublimeText を使う

0
Posted at

Windows 版の ClaudeCode で Ctrl+G で起動するエディタがメモ帳で使いにくい…そんな暗い気持ちになったことはありますか?
僕はずっと思ってましたが、めんどくさい気持ちが高まりすぎて今までメモ帳で頑張ってました。
でも、もうそんな日々とはさよならです。ここでは Windows 版 ClaudeCode のエディターとして SublimeText を使う方法を解説します。

結論

1. Sublime Text を PATH に追加

Win + R → sysdm.cpl → 詳細設定 → 環境変数 → ユーザーの Path を編集 → 以下を追加:

C:\Program Files\Sublime Text

2. EDITOR 環境変数を追加

同じ「環境変数」画面で「新規」をクリックし:

  • 変数名:EDITOR
  • 変数値:subl(フルパス不要・--wait 不要)

または、 C:\Users<ユーザー>.claude\setting.json を編集する

{
  "env": {
    "EDITOR": "subl",
    "VISUAL": "subl"
  },
  "model": "sonnet",
  "autoUpdatesChannel": "latest"
}

調査

最初は EDITOR 環境変数に C:\Program Files\Sublime Text\subl.exe --wait と書いてみて、ダメでした。
なんでやねん、というコトで調べた結果 ClaudeCode の npm パッケージの中に以下の様なコードを見付けました。

// エディタ決定ロジック (cli.js)
VR = () => {
  if (process.env.VISUAL?.trim()) return process.env.VISUAL.trim();
  if (process.env.EDITOR?.trim()) return process.env.EDITOR.trim();
  if (process.platform === "win32") return "start /wait notepad";  // Windowsデフォルト
  return ["code", "vi", "nano"].find(...);
}

// 内蔵エイリアス (subl は自動的に --wait 付きに変換される!)
const editorAliases = { code: "code -w", subl: "subl --wait" }

// 実行コマンド (A = 一時ファイルのパス)
execSync(`${editorAliases[EDITOR] ?? EDITOR} "${A}"`, { stdio: "inherit" })

つまり subl にパスさえ通っておけば subl で SublimeText が起動します。
メモ帳は start /wait notepad で起動されているので、他のエディタ (秀丸など) も start /wait を付ければ起動できるかもしれません。

0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?