Sublime Text 2 のDefault設定ファイルを眺める
この記事ではDefault設定ファイルにどのような記述がされているか、その記述にどんな意味があるかを一つ一つ見ていきます。実際に設定をカスタマイズしてみたい方は、メニューのPreferencesタブの"Settings - User"からUser設定ファイルを開いてそこでいろいろ試してみましょう。
Sublime Text 2 のDefault設定ファイル
本文
Default設定ファイルとは、Sublime Text のデフォルトの動作の設定が記されたファイルのことです。Default設定ファイルはメニューのPreferencesタブの"Settings - Default"から開けます。
早速設定ファイルを眺めていきましょう。
設定ファイルは1個のJSONオブジェクトからなっています。このJSONオブジェクトに色々なプロパティを設定して、ひとつの設定ファイルとしているようですね。
そのJSONオブジェクトの前に、次のような但し書きがあります。
// While you can edit this file, it's best to put your changes in // "User/Preferences.sublime-settings", which overrides the settings in here. // // Settings may also be placed in file type specific options files, for // example, in Packages/Python/Python.sublime-settings for python files.
このファイルを編集することもできますが、設定の変更は"User/Preferences.sublime-settings"(いわゆるSettings-Userファイル)に書くのがベストです。そこでの設定は、このDefault設定ファイルの設定を上書きしてくれます。
ファイルタイプ毎に設定ファイルがあるかもしれません。たとえば"Packages/Python/Python.sublime-settings"はPython用の設定ファイルです。
Sublime Text の設定を変えたいときは、User設定ファイルに変更したい設定を書くようにしましょうということですね。
…それではJSONオブジェクトの中身を上から順に見ていきます。1個目のプロパティは"color_scheme"です。
color_scheme
// Sets the colors used within the text area "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
これでテキストエリアの色合いを設定しています。
font_face, font_size
// Note that the font_face and font_size are overriden in the platform // specific settings file, for example, "Preferences (Linux).sublime-settings". // Because of this, setting them here will have no effect: you must set them // in your User File Preferences. "font_face": "", "font_size": 10,
フォントの種類と、フォントのサイズです。ただし、Default設定ファイルに書かれた値はPlatform設定ファイルに上書きされるため、ここに書いても意味が無いそうです。
font_options
// Valid options are "no_bold", "no_italic", "no_antialias", "gray_antialias", // "subpixel_antialias", "no_round" (OS X only) and "directwrite" (Windows only) "font_options": [],
フォントのオプション。配列で複数指定可。太字・斜体を使わない、アンチエイリアスをかけない、などなど。
word_separators
// Characters that are considered to separate words "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",
単語の切れ目の判定。関連: Sublime Text 2でHTML要素のクラス名やIDの選択を少しだけ楽にする設定
line_number
// Set to false to prevent line numbers being drawn in the gutter "line_numbers": true,
行番号の表示。
gutter
// Set to false to hide the gutter altogether "gutter": true,
ガーターの表示。テキストエリア左側の領域のことです。
margin
// Spacing between the gutter and the text "margin": 4,
ガーターとテキストエリアの間の幅。
fold_buttons
// Fold buttons are the triangles shown in the gutter to fold regions of text "fold_buttons": true,
テキスト(関数やHTML要素)を折り畳むためのボタンの表示。
fade_fold_buttons
// Hides the fold buttons unless the mouse is over the gutter "fade_fold_buttons": true,
折り畳むボタンを隠す。ガーターにマウスポインタをかざすことで表示。
rulers
// Columns in which to display vertical rulers "rulers": [],
ルーラーの設定。[80, 120]
のように複数指定可能。
spell_check
// Set to true to turn spell checking on by default "spell_check": false,
スペルチェックを表示する。F6キーでも切り替えられますね。
tab_size
// The number of spaces a tab is considered equal to "tab_size": 4,
タブ文字の大きさ。インデントの幅の設定でもあります。
translate_tabs_to_spaces
// Set to true to insert spaces when tab is pressed "translate_tabs_to_spaces": false,
タブ文字をスペースに変換。タブキーを押した際に、タブ文字ではなくスペースが入力されるようになります。
use_tab_stops
// If translate_tabs_to_spaces is true, use_tab_stops will make tab and // backspace insert/delete up to the next tabstop "use_tab_stops": true,
タブストップ。"translate_tabs_to_spaces": true
のとき、Deleteキーを押すとtab_size
分だけスペースが削除されます。
detect_indentation
// Set to false to disable detection of tabs vs. spaces on load "detect_indentation": true,
インデントの検出。ファイルを読み込むと自動的にtranslate_tabs_to_spaces
とtab_size
を設定してくれるそうです。
auto_indent
// Calculates indentation automatically when pressing enter "auto_indent": true,
オートインデント。
smart_indent
// Makes auto indent a little smarter, e.g., by indenting the next line // after an if statement in C. Requires auto_indent to be enabled. "smart_indent": true,
スマートインデント。
indent_to_bracket
// Adds whitespace up to the first open bracket when indenting. Requires // auto_indent to be enabled. "indent_to_bracket": false,
括弧までインデント。下みたいな書き方をよくする人には便利かも。
function(100, 200, 300); array = ["foo", "bar", "bazz"];
trim_automatic_white_space
// Trims white space added by auto_indent when moving the caret off the // line. "trim_automatic_white_space": true,
オートインデントによってできた空行のインデントを取り除く。trueにすると、カーソルが空行から離れるときに、オートインデントによって挿入されたインデントが削除されます。
word_wrap
// Disables horizontal scrolling if enabled. // May be set to true, false, or "auto", where it will be disabled for source code, and otherwise enabled. "word_wrap": "auto",
テキストを折り返す。"auto"の動作: ファイルがプログラムのソースコードなら折り返さない。普通のテキストファイルなら折り返す。
wrap_width
// Set to a value other than 0 to force wrapping at that column rather than the // window width "wrap_width": 0,
どこで折り返すか。0ならウインドウの幅、それ以外ならその数値分の文字数で折り返されます。
indent_subsequent_lines
// Set to false to prevent word wrapped lines from being indented to the same // level "indent_subsequent_lines": true,
折り返し後の文頭位置。trueなら同じインデントの階層までインデントされます。
draw_centered
// Draws text centered in the window rather than left aligned "draw_centered": false,
テキストを中心寄りに置く?。
auto_match_enabled
// Controls auto pairing of quotes, brackets etc "auto_match_enabled": true,
閉じ括弧などを補完する。trueにすると、(
や"
と入力したときに自動で)
や"
が補完されます。
dictionary
// Word list to use for spell checking "dictionary": "Packages/Language - English/en_US.dic",
辞書の指定。
draw_minimap_border
// Set to true to draw a border around the visible rectangle on the minimap. // The color of the border will be determined by the "minimapBorder" key in // the color scheme "draw_minimap_border": false,
ミニマップの縁を描画する。
highlight_line
// If enabled, will highlight any line with a caret "highlight_line": true,
現在行を強調する。
caret_style
// Valid values are "smooth", "phase", "blink", "wide" and "solid". "caret_style": "smooth",
カーソルのスタイル。
match_brackets
// Set to false to disable underlining the brackets surrounding the caret "match_brackets": true,
対応する括弧にアンダーラインを引く。
match_brackets_content
// Set to false if you'd rather only highlight the brackets when the caret is // next to one "match_brackets_content": true,
括弧内での括弧の強調。falseにするとカーソル上に括弧がある場合のみ、括弧にアンダーラインを引きます。
match_brackets_square
// Set to false to not highlight square brackets. This only takes effect if // match_brackets is true "match_brackets_square": true,
対応する四角括弧[]の強調。
match_brackets_braces
// Set to false to not highlight curly brackets. This only takes effect if // match_brackets is true "match_brackets_braces": true,
対応する波括弧{}の強調。
match_brackets_angle
// Set to false to not highlight angle brackets. This only takes effect if // match_brackets is true "match_brackets_angle": false,
対応する山括弧<>の強調。
match_tags
// Enable visualization of the matching tag in HTML and XML "match_tags": true,
対応する開きタグと閉じタグの強調。
match_selection
// Highlights other occurrences of the currently selected text "match_selection": true,
同じ単語の強調。単語を選択するとそれと同じ単語が白い枠で強調されます。
line_padding_top
// Additional spacing at the top of each line, in pixels "line_padding_top": 0,
行の上側の余白。
line_padding_bottom
// Additional spacing at the bottom of each line, in pixels "line_padding_bottom": 0,
行の下側の余白。
scroll_past_end
// Set to false to disable scrolling past the end of the buffer. // On OS X, this value is overridden in the platform specific settings, so // you'll need to place this line in your user settings to override it. "scroll_past_end": true,
ファイル最終行を越えたスクロール。
move_to_limit_on_up_down
// This controls what happens when pressing up or down when on the first // or last line. // On OS X, this value is overridden in the platform specific settings, so // you'll need to place this line in your user settings to override it. "move_to_limit_on_up_down": false,
ファイル先頭行及び最終行における上下移動の振る舞い。trueにすると、例えばファイル先頭行で上キーを押すとファイル先頭行の行頭にカーソルが移動します。
draw_white_space
// Set to "none" to turn off drawing white space, "selection" to draw only the // white space within the selection, and "all" to draw all white space "draw_white_space": "selection",
スペースの描画。none:描画しない。selection:範囲選択時のみ描画。all:常に描画。
draw_indent_guides
// Set to false to turn off the indentation guides. // The color and width of the indent guides may be customized by editing // the corresponding .tmTheme file, and specifying the colors "guide", // "activeGuide" and "stackGuide" "draw_indent_guides": true,
インデントの補助線の描画。点線のやつです。
indent_guide_options
// Controls how the indent guides are drawn, valid options are // "draw_normal" and "draw_active". draw_active will draw the indent // guides containing the caret in a different color. "indent_guide_options": ["draw_normal"],
インデントの補助線のオプション。
trim_trailing_white_space_on_save
// Set to true to removing trailing white space on save "trim_trailing_white_space_on_save": false,
保存時に行末の空白を削除する。
ensure_newline_at_eof_on_save
// Set to true to ensure the last line of the file ends in a newline // character when saving "ensure_newline_at_eof_on_save": false,
ファイルの最終行が改行で終わるのを確実にする。ファイルの最終行は改行で終わるべき…
save_on_focus_lost
// Set to true to automatically save files when switching to a different file // or application "save_on_focus_lost": false,
別のタブやウィンドウにフォーカスが移ると自動で保存する。
fallback_encoding
// The encoding to use when the encoding can't be determined automatically. // ASCII, UTF-8 and UTF-16 encodings will be automatically detected. "fallback_encoding": "Western (Windows 1252)",
文字のエンコードを特定できないときに自動的に指定するエンコード。
default_encoding
// Encoding used when saving new files, and files opened with an undefined // encoding (e.g., plain ascii files). If a file is opened with a specific // encoding (either detected or given explicitly), this setting will be // ignored, and the file will be saved with the encoding it was opened // with. "default_encoding": "UTF-8",
デフォルトのエンコーディング。
enable_hexadecimal_encoding
// Files containing null bytes are opened as hexadecimal by default "enable_hexadecimal_encoding": true,
十六進のエンコーディングを有効にする?。
default_line_ending
// Determines what character(s) are used to terminate each line in new files. // Valid values are 'system' (whatever the OS uses), 'windows' (CRLF) and // 'unix' (LF only). "default_line_ending": "system",
デフォルトの改行コード。
tab_completion
// When enabled, pressing tab will insert the best matching completion. // When disabled, tab will only trigger snippets or insert a tab. // Shift+tab can be used to insert an explicit tab when tab_completion is // enabled. "tab_completion": true,
タブキーによる補完。ちなみに補完候補の選択を誤ったときは、Ctrl+Spaceで選択をやり直すことができます。
auto_complete
// Enable auto complete to be triggered automatically when typing. "auto_complete": true,
オートコンプリート。
auto_complete_size_limit
// The maximum file size where auto complete will be automatically triggered. "auto_complete_size_limit": 4194304,
補完候補が自動で表示されるファイルの最大サイズ。
auto_complete_delay
// The delay, in ms, before the auto complete window is shown after typing "auto_complete_delay": 50,
補完候補表示の遅延。
auto_complete_selector
// Controls what scopes auto complete will be triggered in "auto_complete_selector": "source - comment",
オートコンプリートの有効な場所の指定。"source"
、"text, source"
などなど。
auto_complete_triggers
// Additional situations to trigger auto complete "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ],
オートコンプリートのより詳細なシチュエーション。
auto_complete_commit_on_tab
// By default, auto complete will commit the current completion on enter. // This setting can be used to make it complete on tab instead. // Completing on tab is generally a superior option, as it removes // ambiguity between committing the completion and inserting a newline. "auto_complete_commit_on_tab": false,
補完候補の選択にタブキーのみを用いる。falseにするとエンターキーでも補完候補を選択できるようになります。trueにしておくと、改行したいのに補完選択をしてしまうということがなくなります。
auto_complete_with_fields
// Controls if auto complete is shown when snippet fields are active. // Only relevant if auto_complete_commit_on_tab is true. "auto_complete_with_fields": false,
スニペットフィールド上でもオートコンプリートを有効にする。スニペットの中にはいくつかのプレースホルダを持つものがありますが、このプレースホルダの書き換え時にもオートコンプリートを表示するかどうかという設定です。falseにしておくと、補完選択が邪魔になって次のプレースホルダに移れないということがなくなります。
shift_tab_unindent
// By default, shift+tab will only unindent if the selection spans // multiple lines. When pressing shift+tab at other times, it'll insert a // tab character - this allows tabs to be inserted when tab_completion is // enabled. Set this to true to make shift+tab always unindent, instead of // inserting tabs. "shift_tab_unindent": false,
Shit+Tabでインデントを減らす。trueにすると行のどこにいてもShit+Tabでインデントを減らすことができるようになります。
find_selected_text
// If true, the selected text will be copied into the find panel when it's // shown. // On OS X, this value is overridden in the platform specific settings, so // you'll need to place this line in your user settings to override it. "find_selected_text": true,
選択している文字を自動で検索語に指定。文字を選択している状態でCtrl+Fなどをすると、選択中の文字が自動的に検索テキストボックスにコピーされます。
drag_text
// When drag_text is enabled, clicking on selected text will begin a // drag-drop operation "drag_text": true,
テキストのドラッグ。選択しているテキストをドラッグアンドドロップできるようになります。
UI
// // User Interface Settings //
theme
// The theme controls the look of Sublime Text's UI (buttons, tabs, scroll bars, etc) "theme": "Default.sublime-theme",
テーマ。
scroll_speed
// Set to 0 to disable smooth scrolling. Set to a value between 0 and 1 to // scroll slower, or set to larger than 1 to scroll faster "scroll_speed": 1.0,
スクロールの速度。0にするとスムーズスクロールが無効になります。
tree_animation_enabled
// Controls side bar animation when expanding or collapsing folders "tree_animation_enabled": true,
フォルダツリーのアニメーション。サイドバーのフォルダの開閉やファイル追加・削除等のアニメーションのことです。
highlight_modified_tabs
// Makes tabs with modified files more visible "highlight_modified_tabs": false,
変更されたタブをさらに強調。文字色が変わるようになります。
show_tab_close_buttons
"show_tab_close_buttons": true,
タブを閉じるボタンの表示。
bold_folder_labels
// Show folders in the side bar in bold "bold_folder_labels": false,
サイドバーのフォルダ名を太字にする。
use_simple_full_screen
// OS X 10.7 only: Set to true to disable Lion style full screen support. // Sublime Text must be restarted for this to take effect. "use_simple_full_screen": false,
OS X 用の設定。Lionスタイルのフルスクリーンモードを無効にする。
overlay_scroll_bars
// Valid values are "system", "enabled" and "disabled" "overlay_scroll_bars": "system",
スクロールバーを重ねる。
アプリケーションの振る舞い
// // Application Behavior Settings //
hot_exit
// Exiting the application with hot_exit enabled will cause it to close // immediately without prompting. Unsaved modifications and open files will // be preserved and restored when next starting. // // Closing a window with an associated project will also close the window // without prompting, preserving unsaved changes in the workspace file // alongside the project. "hot_exit": true,
hot_exitの設定。hot_exitを有効にすると、アプリケーションの終了時に保存確認のダイアログなどを出さずにすぐにアプリケーションを終了します。編集中のファイルは次回起動時に復元されます。
remember_open_files
// remember_open_files makes the application start up with the last set of // open files. Changing this to false will have no effect if hot_exit is // true "remember_open_files": true,
開いていたファイルを記憶。アプリケーションの起動時に前回開いていたファイルを開きなおしてくれます。hot_exitを有効にしている場合はこの設定をfalseにしても問題ありません。
open_files_in_new_window
// OS X only: When files are opened from finder, or by dragging onto the // dock icon, this controls if a new window is created or not. "open_files_in_new_window": true,
ファイルを開く際に新しいウィンドウで開く。OS Xのみの機能。
create_window_at_startup
// OS X only: This controls if an empty window is created at startup or not. "create_window_at_startup": true,
アプリケーション起動時に必ずウィンドウを作るようにする。OS Xのみの機能。前回終了時にウィンドウを全て閉じていた場合の挙動についてです。設定がtrueの場合、アプリケーション起動時に空のウィンドウが作られます。falseの場合、ウィンドウは作られずにアプリケーションの起動のみが行われます。
close_windows_when_empty
// Set to true to close windows as soon as the last file is closed, unless // there's a folder open within the window. This is always enabled on OS X, // changing it here won't modify the behavior. "close_windows_when_empty": false,
ウィンドウのタブが無くなったらウインドウを閉じる。
show_full_path
// Show the full path to files in the title bar. // On OS X, this value is overridden in the platform specific settings, so // you'll need to place this line in your user settings to override it. "show_full_path": true,
タイトルバーにファイルのフルパスを表示。
show_panel_on_build
// Shows the Build Results panel when building. If set to false, the Build // Results can be shown via the Tools/Build Results menu. "show_panel_on_build": true,
ビルド時にビルド結果のパネルを表示。
preview_on_click
// Preview file contents when clicking on a file in the side bar. Double // clicking or editing the preview will open the file and assign it a tab. "preview_on_click": true,
クリックでファイルをプレビュー。サイドバーのファイルをクリックした際にタブを作らずに内容を表示します。
folder_exclude_patterns, file_exclude_patterns
// folder_exclude_patterns and file_exclude_patterns control which files // are listed in folders on the side bar. These can also be set on a per- // project basis. "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"], "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db"],
サイドバーから除外するフォルダ、ファイルの設定。
binary_file_patterns
// These files will still show up in the side bar, but won't be included in // Goto Anything or Find in Files "binary_file_patterns": ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
バイナリファイルの指定。
ignored_packages
// List any packages to ignore here. When removing entries from this list, // a restart may be required if the package contains plugins. "ignored_packages": ["Vintage"]
無視するパッケージ。ちなみにこの"Vintage"をignored_packagesから外せば、Sublime Text をVimっぽくすることができます。