zoukankan      html  css  js  c++  java
  • Nodejs开发(1.Sublime Text 3配置)

    本例使用Sublime Text 3开发

    原因:

    1. 有开发提示;

    2. 非常easy的调试运行;

    下载Sublime Text 3,官网地址:http://www.sublimetext.com/3

    下载NodeJs插件,地址:https://github.com/tanepiper/SublimeText-Nodejs

    把下载下来的插件解压并重命名为Nodejs,复制到下面目录:

    C:UsersNealAppDataRoamingSublime Text 3Packages

    这是我机器路径,根据情况适当修改。

    然后关闭掉Sublime Text 3并重启,依次点开:Tools-->Build System -->Nodejs

    再依次点击Preferences-->Package Setting-->Nodejs-->Default

    修改为实际路径:

    {

    // save before running commands

    "save_first": true,

    // if present, use this command instead of plain "node"

    // e.g. "/usr/bin/node" or "C:in ode.exe"

    "node_command": C:\Program Files\nodejs\node.exe,

    // Same for NPM command

    "npm_command": C:\Program Files\nodejs\npm.cmd,

    // as 'NODE_PATH' environment variable for node runtime

    "node_path": false,

    "expert_mode": true,

    "ouput_to_new_tab": false

    }

    这里都是Nodejs默认路径。

    然后打开文件:C:UsersNealAppDataRoamingSublime Text 3PackagesNodejs Nodejs.sublime-build

    修改为实际路径:

    {

    "cmd": ["C:\Program Files\nodejs\node.exe", "-p", "$file"],

    "file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",

    "selector": "source.js",

    "shell":true,

    "encoding": "GB2312",

    "windows":

    {

    "cmd": ["C:\Program Files\nodejs\node.exe", "$file"]

    },

    "linux":

    {

    "cmd": ["killall node; node", "$file"]

    }

    }

    重启Sublime Text 3,输入代码,保存为1.js

    按快捷键:control+b就会运行:

    clip_image002

    还有代码格式化功能,其实在sublime中已经自建了格式化按钮:  

    Edit  ->  Line  ->  Reindent      

    只是sublime并没有给他赋予快捷键,所以只需加上快捷键即可  

    Preference  ->  Key Bindings -user        

    中 括号内添加(比如添加:ctrl + alt + f)       

           { "keys": ["ctrl+alt+f"], "command": "reindent" }

  • 相关阅读:
    黑色边影,
    拉伸的代码,
    一定是selection的原因啊,要不然呢,
    status bar的差别,
    黄色,
    域名错了,
    node=day4
    PS切片
    移动端插件IScroll.js
    移动web资源概论
  • 原文地址:https://www.cnblogs.com/madyina/p/5326654.html
Copyright © 2011-2022 走看看