2015-07-04 03:33:13 +00:00
|
|
|
;;; packages.el --- Ruby on Rails Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-07-04 03:33:13 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-07-06 07:32:22 +00:00
|
|
|
(setq ruby-on-rails-packages
|
2015-07-04 03:33:13 +00:00
|
|
|
'(
|
|
|
|
feature-mode
|
|
|
|
projectile-rails
|
2016-08-02 08:34:17 +00:00
|
|
|
which-key
|
2015-07-04 03:33:13 +00:00
|
|
|
))
|
|
|
|
|
2015-07-06 07:32:22 +00:00
|
|
|
(defun ruby-on-rails/init-projectile-rails ()
|
2015-07-04 03:33:13 +00:00
|
|
|
(use-package projectile-rails
|
|
|
|
:config
|
|
|
|
(progn
|
2017-02-11 10:19:04 +00:00
|
|
|
(projectile-rails-global-mode)
|
2015-07-04 03:33:13 +00:00
|
|
|
(spacemacs|diminish projectile-rails-mode " ⇋" " RoR")
|
|
|
|
|
|
|
|
;; Find files
|
2015-10-15 20:52:43 +00:00
|
|
|
(dolist (mode '(ruby-mode enh-ruby-mode))
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"rfa" 'projectile-rails-find-locale
|
|
|
|
"rfc" 'projectile-rails-find-controller
|
|
|
|
"rfe" 'projectile-rails-find-environment
|
|
|
|
"rff" 'projectile-rails-find-feature
|
|
|
|
"rfh" 'projectile-rails-find-helper
|
|
|
|
"rfi" 'projectile-rails-find-initializer
|
|
|
|
"rfj" 'projectile-rails-find-javascript
|
|
|
|
"rfl" 'projectile-rails-find-lib
|
|
|
|
"rfm" 'projectile-rails-find-model
|
|
|
|
"rfn" 'projectile-rails-find-migration
|
|
|
|
"rfo" 'projectile-rails-find-log
|
|
|
|
"rfp" 'projectile-rails-find-spec
|
|
|
|
"rfr" 'projectile-rails-find-rake-task
|
|
|
|
"rfs" 'projectile-rails-find-stylesheet
|
2017-07-29 18:20:56 +00:00
|
|
|
"rfS" 'projectile-rails-find-serializer
|
2015-11-18 00:38:05 +00:00
|
|
|
"rft" 'projectile-rails-find-test
|
|
|
|
"rfu" 'projectile-rails-find-fixture
|
|
|
|
"rfv" 'projectile-rails-find-view
|
|
|
|
"rfy" 'projectile-rails-find-layout
|
|
|
|
"rf@" 'projectile-rails-find-mailer
|
2015-10-15 20:52:43 +00:00
|
|
|
;; Goto file
|
2015-11-18 00:38:05 +00:00
|
|
|
"rgc" 'projectile-rails-find-current-controller
|
|
|
|
"rgd" 'projectile-rails-goto-schema
|
|
|
|
"rge" 'projectile-rails-goto-seeds
|
|
|
|
"rgh" 'projectile-rails-find-current-helper
|
|
|
|
"rgj" 'projectile-rails-find-current-javascript
|
|
|
|
"rgg" 'projectile-rails-goto-gemfile
|
|
|
|
"rgm" 'projectile-rails-find-current-model
|
|
|
|
"rgn" 'projectile-rails-find-current-migration
|
|
|
|
"rgp" 'projectile-rails-find-current-spec
|
|
|
|
"rgr" 'projectile-rails-goto-routes
|
|
|
|
"rgs" 'projectile-rails-find-current-stylesheet
|
|
|
|
"rgt" 'projectile-rails-find-current-test
|
|
|
|
"rgu" 'projectile-rails-find-current-fixture
|
|
|
|
"rgv" 'projectile-rails-find-current-view
|
|
|
|
"rgz" 'projectile-rails-goto-spec-helper
|
|
|
|
"rg." 'projectile-rails-goto-file-at-point
|
2015-10-15 20:52:43 +00:00
|
|
|
;; Rails external commands
|
2015-11-27 04:56:21 +00:00
|
|
|
"r:" 'projectile-rails-rake
|
2015-11-18 00:38:05 +00:00
|
|
|
"rcc" 'projectile-rails-generate
|
|
|
|
"ri" 'projectile-rails-console
|
|
|
|
"rxs" 'projectile-rails-server
|
2015-10-15 20:52:43 +00:00
|
|
|
;; Refactoring 'projectile-rails-mode
|
2016-10-12 20:01:24 +00:00
|
|
|
"rRx" 'projectile-rails-extract-region)
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mr" "rails/rubocop")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mrf" "file")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mrg" "goto"))
|
2016-08-02 08:34:17 +00:00
|
|
|
|
2015-07-04 03:33:13 +00:00
|
|
|
;; Ex-commands
|
|
|
|
(evil-ex-define-cmd "A" 'projectile-toggle-between-implementation-and-test))))
|
|
|
|
|
2015-07-06 07:32:22 +00:00
|
|
|
(defun ruby-on-rails/init-feature-mode ()
|
2015-07-04 03:33:13 +00:00
|
|
|
"Initialize Cucumber feature mode"
|
|
|
|
(use-package feature-mode
|
|
|
|
:mode (("\\.feature\\'" . feature-mode))))
|
2016-08-02 08:34:17 +00:00
|
|
|
|
|
|
|
(defun ruby-on-rails/post-init-which-key ()
|
2016-11-22 18:34:22 +00:00
|
|
|
(push '((nil . "projectile-rails-\\(.+\\)") . (nil . "\\1"))
|
|
|
|
which-key-replacement-alist))
|