当前位置:   article > 正文

为Javascript 开发设置Sublime Text 3_sublime text有javascript创建代码框架的几个做法

sublime text有javascript创建代码框架的几个做法

安装 Sublime Text 3

Ubuntu在线安装

apt-get install python-software-properties
add-apt-repository ppa:webupd8team/sublime-text-3
apt-get update
apt-get install sublime-text-installer
  • 1
  • 2
  • 3
  • 4

配置 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
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

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.
 */
  • 1
  • 2
  • 3
  • 4

安装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
  • 1

在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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/79648
推荐阅读