12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ATOMエディタでちょっとしたオレオレ関数をつくる

Last updated at Posted at 2014-03-28

例えば「カーソル位置を選択(select word)」→「検索窓を開く(replace-and-find:show)」までを一括で実行したい場合。

環境:ATOM 0.78

(1) Preferences cmd-, -> 左下の「Open ~/.atom」ボタン

(2) 以下のファイルを編集

init.coffee
selectAndFind =->
  editor = atom.workspace.activePaneItem
  editor.selectWord()
  atom.workspaceView.trigger "find-and-replace:show"
atom.workspaceView.command "my-find:select-and-find", => selectAndFind()
keymap.cson
'.editor':
  'ctrl-s' : 'my-find:select-and-find'

(3) ウィンドウをリロード (window:reload ctrl-alt-cmd-l)

これでctrl-sでカーソル位置を選択した後に検索窓を開くようになると思います。規模が大きくなってきたらパッケージ化したほうが良いかもしれませんね。で、みんなのためにPublishingしてください(^^)

12
10
1

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
12
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?