为Javascript 开发设置Sublime Text 3

来源:互联网 发布:2015年美国进出口数据 编辑:程序博客网 时间:2024/05/21 07:03

安装 Sublime Text 3

Ubuntu在线安装

apt-get install python-software-propertiesadd-apt-repository ppa:webupd8team/sublime-text-3apt-get updateapt-get install sublime-text-installer

配置 Sublime Text 用户设置

打开 Preferences -> Settings - Default and Preferences -> Settings - User,编辑如下:

{  // 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": "unix",  // 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": "all",   // Set to true to ensure the last line of the file ends in a newline   // character when saving  "ensure_newline_at_eof_on_save": true,   // 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": "UTF-8",  // Columns in which to display vertical rulers  "rulers": [80],  // The number of spaces a tab is considered equal to  "tab_size": 2,  // Set to true to insert spaces when tab is pressed  "translate_tabs_to_spaces": true,  // Set to true to removing trailing white space on save  "trim_trailing_white_space_on_save": true,  // Set to true to ensure the last line of the file ends in a newline  // character when saving  "ensure_newline_at_eof_on_save": true}

Install Package Control

依次选择Preferences -> Package Control and Preferences -> Package Settings

  • 选择 Preferences -> Package Control.
  • 选择 Install Package.
  • 输入包名,然后从列表选择

安装 SideBarEnhancements

即使不安装其他的包也要安装SideBarEnhancements sublime默认的文件管理很烂,SideBarEnhancements使其增色不少。

安装 DocBlockr

这个是代码注释的,输入/** 然后按Tab,就可以补全。

/** * Without DocBlockr, Sublime Text will not auto-complete this sort of * comment block. */

安装SublimeLinter and Javascript Linter

不像Sublime Text 2 版本, SublimeLinter现在拆分成一个核心框架和每一个语言包。所以需要安装SublimeLinter 和SublimeLinter-jshint两个。

安装NodeJS 和JSHint

用SublimeLinter 使用JSHint 当然需要在你的系统安装 NodeJS 和 the JSHint package。安装NodeJS可以通过源码安装,也可以通过windows installer 安装。安装完成之后通过NPM安装 JSHint 。

sudo npm install -g jshint

在Project里通过 Project Basis设置JSHint 配置

Configure the operation of JSHint in Sublime Text by using .jshintrc files: put them into your project, nesting in directories as needed. Where you must have exceptions for specific files, you can use inline JSHint settings in comments.

原文:Setting Up Sublime Text 3 for Javascript Development

0 0
原创粉丝点击