原創時間:2016-01-21
更新時間:2016-12-08
在本節中我們會學習如果安裝和使用插件
插件是Atom中一個非常重要的組成部分,很多功能都是以插件形式存在的.比如上篇文章中提到的目錄樹和設定等視窗都是通過預設安裝的插件來實作的.
檢視已安裝的插件
打開設定視窗(
Cmd+,
),再切換到”Packages”标簽頁,就可以看到已安裝的插件清單了
我們可以發現Atom預設安裝了70多個插件,Atom通過這些插件提供了各種非常有用的特性和功能
另外在設定視窗的”Themes”标簽頁中也能看到所有安裝過的主題(主題其實也是一種插件)
安裝插件
在設定視窗中切換到”Install”标簽頁
在提示有”Search packages”的文本框裡輸入插件的名字
點”Packages”或者”Themes”來查找安裝Atom的插件或主題

插件設定
當插件安裝成功以後也會在上文提到的”Packages”标簽頁中顯示出來
你可以在”Packages”标簽頁的”Filter packages by name”文本框中輸入插件的名字來搜尋已安裝的插件.
如果插件支援手動設定,在它所在的清單項中就會有一個名為”Settings”的按鈕.
主題插件
上文提過主題其實也是一種插件,你同樣可以在”Install”标簽頁中安裝主題
安裝完成後就可以使用上篇文章中提到方法來使用該主題了
下圖是使用”Unity UI”主題和”Monokai”高亮後的顯示效果
通過指令行來安裝管理插件
安裝好Atom以後你可以通過在指令行中使用
apm
指令來安裝管理插件
具體使用方法如下:
* 顯示使用幫助
# 顯示apm指令的使用幫助
# 通過這個指令可以獲得apm提供的所有子指令
apm help
# 顯示apm指令的install子指令的使用幫助
apm help install
- 安裝插件
# 安裝一個插件的最新版本
apm install <package_name>
# 安裝一個特定版本的插件
apm install <package_name>@<package_version>
# 比如要安裝0.1.5版的Emmet
apm install [email protected]
- 搜尋插件
# 搜尋插件名包含coffee的插件
apm search coffee
傳回結果:
Search Results For 'coffee' ()
├── scallahan-coffee-syntax A coffee inspired theme from the guys over at S.CALLAHAN ( downloads, stars)
├── coffee-paste Copy/Paste As : Js ➤ Coffee / Coffee ➤ Js ( downloads, stars)
├── atom-coffee-repl Coffee REPL for Atom Editor ( downloads, stars)
├── Scoffee-syntax A coffee inspired theme from the guys over at S.CALLAHAN ( downloads, stars)
├── coffee-navigator Code navigation panel for Coffee Script ( downloads, stars)
├── coffee-autocompile Auto compile Coffee-script. ( downloads, stars)
├── atom-compile-coffee This Atom.io Package compiles .coffee Files on save to .js files. (myJavascript.coffee -> myJavascript.js) ( downloads, stars)
├── coffee-sass-workflow auto-compile onSave of .coffee and .scss files (OSX maybe unix and linux too) ( downloads, stars)
├── coffee-links a code-links plugin that parses CoffeeScript. ( downloads, stars)
├── make-coffee Create CoffeeScript version of Javascript files in tree view ( downloads, star)
├── coffee-porter Convert your JS to Coffescript quickly and flexibly. ( downloads, stars)
├── coffee-refactor Refactoring support for CoffeeScript ( downloads, stars)
├── coffee-compile Preview, compile and/or save CoffeeScript in editor to Javascript ( downloads, stars)
├── iced-coffee-compiler Quickly compile IcedCoffeeScript code in the editor to JavaScript ( downloads, star)
├── pen-paper-coffee-syntax A syntax theme specifically for writing papers in markdown. Featuring a paper like color scheme and increased font-size for headings ( downloads, stars)
├── CoffeeCompile Auto compile coffee to js on save. ( downloads, star)
├── coffeescript-build Build the current coffee script file. ( downloads, stars)
├── language-typed-coffee-script TypedCoffeeScript language support in Atom ( downloads, stars)
├── language-coffee-script CoffeeScript language support in Atom ( downloads, stars)
├── linter-coffee-variables Lint CoffeeScript for undefined and unused variables ( downloads, star)
├── language-iced-coffee-script IcedCoffeeScript language support in Atom ( downloads, stars)
├── language-coffee-script-on-ice IcedCoffeeScript language support in Atom ( downloads, stars)
├── language-coffee-script-angular CoffeeScript language support in Atom for Angular Developers ( downloads, stars)
├── linter-coffeescript Lint CoffeeScript on the fly, using coffee ( downloads, stars)
├── language-iced-coffeescript Iced coffeescript for atom ( downloads, star)
├── language-coffeescript-html CoffeeScript language support with html in Atom ( downloads, star)
├── js2coffee Convert selected lines or an entire file into coffeescript. ( downloads, stars)
├── Coffeefilter Quick and easy coffeescript compilation previews ( downloads, star)
└── atom-js2coffee A js2coffee plugin for Atom editor ( downloads, stars)
Use `apm install` to install them or visit http://atom.io/packages to read more about them.
- 顯示插件詳細資訊
# 顯示git-grep插件的詳細資訊
apm view git-grep
傳回結果:
git-grep
├── .0
├── git://github.com/mizchi/atom-git-grep
├── `git grep` in atom editor
├── downloads
└── stars
Run `apm install git-grep` to install this package.