Sublime Text 2 设置文件详解<转>

简介: 之前想设置什么都是直接在网上搜,但最近想调行距,这个把我给难住了,软件上的设置没找到,网上搜也没有,最后的最后在Sublime的官方论坛找到了,个人觉得行距还是很影响视觉体验的,看看下面的对比图就知道了: 看来想驾驭好这软件不弄清楚配置文件是不行了,周末找了时间把配置文件的每条配置信息都加上了中文注释,现在贴出来和大家共享,里面有解释不清楚的也欢迎大家伙来互相讨论:) 首先安装包控制(Package Control) Sublime Text 2 也有其用来进行 Package 控制的插件:Sublime Package Control。

之前想设置什么都是直接在网上搜,但最近想调行距,这个把我给难住了,软件上的设置没找到,网上搜也没有,最后的最后在Sublime的官方论坛找到了,个人觉得行距还是很影响视觉体验的,看看下面的对比图就知道了:

Sublime Text 2 设置文件详解

看来想驾驭好这软件不弄清楚配置文件是不行了,周末找了时间把配置文件的每条配置信息都加上了中文注释,现在贴出来和大家共享,里面有解释不清楚的也欢迎大家伙来互相讨论:)

首先安装包控制(Package Control)

Sublime Text 2 也有其用来进行 Package 控制的插件:Sublime Package Control。通过 Sublime Package Control,安装、升级和卸载 Package 也变得轻松写意了。

安装 Package Control 的方法:

  • 打开 Sublime Text 2,按下 Ctrl + ` 调出 Console
  • 将以下代码粘贴进命令行中并回车:

    import urllib2,os;
    pf='Package Control.sublime-package';
    ipp=sublime.installed_packages_path();
    os.makedirs(ipp)
    if not os.path.exists(ipp) else None;
    open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())

    重启 Sublime Text 2,如果在 Preferences -> Package Settings中见到Package Control这一项,就说明安装成功了。

Preferences.sublime-settings文件:

复制代码
  1 // While you can edit this file, it’s best to put your changes in
  2 // “User/Preferences.sublime-settings”, which overrides the settings in here.
  3 //
  4 // Settings may also be placed in file type specific options files, for
  5 // example, in Packages/Python/Python.sublime-settings for python files.
  6 {
  7 // Sets the colors used within the text area
  8 // 主题文件的路径
  9 “color_scheme”: “Packages/Color Scheme – Default/Monokai.tmTheme”,
 10 
 11 // Note that the font_face and font_size are overriden in the platform
 12 // specific settings file, for example, “Preferences (Linux).sublime-settings”.
 13 // Because of this, setting them here will have no effect: you must set them
 14 // in your User File Preferences.
 15 // 设置字体和大小,必须在Settings-User里重写,这里设置没有任何效果
 16 “font_face”: “Consolas”,
 17 “font_size”: 12,
 18 
 19 // Valid options are “no_bold”, “no_italic”, “no_antialias”, “gray_antialias”,
 20 // “subpixel_antialias” and “no_round” (OS X only)
 21 // 字体选项:no_bold不显示粗体字,no_italic不显示斜体字,no_antialias和no_antialias关闭反锯齿
 22 // subpixel_antialias和no_round是OS X系统独有的
 23 “font_options”: [],
 24 
 25 // Characters that are considered to separate words
 26 // 在文字上双击会全选当前的内容,如果里面出现以下字符,就会被截断
 27 “word_separators”: “./\\()\”‘-:,.;<>~!@#$%^&*|+=[]{}`~?”,
 28 
 29 // Set to false to prevent line numbers being drawn in the gutter
 30 // 是否显示行号
 31 “line_numbers”: true,
 32 
 33 // Set to false to hide the gutter altogether
 34 // 是否显示行号边栏
 35 “gutter”: true,
 36 
 37 // Spacing between the gutter and the text
 38 // 行号边栏和文字的间距
 39 “margin”: 4,
 40 
 41 // Fold buttons are the triangles shown in the gutter to fold regions of text
 42 // 是否显示代码折叠按钮
 43 “fold_buttons”: true,
 44 
 45 // Hides the fold buttons unless the mouse is over the gutter
 46 // 不管鼠标在不在行号边栏,代码折叠按钮一直显示
 47 “fade_fold_buttons”: true,
 48 
 49 // Columns in which to display vertical rulers
 50 //列显示垂直标尺,在中括号里填入数字,宽度按字符计算
 51 “rulers”: [],
 52 
 53 // Set to true to turn spell checking on by default
 54 // 是否打开拼写检查
 55 “spell_check”: false,
 56 
 57 // The number of spaces a tab is considered equal to
 58 // Tab键制表符宽度
 59 “tab_size”: 4,
 60 
 61 // Set to true to insert spaces when tab is pressed
 62 // 设为true时,缩进和遇到Tab键时使用空格替代
 63 “translate_tabs_to_spaces”: false,
 64 
 65 // If translate_tabs_to_spaces is true, use_tab_stops will make tab and
 66 // backspace insert/delete up to the next tabstop
 67 // translate_tabs_to_spaces设置为true,Tab和Backspace的删除/插入作用于制表符宽度
 68 // 否则作用于单个空格
 69 “use_tab_stops”: true,
 70 
 71 // Set to false to disable detection of tabs vs. spaces on load
 72 // false时禁止在载入的时候检测制表符和空格
 73 “detect_indentation”: true,
 74 
 75 // Calculates indentation automatically when pressing enter
 76 // 按回车时,自动与制表位对齐
 77 “auto_indent”: true,
 78 
 79 // Makes auto indent a little smarter, e.g., by indenting the next line
 80 // after an if statement in C. Requires auto_indent to be enabled.
 81 //针对C语言的
 82 “smart_indent”: false,
 83 
 84 // Adds whitespace up to the first open bracket when indenting. Requires
 85 // auto_indent to be enabled.
 86 // 需要启用auto_indent,第一次打开括号缩进时插入空格?(没测试出来效果…)
 87 “indent_to_bracket”: true,
 88 
 89 // Trims white space added by auto_indent when moving the caret off the
 90 // line.
 91 // 显示对齐的白线是否根据回车、tab等操作自动填补
 92 “trim_automatic_white_space”: true,
 93 
 94 // Disables horizontal scrolling if enabled.
 95 // May be set to true, false, or “auto”, where it will be disabled for
 96 // source code, and otherwise enabled.
 97 // 是否自动换行,如果选auto,需要加双引号
 98 “word_wrap”: false,
 99 
100 // Set to a value other than 0 to force wrapping at that column rather than the
101 // window width
102 // 设置窗口内文字区域的宽度
103 “wrap_width”: 0,
104 
105 // Set to false to prevent word wrapped lines from being indented to the same
106 // level
107 // 防止被缩进到同一级的字换行
108 “indent_subsequent_lines”: true,
109 
110 // Draws text centered in the window rather than left aligned
111 // 如果没有定义过,则文件居中显示(比如新建的文件)
112 “draw_centered”: false,
113 
114 // Controls auto pairing of quotes, brackets etc
115 // 自动匹配引号,括号等
116 “auto_match_enabled”: true,
117 
118 // Word list to use for spell checking
119 // 拼写检查的单词列表路径
120 “dictionary”: “Packages/Language – English/en_US.dic”,
121 
122 // Set to true to draw a border around the visible rectangle on the minimap.
123 // The color of the border will be determined by the “minimapBorder” key in
124 // the color scheme
125 // 代码地图的可视区域部分是否加上边框,边框的颜色可在配色方案上加入minimapBorder键
126 “draw_minimap_border”: false,
127 
128 // If enabled, will highlight any line with a caret
129 // 突出显示当前光标所在的行
130 “highlight_line”: false,
131 
132 // Valid values are “smooth”, “phase”, “blink”, “wide” and “solid”.
133 // 设置光标闪动方式
134 “caret_style”: “smooth”,
135 
136 // Set to false to disable underlining the brackets surrounding the caret
137 // 是否特殊显示当前光标所在的括号、代码头尾闭合标记
138 “match_brackets”: true,
139 
140 // Set to false if you’d rather only highlight the brackets when the caret is
141 // next to one
142 // 设为false时,只有光标在括号或头尾闭合标记的两端时,match_brackets才生效
143 “match_brackets_content”: true,
144 
145 // Set to false to not highlight square brackets. This only takes effect if
146 // match_brackets is true
147 // 是否突出显示圆括号,match_brackets为true生效
148 “match_brackets_square”: false,
149 
150 // Set to false to not highlight curly brackets. This only takes effect if
151 // match_brackets is true
152 // 是否突出显示大括号,match_brackets为true生效
153 “match_brackets_braces”: false,
154 
155 // Set to false to not highlight angle brackets. This only takes effect if
156 // match_brackets is true
157 // 是否突出显示尖括号,match_brackets为true生效
158 “match_brackets_angle”: false,
159 
160 // Enable visualization of the matching tag in HTML and XML
161 // html和xml下突出显示光标所在标签的两端,影响HTML、XML、CSS等
162 “match_tags”: true,
163 
164 // Highlights other occurrences of the currently selected text
165 // 全文突出显示和当前选中字符相同的字符
166 “match_selection”: true,
167 
168 // Additional spacing at the top of each line, in pixels
169 // 设置每一行到顶部,以像素为单位的间距,效果相当于行距
170 “line_padding_top”: 1,
171 
172 // Additional spacing at the bottom of each line, in pixels
173 // 设置每一行到底部,以像素为单位的间距,效果相当于行距
174 “line_padding_bottom”: 1,
175 
176 // Set to false to disable scrolling past the end of the buffer.
177 // On OS X, this value is overridden in the platform specific settings, so
178 // you’ll need to place this line in your user settings to override it.
179 // 设置为false时,滚动到文本的最下方时,没有缓冲区
180 “scroll_past_end”: true,
181 
182 // This controls what happens when pressing up or down when on the first
183 // or last line.
184 // On OS X, this value is overridden in the platform specific settings, so
185 // you’ll need to place this line in your user settings to override it.
186 // 控制向上或向下到第一行或最后一行时发生什么(没明白也没试出来)
187 “move_to_limit_on_up_down”: false,
188 
189 // Set to “none” to turn off drawing white space, “selection” to draw only the
190 // white space within the selection, and “all” to draw all white space
191 // 按space或tab时,实际会产生白色的点(一个空格一个点)或白色的横线(tab_size设置的制表符的宽度),选中状态下才能看到
192 // 设置为none时,什么情况下都不显示这些点和线
193 // 设置为selection时,只显示选中状态下的点和线
194 // 设置为all时,则一直显示
195 “draw_white_space”: “selection”,
196 
197 // Set to false to turn off the indentation guides.
198 // The color and width of the indent guides may be customized by editing
199 // the corresponding .tmTheme file, and specifying the colors “guide”,
200 // “activeGuide” and “stackGuide”
201 // 制表位的对齐白线是否显示,颜色可在主题文件里设置(guide,activeGuide,stackGuide)
202 “draw_indent_guides”: true,
203 
204 // Controls how the indent guides are drawn, valid options are
205 // “draw_normal” and “draw_active”. draw_active will draw the indent
206 // guides containing the caret in a different color.
207 // 制表位的对齐白线,draw_normal为一直显示,draw_active为只显示当前光标所在的代码控制域
208 “indent_guide_options”: ["draw_normal"],
209 
210 // Set to true to removing trailing white space on save
211 // 为true时,保存文件时会删除每行结束后多余的空格
212 “trim_trailing_white_space_on_save”: false,
213 
214 // Set to true to ensure the last line of the file ends in a newline
215 // character when saving
216 // 为true时,保存文件时光标会在文件的最后向下换一行
217 “ensure_newline_at_eof_on_save”: false,
218 
219 // Set to true to automatically save files when switching to a different file
220 // or application
221 // 切换到其它文件标签或点击其它非本软件区域,文件自动保存
222 “save_on_focus_lost”: false,
223 
224 // The encoding to use when the encoding can’t be determined automatically.
225 // ASCII, UTF-8 and UTF-16 encodings will be automatically detected.
226 // 编码时不能自动检测编码时,将自动检测ASCII, UTF-8 和 UTF-16
227 “fallback_encoding”: “Western (Windows 1252)”,
228 
229 // Encoding used when saving new files, and files opened with an undefined
230 // encoding (e.g., plain ascii files). If a file is opened with a specific
231 // encoding (either detected or given explicitly), this setting will be
232 // ignored, and the file will be saved with the encoding it was opened
233 // with.
234 // 默认编码格式
235 “default_encoding”: “UTF-8″,
236 
237 // Files containing null bytes are opened as hexadecimal by default
238 // 包含空字节的文件被打开默认为十六进制
239 “enable_hexadecimal_encoding”: true,
240 
241 // Determines what character(s) are used to terminate each line in new files.
242 // Valid values are ‘system’ (whatever the OS uses), ‘windows’ (CRLF) and
243 // ‘unix’ (LF only).
244 // 每一行结束的时候用什么字符做终止符
245 “default_line_ending”: “system”,
246 
247 // When enabled, pressing tab will insert the best matching completion.
248 // When disabled, tab will only trigger snippets or insert a tab.
249 // Shift+tab can be used to insert an explicit tab when tab_completion is
250 // enabled.
251 // 设置为enabled时,在一个字符串间按Tab将插入一个制表符
252 // 设置为true时,按Tab会根据前后环境进行代码自动匹配填补
253 “tab_completion”: true,
254 
255 // Enable auto complete to be triggered automatically when typing.
256 // 代码提示
257 “auto_complete”: true,
258 
259 // The maximum file size where auto complete will be automatically triggered.
260 // 代码提示的大小限制
261 “auto_complete_size_limit”: 4194304,
262 
263 // The delay, in ms, before the auto complete window is shown after typing
264 // 代码提示延迟显示
265 “auto_complete_delay”: 50,
266 
267 // Controls what scopes auto complete will be triggered in
268 // 代码提示的控制范围
269 “auto_complete_selector”: “source – comment”,
270 
271 // Additional situations to trigger auto complete
272 // 触发代码提示的其他情况
273 “auto_complete_triggers”: [ {"selector": "text.html", "characters": "<"} ],
274 
275 // By default, auto complete will commit the current completion on enter.
276 // This setting can be used to make it complete on tab instead.
277 // Completing on tab is generally a superior option, as it removes
278 // ambiguity between committing the completion and inserting a newline.
279 // 设为false时,选择提示的代码按回车或点击可以输出出来,但选择true时不会输出而是直接换行
280 “auto_complete_commit_on_tab”: false,
281 
282 // Controls if auto complete is shown when snippet fields are active.
283 // Only relevant if auto_complete_commit_on_tab is true.
284 // auto_complete_commit_on_tab必须为true,控制代码提示的活跃度(没明白…)
285 “auto_complete_with_fields”: false,
286 
287 // By default, shift+tab will only unindent if the selection spans
288 // multiple lines. When pressing shift+tab at other times, it’ll insert a
289 // tab character – this allows tabs to be inserted when tab_completion is
290 // enabled. Set this to true to make shift+tab always unindent, instead of
291 // inserting tabs.
292 // 设置为false,使用Shift + tab总是插入制表符
293 “shift_tab_unindent”: true,
294 
295 // If true, the selected text will be copied into the find panel when it’s
296 // shown.
297 // On OS X, this value is overridden in the platform specific settings, so
298 // you’ll need to place this line in your user settings to override it.
299 // 选中的文本按Ctrl + f时,自动复制到查找面板的文本框里
300 “find_selected_text”: true,
301 
302 //
303 // User Interface Settings
304 //
305 
306 // The theme controls the look of Sublime Text’s UI (buttons, tabs, scroll bars, etc)
307 // Data\Packages\Theme – Default\Default.sublime-theme控制软件的主题
308 “theme”: “Default.sublime-theme”,
309 
310 // Set to 0 to disable smooth scrolling. Set to a value between 0 and 1 to
311 // scroll slower, or set to larger than 1 to scroll faster
312 // 滚动的速度
313 “scroll_speed”: 1.0,
314 
315 // Controls side bar animation when expanding or collapsing folders
316 // 左边边栏文件夹动画
317 “tree_animation_enabled”: true,
318 // 标签页的关闭按钮
319 “show_tab_close_buttons”: true,
320 
321 // OS X 10.7 only: Set to true to disable Lion style full screen support.
322 // Sublime Text must be restarted for this to take effect.
323 // 针对OS X
324 “use_simple_full_screen”: false,
325 
326 // Valid values are “system”, “enabled” and “disabled”
327 // 水平垂直滚动条:system和disabled为默认显示方式,enabled为自动隐藏显示
328 “overlay_scroll_bars”: “system”,
329 
330 //
331 // Application Behavior Settings
332 //
333 
334 // Exiting the application with hot_exit enabled will cause it to close
335 // immediately without prompting. Unsaved modifications and open files will
336 // be preserved and restored when next starting.
337 //
338 // Closing a window with an associated project will also close the window
339 // without prompting, preserving unsaved changes in the workspace file
340 // alongside the project.
341 // 热推出功能!退出时不会提示是否保存文件,而是直接退出
342 // 下次打开软件时,文件保持退出前的状态,没来得及保存的内容都在,但并没有真实的写在原文件里
343 “hot_exit”: true,
344 
345 // remember_open_files makes the application start up with the last set of
346 // open files. Changing this to false will have no effect if hot_exit is
347 // true
348 // 软件使用最后的设定打开文件,hot_exit为true时没有效果
349 “remember_open_files”: true,
350 
351 // OS X only: When files are opened from finder, or by dragging onto the
352 // dock icon, this controls if a new window is created or not.
353 // 针对OS X
354 “open_files_in_new_window”: true,
355 
356 // Set to true to close windows as soon as the last file is closed, unless
357 // there’s a folder open within the window. This is always enabled on OS X,
358 // changing it here won’t modify the behavior.
359 // 针对OS X
360 “close_windows_when_empty”: true,
361 // 哪些文件会被显示到边栏上
362 // folder_exclude_patterns and file_exclude_patterns control which files
363 // are listed in folders on the side bar. These can also be set on a per-
364 // project basis.
365 “folder_exclude_patterns”: [".svn", ".git", ".hg", "CVS"],
366 “file_exclude_patterns”: ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db"],
367 // These files will still show up in the side bar, but won’t be included in
368 // Goto Anything or Find in Files
369 “binary_file_patterns”: ["*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
370 
371 // List any packages to ignore here. When removing entries from this list,
372 // a restart may be required if the package contains plugins.
373 // 删除你想要忽略的插件,需要重启
374 “ignored_packages”: ["Vintage"]
375 }
复制代码

 本文来自:http://linux.cn/article-799-1.html

目录
相关文章
|
2月前
|
前端开发 JavaScript Linux
Sublime Text 3配置Go语言开发环境
【4月更文挑战第13天】本篇文章 Huazie 向大家介绍使用 Sublime Text 3搭建Go语言开发环境,并演示编译运行 Go语言代码
738 8
Sublime Text 3配置Go语言开发环境
|
24天前
lua环境,sublime text 插件安装
lua环境,sublime text 插件安装
|
2月前
|
前端开发 Unix Linux
Sublime Text 3配置 Python 开发环境
【5月更文挑战第7天】本篇 Huazie 介绍了 Sublime Text 3 配置 Python 开发环境的相关内容,感兴趣的朋友赶紧配置起来,有任何问题可以随时评论区沟通。
46 1
Sublime Text 3配置 Python 开发环境
|
2月前
|
开发框架 前端开发 C#
Sublime Text 3配置 C# 开发环境
【5月更文挑战第2天】本篇 Huazie 介绍了 Sublime Text 3 配置 C# 的相关内容,感兴趣的朋友赶紧配置起来,有任何问题可以随时评论区沟通。
63477 7
Sublime Text 3配置 C# 开发环境
|
2月前
|
C++
Sublime Text 3 解决中文乱码问题
【5月更文挑战第1天】本篇介绍 Sublime Text 3 解决中文乱码问题,不仅仅适用于 C/C++ 代码,也适用于其他任何 Sublime Text 3 集成的开发环境。
628 5
Sublime Text 3 解决中文乱码问题
|
2月前
|
前端开发 JavaScript 开发工具
Sublime Text 3配置C/C++开发环境
【4月更文挑战第15天】本篇 Huazie 介绍了 Sublime Text 3 配置 C/C++ 的相关内容,感兴趣的朋友赶紧配置起来,有任何问题可以随时评论区沟通。
423 1
Sublime Text 3配置C/C++开发环境
|
2月前
|
API 开发工具 C++
【专栏:工具与技巧篇】使用代码编辑器(VS Code/Sublime Text)提升开发效率
【4月更文挑战第30天】在VS Code与Sublime Text两大流行代码编辑器中,开发者可借助其高效特性提升编程效率。VS Code拥有丰富的插件生态、内置Git集成、强大的调试工具、智能提示和多文件导航功能。Sublime Text则以其轻量级、快速响应、多光标编辑及自定义构建系统见长。学习编辑器的键盘快捷键、自定义配置、使用内置终端以及键绑定和宏,将助开发者进一步提高开发效率。选择适合自己的编辑器并不断适应新技术是提升开发工作流的关键。
|
2月前
|
前端开发
Sublime Text 3 快捷键总结(拿走)
Sublime Text 3 快捷键总结(拿走)
|
2月前
Sublime Text 4 设置中文、汉化
Sublime Text 4 设置中文、汉化
342 0
|
2月前
|
程序员 开发工具 开发者
猿如意开发工具|Sublime Text(4126)
猿如意开发工具|Sublime Text(4126)