LoginSignup
5
5

More than 5 years have passed since last update.

Atomでパッケージを作ってみた その3

Last updated at Posted at 2015-08-07

主要なクラスを試してみた。

#プロジェクトのパスを取得する。
console.log atom.project.getPaths() 
# =>"C:\Users\tajihiro\github\sample01"

TextEditor

アクティブなエディタをatom.workspace.getActiveTextEditor()で取得可能。

#アクティブエディタを取得する。
editor = atom.workspace.getActiveTextEditor()
#アクティブなエディタのフルパスを取得する。
console.log editor.getPath()
# => "C:\Users\tajihiro\github\sample01\lib\sample01.coffee" 
#アクティブなエディタのタイトルを取得する。
# => sample01.coffee 
editor.getTitle()
#アクティブなエディタの内容を取得する。
editor.getText()
#アクティブなエディタのカーソルで選択した内容を取得する。
editor.getSelectedText()
#アクティブなエディタの最上位に移動する。
editor.scrollToTop
#アクティブなエディタの最下位に移動する。
editor.scrollToBottom
#選択した内容をクリップボードにコピーする。
editor.copySelectedText()
#選択した内容をクリップボードへカットする。
editor.cutSelectedText() 

その他たくさんあるので、試してみよう。
本日はここまで。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5