mac系统下怎样利用好sublime text 2编写html,css,js代码

mac系统下怎样利用好sublime text 2编写html,css,js代码,第1张

Sublime Text 是一个代码编辑器(Sublime Text 2是收费软件,但目前可以无限期试用)也是HTML和散文先进的文本编辑器。漂亮的用户界面和非凡的功能,例如迷你地图,多选择,Python的插件,代码段,等等。完全可自定义键绑定,菜单和工具栏。Sublime Text的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。

Sublime Text 2 被称作Windows下的TextMate,而根据其官网介绍,Sublime Text的特点如下:拥有高效、没有干扰的界面,在编辑方面的多选、宏、代码片段等功能,以及很有特色的Minimap。

自从 Sublime Text 2.0 正式版以来已经新增支持 Retina 视网膜屏、拖拽文本、构建系统得以优化、支持 CSS 自动完成以及高亮设置等新特点~

Sublime Text 2 的特色功能:

1.良好的扩展功能,官方称之为安装包(Package)。

2.右边没有滚动条,取而代之的是代码缩略图,这个功能非常赞

3.强大的快捷命令“可以实时搜索到相应的命令、选项、snippet 和 syntex, 按下回车就可以直接执行,减少了查找的麻烦。”

4.即时的文件切换。

5.随心所欲的跳转到任意文件的任意位置。

6.多重选择(Multi-Selection)功能允许在页面中同时存在多个光标

7.支持 VIM 模式

8.支持宏,简单地说就是把 *** 作录制下来或者自己编写命令,然后播放刚才录制的 *** 作或者命令。

9.更新非常勤快

主要快捷键列表:

Ctrl+L 选择整行(按住-继续选择下行)

Ctrl+KK 从光标处删除至行尾

Ctrl+Shift+K 删除整行

Ctrl+Shift+D 复制光标所在整行,插入在该行之前

Ctrl+J 合并行(已选择需要合并的多行时)

Ctrl+KU 改为大写

Ctrl+KL 改为小写

Ctrl+D 选词 (按住-继续选择下个相同的字符串)

Ctrl+M 光标移动至括号内开始或结束的位置

Ctrl+Shift+M 选择括号内的内容(按住-继续选择父括号)

Ctrl+/ 注释整行(如已选择内容,同“Ctrl+Shift+/”效果)

Ctrl+Shift+/ 注释已选择内容

Ctrl+Z 撤销

Ctrl+Y 恢复撤销

Ctrl+M 光标跳至对应的括号

Alt+. 闭合当前标签

Ctrl+Shift+A 选择光标位置父标签对儿

Ctrl+Shift+[ 折叠代码

Ctrl+Shift+] 展开代码

Ctrl+KT 折叠属性

Ctrl+K0 展开所有

Ctrl+U 软撤销

Ctrl+T 词互换

Tab 缩进 自动完成

Shift+Tab 去除缩进

Ctrl+Shift+↑ 与上行互换

Ctrl+Shift+↓ 与下行互换

Ctrl+K Backspace 从光标处删除至行首

Ctrl+Enter 光标后插入行

Ctrl+Shift+Enter 光标前插入行

Ctrl+F2 设置书签

F2 下一个书签

Shift+F2 上一个书签

Sublime Text 2 所支持的格式:

Sublime Text 2 插件下载请点击这里~Sublime Text 2 插件安装方法:将下载的安装包解压缩至 Sublime Text 2 安装目录下的 Packages 中,而后在 preferences——packages 进行具体设置~

Sublime Text 2.0.1 更新内容:

1.Keyboard input while dragging a selection will cancel the drag

2.Improved backspace behavior when use_tab_stops and translate_tabs_to_spaces are true

3.Improved shift+drag behavior

4.Improved double click drag select behavior

5.About Window shows the license key details

6.Fixed a Goto Anything issue where pressing backspace could scroll the overlay incorrectly

7.Fixed a crash triggered by double clicking in the Goto Anything overlay

8.Fixed incorrect window position when dragging a tab in some scenarios

9.Added missing toggle_preserve_case command

10.word_wrap setting accepts “true” and “false” as synonyms to true and false

11.OSX: Fixed System Preferences menu not working

12.Linux: Added support for mice with more than 5 buttons

13.Linux: Fixed an occasional graphical glitch when running under Unity

支持运行环境:Windows XP/Vista/Win7/Win8

Sublime Text 2.0.1 便携版 下载(来自wkang956的汉化):

(8.2MB)(将替换文件夹中的“SublimeText.exe”替换“SublimeText2”目录中的同名文件即可运行)

## 一、搭建本地开发环境

1、[安装HomeBrew](http://brew.sh/index_zh-cn.html)

安装命令

>/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

卸载命令

>ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

2、[使用HomeBrew安装node.js](http://nodejs.cn/download/package-manager/#osx)

3、安装express

>npm install -g express

>

>npm install -g express-generator

4、安装WebStorm

[WebStorm 11](https://pan.baidu.com/s/1c1PeBao)(2016.1)

破解方法:启动选择License server,输入“http://idea.qinxi1992.cn”。

5、[使用HomeBrew安装并启动MongoDB](http://blog.csdn.net/fsw0723/article/details/17040999)

#### 注意事项及相关报错:

1、通过 express -V 查看express版本号

express版本号小于4.0,使用 node app 运行。

express版本号大于4.0,使用 npm start 或 node bin/www 运行

2、brew install mongodb 报错“Error:Permission denied - /usr/local/var”

在“/usr/local/”下创建文件夹“var”即可

## 二、配置服务端

1、[配置并启动服务器](https://aws.amazon.com/cn/?sc_channel=PS&sc_campaign=acquisition_CN&sc_publisher=baidu&sc_medium=brandzone&sc_content=pc&sc_detail=title&sc_category=pc&sc_segment=101&sc_matchtype=exact&sc_country=CN)

2、连接服务器

1)、使用密钥连接

>ssh -i ~/.ssh/server.pem ec2-user@{公共ip}

2)、使用密码登陆,如没有开启密码登陆方式,参考三

>ssh ec2-user@{公有ip}

3、启用密码登陆方式

1)、创建root密码:

>sudo passwd root

2)、切换root身份,并编辑sshd_config文件

>su root

>

>vim /etc/ssh/sshd_config

搜索PasswordAuthentication no,把no改为yes。

3)、重启sshd

>/sbin/service sshd restart

4)、给用户ec2-user添加密码

>passwd ec2-user

5)、新开一个窗口,验证登录密码

>ssh ec2-user@{公有ip}

4)、安装node.js、npm

>git clone https://github.com/nodejs/node.git

>

>cd node

>

>git tag -l

>

>git checkout v6.3.0

>

>./configure

>

>make

>

>sudo make install

5、安装express

修改sudoers文件

>su root

>vim /etc/sudoers

找到“secure_path”,然后添加node、npm的安装路径“:/usr/local/bin”

安装express、express-generator

>sudo npm install -g express

>

>sudo npm install -g express-generator

5)、[安装、启动mongodb](https://docs.mongodb.com/master/tutorial/install-mongodb-on-amazon/?_ga=1.67701784.882863290.1470383187)

#### 注意事项:

1、启动亚马逊服务器之前,先选择地区,默认是美国东部的佛吉尼亚北部(建议选择亚太区的)。启动之后不可更改。

2、WebStorm程序默认使用端口3000,建议直接开启服务器的端口3000。

## 三、服务端运行

1、用WebStorm创建一个NodeJs Express App的项目

不需要写什么,空的就好。

2、上传到服务端,介绍四种上传方式。

+ 用WebStorm连接服务端

第一步、Tools->Deployment->configruation

第二步、配置Connection

![image](http://upload-images.jianshu.io/upload_images/2477695-37378cc996619eb8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

第三步、配置Mappings

![image](http://upload-images.jianshu.io/upload_images/2477695-cc0bb70d28406924.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

+ 通过git push到oschina、bitbucket等,再通过git pull到服务器

只需要在Mac端、服务端安装git即可。推荐[Git@OSC](https://git.oschina.net/),可免费创建100个项目。

+ 在亚马逊云服务器配置GitLab

[服务端配置GItLab,选择“CentOS 6”](https://about.gitlab.com/downloads/#centos6)

安装完成在浏览器输入服务器地址,根据提示输入root密码。如果出现502错误,检查服务器8080端口是否开启。亚马逊配置的Gitlab不是很稳定,不推荐。

+ 使用ftp工具

每次上传都是全部,速度很慢,不推荐。

3、运行并查看效果

终端连接服务器,并进入项目目录,输入node app,然后在浏览器输入服务器地址,打开“Express Welcom to Express”界面。(WebStorm工程端口号默认3000)


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11835071.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存