motion-mode

https://github.com/ainame/motion-mode.git

git clone 'git://github.com/ainame/motion-mode.git'
31

motion-mode

Description

The motion-mode provides some convenient features when you write codes in RubyMotion. The features are the following:

The motion-mode provides some convenient commands(motion-execute-rake, motion-dash-at-point, etc…), but the motion-mode dosen't provide key-binds. You can setup key-binds as you like.

Install

Write the following codes in your init.el

(require 'package)
(dolist (archive '(("melpa" . "http://melpa.milkbox.net/packages/")))
  (add-to-list 'package-archives archive :append))
(package-initialize)

(when (null package-archive-contents)
  (package-refresh-contents))

(defvar my-packages '(motion-mode
                      some-other-cool-mode
                      moar-modes
                      ...))

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

and then:

M-x package-install

Usage

Change to the appropriate directory:

$ cd ~/.emacs.d/elpa/motion-mode-YYYYMMDD.233 # <- the suffix will be different on your machine

and then:

$ iOS=7.1 # <-- set this to your requirements
$ HEADERS_PATH=$(xcode-select -print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${iOS}.sdk/System/Library/Frameworks
$ find ${HEADERS_PATH} -name "*.h" | xargs ruby bin/make_dict.rb
$ cp ./motion-mode ~/.emacs.d/ac-dict
$ emacs ~/.emacs.d/init.el

If you're installing your packages manually, and didn't follow the advice above in the Install section, add following settings:

(add-to-list 'load-path "~/.emacs.d/elisp/some-dir-of-your-choice/motion-mode") # <-- check this path
(require 'motion-mode)

Regardless how you've installed motion-mode, add these settings:

;; following add-hook is very important.
(add-hook 'ruby-mode-hook 'motion-recognize-project)
(add-to-list 'ac-modes 'motion-mode)
(add-to-list 'ac-sources 'ac-source-dictionary)
;; set key-binds as you like
(define-key motion-mode-map (kbd "C-c C-c") 'motion-execute-rake)
(define-key motion-mode-map (kbd "C-c C-d") 'motion-dash-at-point)

Commands

You can set key-binds of the following commands. The motion-mode doesn't provide default key bindings.

Setting Example

(define-key motion-mode-map (kbd "C-c C-c") 'motion-execute-rake)
(define-key motion-mode-map (kbd "C-c C-d") (lambda () (interactive) (motion-execute-rake-command "device")))
(define-key motion-mode-map (kbd "C-c C-o") 'motion-dash-at-point)
(define-key motion-mode-map (kbd "C-c C-p") 'motion-convert-code-region)

Function

Variable

See Also