sublime text 下babel插件好像优化不好,有一些性能问题。特别是在创建文件的时候,即便没有打开,插件也会尝试把文件树里的js类文件重新渲染一遍。因为js项目所用组件繁多,导致sublime text经常卡死。因此尝试用atom。

将本地代码文件与linux服务器上的同步一般用sftp类型的插件。在sublime text上可以用sftp。atom的插件大致查找一下,有这么3个:

remote-sync

与sublime text上的sftp插件相似度最高,配置文件是json格式,可以用用户名/密码组合,也可以使用key。配置文件名称是.remote-sync.json,例子如下

{
  "uploadOnSave": false,
  "useAtomicWrites": false,
  "deleteLocal": false,
  "hostname": "IP OR HOSTNAME",
  "port": "PORT",
  "target": "REMOTE PATH",
  "ignore": [
    ".remote-sync.json",
    ".git/**",
    ".gitignore"
  ],
  "username": "USERNAME",
  "keyfile": "PUB KEY PATH",
  "watch": [FILE WILL AUTO UPLOAD WHILE CHANGE],
  "saveOnUpload": true,
  "transport": "scp",
  "passphrase": "PUB KEY PASSWORD"
}

和sublime text上的sftp插件使用基本一致,可以绑定快捷键,同步时窗口下方有日志输出,可以在保存时自动上传也可以上传时自动保存。

相对来说,唯一的缺点是,公钥的密码是明文保存的,不是交互式输入,有安全隐患,希望作者早日改进吧。

remote-ftp

当前下载次数最多的同类插件(与上一个差不多),同样支持用户名/密码和key登录。配置文件名称是.ftpconfig,例子如下:

{
    "protocol": "sftp",
    "host": "IP", // string - Hostname or IP address of the server. Default: 'localhost'
    "port": 22, // integer - Port number of the server. Default: 22
    "user": "root", // string - Username for authentication. Default: (none)
    "pass": "pass", // string - Password for password-based user authentication. Default: (none),如果是key登录,注释掉这行
    "promptForPass": true, // boolean - Set to true for enable password/passphrase dialog. This will prevent from using cleartext password/passphrase in this config. Default: false
    "remote": "/", // try to use absolute paths starting with /
    "agent": "", // string - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket." Default: (none)
    "privatekey": "C:/Users/orchid/.ssh/id_rsa_4399", // string - Path to the private key file (in OpenSSH format). Default: (none)
    //"passphrase": "", // string - For an encrypted private key, this is the passphrase used to decrypt it. Default: (none) 如果要交互输入,注释掉这行
    "hosthash": "", // string - 'md5' or 'sha1'. The host's key is hashed using this method and passed to the hostVerifier function. Default: (none)
    "ignorehost": true,
    "connTimeout": 10000, // integer - How long (in milliseconds) to wait for the SSH handshake to complete. Default: 10000
    "keepalive": 10000 // integer - How often (in milliseconds) to send SSH-level keepalive packets to the server (in a similar way as OpenSSH's ServerAliveInterval config option). Set to 0 to disable. Default: 10000
    //"watch":[ // array - Files that are watched and when edited outside of the atom editor are uploaded. Useful if using a build tool e.g Gulp. Default : []
    //    "./dist/stylesheets/main.css" // reference file from the root of the project.
    //]
}

相对上个插件,一个重要的改进是key密码是交互式输入了,类似sublime text。

然而让我困惑的是,这个插件同步的时候没有日志回显,没有任何迹象。以至于我不敢确定是否已经通过过去了,因此没有使用。

另外,好像它的同步是整个项目的, 目前尚未证实。

sftp-deployment

配置文件名是deployment-config.json,例子如下:

{
    "type": "sftp",
    "host": "IP",
    "username": "root", //这里是username,不是user,否则会报错"Cannot established connection : invalid username"。官网文档没有及时更新。
    "port": "PORT",
    "remotePath": "REMOTE PATH",
    "sshKeyFile": "PUB KEY PATH",
    "passphrase": "PUB KEY PASSWORD"
}

感觉这个插件目前没什么亮点,没有日志回显(不过同步时右上角有显示状态)。key的密码也是明文保存的。

而且,插件只会识别第一个项目目录下的配置文件,如果导入了两个项目,第二个项目是无法读取到正确的配置的,至少目前是如此。

Atom目前还是个年轻的编辑器,插件开发社区也十分活跃。相信目前存在的这些问题很快会得到改进,而且功能将会愈加完善。

OK,还是得吐槽一下atom性能优化真是大问题,即使版本已经是1.6