forked from FG42/FG42
get rid of ruby-mode by using enh-ruby-mode
This commit is contained in:
parent
26b1e5efcf
commit
c58df5fed9
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Dependencies ----------------------------------
|
;; Dependencies ----------------------------------
|
||||||
(depends-on 'company-inf-ruby)
|
(depends-on 'company-inf-ruby)
|
||||||
(depends-on 'ruby-mode)
|
(depends-on 'enh-ruby-mode)
|
||||||
(depends-on 'rbenv)
|
(depends-on 'rbenv)
|
||||||
(depends-on 'slim-mode)
|
(depends-on 'slim-mode)
|
||||||
(depends-on 'haml-mode)
|
(depends-on 'haml-mode)
|
||||||
|
|
|
@ -3,12 +3,10 @@
|
||||||
;; Functions -------------------------------------------------
|
;; Functions -------------------------------------------------
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ruby-mode-callback ()
|
(defun enh-ruby-mode-callback ()
|
||||||
|
|
||||||
(setup-general-ruby-editor)
|
(setup-general-ruby-editor)
|
||||||
(setup-inf-ruby)
|
(setup-inf-ruby)
|
||||||
(setup-bundler)
|
(setup-bundler)
|
||||||
(setq ruby-deep-indent-paren t)
|
|
||||||
|
|
||||||
(with-ability rbenv
|
(with-ability rbenv
|
||||||
(require 'rbenv)
|
(require 'rbenv)
|
||||||
|
@ -17,12 +15,14 @@
|
||||||
(with-ability auto-pair
|
(with-ability auto-pair
|
||||||
(ruby-electric-mode t)))
|
(ruby-electric-mode t)))
|
||||||
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun extensions/ruby-initialize ()
|
(defun extensions/ruby-initialize ()
|
||||||
"Web development plugin initialization."
|
"Web development plugin initialization."
|
||||||
(message "Initializing 'ruby' extension.")
|
(message "Initializing 'ruby' extension.")
|
||||||
|
|
||||||
|
(require 'enh-ruby-mode)
|
||||||
|
(autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
|
||||||
|
|
||||||
(with-ability global-rbenv
|
(with-ability global-rbenv
|
||||||
(require 'rbenv)
|
(require 'rbenv)
|
||||||
(global-rbenv-mode))
|
(global-rbenv-mode))
|
||||||
|
@ -30,13 +30,20 @@
|
||||||
(ability ruby-editor ('flycheck)
|
(ability ruby-editor ('flycheck)
|
||||||
"Gives FG42 the ability to edit ruby files."
|
"Gives FG42 the ability to edit ruby files."
|
||||||
|
|
||||||
;; Autostart ruby mode on these file types
|
(dolist (spec '(("\\.rb$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
|
("[vV]agrantfile$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
|
("[gG]emfile$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
|
("[pP]uppetfile$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("gemspec$" . ruby-mode))
|
("\\.rake$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("config.ru$" . ruby-mode))
|
("\\.rabl$" . enh-ruby-mode)
|
||||||
(add-to-list 'auto-mode-alist '("json.jbuilder$" . ruby-mode))
|
("[cC]apfile$" . enh-ruby-mode)
|
||||||
|
("\\.gemspec$" . enh-ruby-mode)
|
||||||
|
("\\.builder$" . enh-ruby-mode)))
|
||||||
|
(add-to-list 'auto-mode-alist spec))
|
||||||
|
|
||||||
|
(setq enh-ruby-use-encoding-map nil
|
||||||
|
;; don't deep indent arrays and hashes
|
||||||
|
enh-ruby-deep-indent-paren nil)
|
||||||
|
|
||||||
;; Autostart yaml-mode
|
;; Autostart yaml-mode
|
||||||
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
||||||
|
@ -44,20 +51,20 @@
|
||||||
'(lambda ()
|
'(lambda ()
|
||||||
(define-key yaml-mode-map "\C-m" 'newline-and-indent)))
|
(define-key yaml-mode-map "\C-m" 'newline-and-indent)))
|
||||||
|
|
||||||
;; Add our callback to ruby-mode-hook
|
;; Add our callback to enh-ruby-mode-hook
|
||||||
(add-hook 'ruby-mode-hook 'ruby-mode-callback)
|
(add-hook 'enh-ruby-mode-hook 'enh-ruby-mode-callback)
|
||||||
|
|
||||||
;; configure hs-minor-mode
|
;; configure hs-minor-mode
|
||||||
(add-to-list 'hs-special-modes-alist
|
(add-to-list 'hs-special-modes-alist
|
||||||
'(ruby-mode
|
'(enh-ruby-mode
|
||||||
"\\(class\\|def\\|do\\|if\\)" "\\(end\\)" "#"
|
"\\(class\\|def\\|do\\|if\\)" "\\(end\\)" "#"
|
||||||
(lambda (arg) (ruby-end-of-block)) nil))
|
(lambda (arg) (ruby-end-of-block)) nil))
|
||||||
|
|
||||||
(add-hook 'ruby-mode-hook 'projectile-mode))
|
(add-hook 'enh-ruby-mode-hook 'projectile-mode))
|
||||||
|
|
||||||
(ability ruby-code-completion ('code-completion)
|
(ability ruby-code-completion ('code-completion)
|
||||||
"Auto complete ruby code on demand."
|
"Auto complete ruby code on demand."
|
||||||
(add-to-list 'ruby-mode-hook 'ruby-code-completion))
|
(add-to-list 'enh-ruby-mode-hook 'ruby-code-completion))
|
||||||
|
|
||||||
(ability slim-mode ()
|
(ability slim-mode ()
|
||||||
"Gives FG42 the ability to edit slim templates."
|
"Gives FG42 the ability to edit slim templates."
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
(defun setup-bundler ()
|
(defun setup-bundler ()
|
||||||
"Setup bundler and its keybindings"
|
"Setup bundler and its keybindings"
|
||||||
(require 'bundler)
|
(require 'bundler)
|
||||||
(define-key ruby-mode-map (kbd "\C-c b i") 'bundle-install)
|
(define-key enh-ruby-mode-map (kbd "\C-c b i") 'bundle-install)
|
||||||
(define-key ruby-mode-map (kbd "\C-c b u") 'bundle-update)
|
(define-key enh-ruby-mode-map (kbd "\C-c b u") 'bundle-update)
|
||||||
(define-key ruby-mode-map (kbd "\C-c b e") 'bundle-exec)
|
(define-key enh-ruby-mode-map (kbd "\C-c b e") 'bundle-exec)
|
||||||
(define-key ruby-mode-map (kbd "\C-c b o") 'bundle-open)
|
(define-key enh-ruby-mode-map (kbd "\C-c b o") 'bundle-open)
|
||||||
(define-key ruby-mode-map (kbd "\C-c b c") 'bundle-console))
|
(define-key enh-ruby-mode-map (kbd "\C-c b c") 'bundle-console))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun setup-inf-ruby()
|
(defun setup-inf-ruby()
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
(global-set-key (kbd "C-c r r") 'inf-ruby)
|
(global-set-key (kbd "C-c r r") 'inf-ruby)
|
||||||
|
|
||||||
;; TODO: We don't need this if pry setup is present in ~/.irbrc
|
;; TODO: We don't need this if pry setup is present in ~/.irbrc
|
||||||
(setq irbparams " --inf-ruby-mode -r irb/completion")
|
(setq irbparams " --inf-enh-ruby-mode -r irb/completion")
|
||||||
(setq irbpath (rbenv--expand-path "shims" "irb"))
|
(setq irbpath (rbenv--expand-path "shims" "irb"))
|
||||||
(setq irb (concat irbpath irbparams))
|
(setq irb (concat irbpath irbparams))
|
||||||
(add-to-list 'inf-ruby-implementations (cons "ruby" irb))
|
(add-to-list 'inf-ruby-implementations (cons "ruby" irb))
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
'(rspec-install-snippets))
|
'(rspec-install-snippets))
|
||||||
|
|
||||||
(ruby-tools-mode t)
|
(ruby-tools-mode t)
|
||||||
(define-key ruby-mode-map (kbd "C-.") 'insert-arrow)
|
(define-key enh-ruby-mode-map (kbd "C-.") 'insert-arrow)
|
||||||
(hs-minor-mode t)
|
(hs-minor-mode t)
|
||||||
;; Hack autocomplete so it treat :symbole and symbole the same way
|
;; Hack autocomplete so it treat :symbole and symbole the same way
|
||||||
(modify-syntax-entry ?: "."))
|
(modify-syntax-entry ?: "."))
|
||||||
|
|
|
@ -48,5 +48,10 @@ local should be 't' if theme is on FG42 it self"
|
||||||
(if (file-exists-p file)
|
(if (file-exists-p file)
|
||||||
(load-file file)))
|
(load-file file)))
|
||||||
|
|
||||||
|
(defun what-face (pos)
|
||||||
|
(interactive "d")
|
||||||
|
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||||
|
(get-char-property (point) 'face))))
|
||||||
|
(if face (message "Face: %s" face) (message "No face at %d" pos))))
|
||||||
|
|
||||||
(provide 'fg42/base)
|
(provide 'fg42/base)
|
||||||
|
|
|
@ -49,6 +49,8 @@ Based on the TextMate theme Monokai"
|
||||||
(font-lock-preprocessor-face ((t (:foreground "#66D9EF")))) ; aluminum
|
(font-lock-preprocessor-face ((t (:foreground "#66D9EF")))) ; aluminum
|
||||||
(font-lock-constant-face ((t (:foreground "#4e9a06")))) ; dark chameleon
|
(font-lock-constant-face ((t (:foreground "#4e9a06")))) ; dark chameleon
|
||||||
(font-lock-type-face ((t (:foreground "#66D9EF")))) ; light plum
|
(font-lock-type-face ((t (:foreground "#66D9EF")))) ; light plum
|
||||||
|
(enh-ruby-op-face ((t (:foreground "#dfdfda" :background nil))))
|
||||||
|
|
||||||
(font-lock-warning-face ((t (:bold t :foreground "#cc0000")))) ; scarlet red
|
(font-lock-warning-face ((t (:bold t :foreground "#cc0000")))) ; scarlet red
|
||||||
(hl-line ((t (:background "#393b2f"))))
|
(hl-line ((t (:background "#393b2f"))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue