Skip to content

Instantly share code, notes, and snippets.

@totobook
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save totobook/47ab8cd0ef2386266a52 to your computer and use it in GitHub Desktop.

Select an option

Save totobook/47ab8cd0ef2386266a52 to your computer and use it in GitHub Desktop.

SublimeText3の初期設定と、Emacs風キーバインドを割り当ててMarkdownでメモ書きがやりやすいようにした

SublimeText3のダウンロード

Sublime Text - Downloadここから最新版をDLする

パッケージマネージャーインストール

"Ctrl+`"を押し、開いたウインドウに以下のURLからコピーした内容を打ち込む

Installation - Package Control

Emacsライクなキーバインドに変更

sublemacspro

"Ctrl+Shift+P"でパネルを開き、Package Controle Installを選択

sublemacsproと打ち込みインストールする

ユーザー定義キーバインドを追加

これだけではまだ少し足りないので、Preferences→Key Binding Userを開き、以下の内容を入力

[
	{ "keys": ["ctrl+i"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
	{ "keys": ["ctrl+i"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
		"context":
		[
			{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
		]
	},
	{ "keys": ["ctrl+i"], "command": "replace_completion_with_next_completion", "context":
		[
			{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
			{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
		]
	},
	{ "keys": ["ctrl+i"], "command": "reindent", "context":
		[
			{ "key": "setting.auto_indent", "operator": "equal", "operand": true },
			{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
			{ "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
			{ "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
		]
	},
	{ "keys": ["ctrl+i"], "command": "indent", "context":
		[
			{ "key": "text", "operator": "regex_contains", "operand": "\n" }
		]
	},
	{ "keys": ["ctrl+i"], "command": "next_field", "context":
		[
			{ "key": "has_next_field", "operator": "equal", "operand": true }
		]
	},
	{ "keys": ["ctrl+i"], "command": "commit_completion", "context":
		[
			{ "key": "auto_complete_visible" },
			{ "key": "setting.auto_complete_commit_on_tab" }
		]
	},
	{ "keys": ["ctrl+j"], "command": "insert", "args": {"characters": "\n"} },
	{ "keys": ["ctrl+m"], "command": "insert", "args": {"characters": "\n"} },
	{ "keys": ["ctrl+h"], "command": "left_delete" },
]

日本語入力のサポートを入れる(Windows版のみ)

Package ControlでIMESupportをインストール

Markdownビューワーを入れる

Math.js(出力したHTMLに数式を配置できる)対応のOmniMarkupPreviewerを入れる

Package Controlでインストール後、Preferncesに設定メニューが追加されるのでUserを開き

{
	"mathjax_enabled": true
}

とすれば数式が有効になる

Markdownのコード貼り付けをカラフルに

Package ControlでMarkdown Extendedをインストール後、View -> Syntax > Open all with current extension as -> Markdown Extended

とすると開くたびに自動的に反映される

基本設定

Preferences→Settings Userを開き、表示関連の設定を行う

{
	"default_encoding": "UTF-8",         // デフォルト文字コード
	"draw_white_space": "all",           // 半角スペースとタブ記号の可視化
	"font_face": "TAKAOゴシック",        // フォント指定
	"font_size": 14,                     // フォントサイズ
	"highlight_line": true,              // カーソルのある行をハイライト
	"highlight_modified_tabs": true,     // 編集が保存されてないタブのハイライト
	"rulers": [80],                      // ルーラー
	"word_wrap": true,                   // 自動折り返しON
	"ignored_packages":
	[
		"Vintage"
	],
	"show_full_path": false,             // タブにフルパスを表示しない
	"tab_size": 2,                       // タブ記号の幅を2に
	"translate_tabs_to_spaces": false,   // タブ入力を半角スペースに変換しない
	"trim_automatic_white_space": false, // 空白しかない行の空白を勝手に削除しない
}

もろもろPluginインストール

Package Controlで入れるもの一覧

  • BracketHighlighter : 対応するカッコやタグを強調表示
  • HTML5 : HTML5の補完
  • CSS Snippets:CSSの補完
  • jQuery : jQueryの補完
  • ConvertToUTF8 : UTF8以外の文字コードファイルを開いた時に文字化けしないように
  • Dracula Color Scheme : 青っぽい色設定。Preferencesで選択すれば適用される
  • DocBlockr : RDOCなどのDOC形式のコメントが書きやすくなる
  • SublimeCodeIntel : 賢い補完
  • Additional PHP Snippets : PHP補完
  • Smarty : Smaryの補完

日記用Plugin作成

SublimeTextでかんたんにタイムスタンプを挿入させる

この記事を参考にタイムスタンプが入れられるようにする

ほぼ日記として使っているメモ書き用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment